Introduction

Marks are the core plotting components (e.g. lines, bars, pie, scatter) etc. All Marks extend the Mark class. Marks take one or more data attributes and style attributes (styling, colors etc.). Most of these attributes are eventful (instances of traitlets).

For each data attribute a corresponding Scale object needs to passed when constructing Mark objects, like so:

Lines mark using Object Model
import bqplot as bq
import numpy as np

# data attributes
x = np.linspace(-10, 10, 100)
y = np.sin(x)

# scales for each data attribute
xs = bq.LinearScale()
ys = bq.LinearScale()

line = bq.Lines(x, y, scales={"x": xs, "y": ys})

A preferred approach is to use pyplot which sets meaningful defaults when constructing marks. Most of the time you don't need to create scales explicitly. Let's look at an example:

Lines mark using pyplot
import bqplot as bq
import numpy as np

# data attributes
x = np.linspace(-10, 10, 100)
y = np.sin(x)

line = plt.plot(x, y)

Take a look at specific mark documents for more details on customizing/rendering various marks in bqplot