API Reference Documentation

BQPlot Package

Each plot starts with a Figure object. A Figure has a number of Axis objects (representing scales) and a number of Mark objects. Mark objects are a visual representation of the data. Scales transform data into visual properties (typically a number of pixels, a color, etc.).

from bqplot import *
from IPython.display import display

x_data = range(10)
y_data = [i ** 2 for i in x_data]

x_sc = LinearScale()
y_sc = LinearScale()

ax_x = Axis(label='Test X', scale=x_sc, tick_format='0.0f')
ax_y = Axis(label='Test Y', scale=y_sc, orientation='vertical', tick_format='0.2f')

line = Lines(x=x_data,
             scales={'x': x_sc, 'y': y_sc},
             colors=['red', 'yellow'])

fig = Figure(axes=[ax_x, ax_y], marks=[line])



Figure(**kwargs) Main canvas for drawing a chart.


Scale(**kwargs) The base scale class.
LinearScale(**kwargs) A linear scale.
LogScale(**kwargs) A log scale.
DateScale(**kwargs) A date scale, with customizable formatting.
OrdinalScale(**kwargs) An ordinal scale.
ColorScale(**kwargs) A color scale.
DateColorScale(**kwargs) A date color scale.
OrdinalColorScale(**kwargs) An ordinal color scale.
GeoScale(**kwargs) The base projection scale class for Map marks.
Mercator(**kwargs) A geographical projection scale commonly used for world maps.
AlbersUSA(**kwargs) A composite projection of four Albers projections meant specifically for the United States.
Gnomonic(**kwargs) A perspective projection which displays great circles as straight lines.
Stereographic(**kwargs) A perspective projection that uses a bijective and smooth map at every point except the projection point.


Mark(**kwargs) The base mark class.
Lines(**kwargs) Lines mark.
FlexLine(**kwargs) Flexible Lines mark.
Scatter(**kwargs) Scatter mark.
Hist(**kwargs) Histogram mark.
Bars(**kwargs) Bar mark.
Graph(**kwargs) Graph with nodes and links.
GridHeatMap(**kwargs) GridHeatMap mark.
HeatMap(**kwargs) HeatMap mark.
Label(**kwargs) Label mark.
OHLC(**kwargs) Open/High/Low/Close marks.
Pie(**kwargs) Piechart mark.
Map(**kwargs) Map mark.


Axis(**kwargs) A line axis.
ColorAxis(**kwargs) A colorbar axis.

Market Map

MarketMap(**kwargs) Waffle wrapped map.


BrushIntervalSelector(**kwargs) Brush interval selector interaction.
BrushSelector(**kwargs) Brush interval selector interaction.
HandDraw(**kwargs) A hand-draw interaction.
IndexSelector(**kwargs) Index selector interaction.
FastIntervalSelector(**kwargs) Fast interval selector interaction.
MultiSelector(**kwargs) Multi selector interaction.
OneDSelector(**kwargs) One-dimensional selector interaction
Interaction(**kwargs) The base interaction class.
PanZoom(**kwargs) An interaction to pan and zoom wrt scales.
Selector(**kwargs) Selector interaction.
TwoDSelector(**kwargs) Two-dimensional selector interaction.

Traits Types

Date([default_value]) A datetime trait type.


Toolbar(**kwargs) Default toolbar for bqplot figures.


figure([key, fig]) Creates figures and switches between figures.
show([key, display_toolbar]) Shows the current context figure in the output area.
axes([mark, options]) Draws axes corresponding to the scales of a given mark.
plot(*args, **kwargs) Draw lines in the current context figure.
scatter(x, y, **kwargs) Draw a scatter in the current context figure.
hist(sample[, options]) Draw a histogram in the current context figure.
bar(x, y, **kwargs) Draws a bar chart in the current context figure.
ohlc(*args, **kwargs) Draw OHLC bars or candle bars in the current context figure.
geo(map_data, **kwargs) Draw a map in the current context figure.
clear() Clears the current context figure of all marks axes and grid lines.
close(key) Closes and unregister the context figure corresponding to the key.
current_figure() Returns the current context figure.
scales([key, scales]) Creates and switches between context scales.
xlim(min, max) Set the domain bounds of the current ‘x’ scale.
ylim(min, max) Set the domain bounds of the current ‘y’ scale.
axes([mark, options]) Draws axes corresponding to the scales of a given mark.
xlabel([label, mark]) Sets the value of label for an axis whose associated scale has the dimension x.
ylabel([label, mark]) Sets the value of label for an axis whose associated scale has the dimension y.