Bqplot Documentation: Release 0.10.0

Download as pdf or txt
Download as pdf or txt
You are on page 1of 97

bqplot Documentation

Release 0.10.0

Bloomberg LP

Nov 07, 2017


Contents

1 Introduction 1
1.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Usage 3
2.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 API Reference Documentation 5


3.1 BQPlot Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Python Module Index 87

i
ii
CHAPTER 1

Introduction

bqplot is a Grammar of Graphics-based interactive plotting framework for the Jupyter notebook.

In bqplot, every single attribute of the plot is an interactive widget. This allows the user to integrate any plot with
IPython widgets to create a complex and feature rich GUI from just a few simple lines of Python code.

1.1 Goals

• provide a unified framework for 2-D visualizations with a pythonic API.


• provide a sensible API for adding user interactions (panning, zooming, selection, etc)
Two APIs are provided
• Users can build custom visualizations using the internal object model, which is inspired by the constructs of the
Grammar of Graphics (figure, marks, axes, scales), and enrich their visualization with our Interaction Layer.
• Or they can use the context-based API similar to Matplotlib’s pyplot, which provides sensible default choices
for most parameters.

1.2 Installation

Using pip:

pip install bqplot


jupyter nbextension enable --py --sys-prefix bqplot

Using conda

conda install -c conda-forge bqplot

1
bqplot Documentation, Release 0.10.0

2 Chapter 1. Introduction
CHAPTER 2

Usage

2.1 Examples

Using the pyplot API


import numpy as np
from bqplot import pyplot as plt

plt.figure(1, title='Line Chart')


np.random.seed(0)
n = 200
x = np.linspace(0.0, 10.0, n)
y = np.cumsum(np.random.randn(n))
plt.plot(x, y)
plt.show()

[ widget ] Using the bqplot internal object model


import numpy as np
from IPython.display import display
from bqplot import (
OrdinalScale, LinearScale, Bars, Lines, Axis, Figure
)

size = 20
np.random.seed(0)

x_data = np.arange(size)

x_ord = OrdinalScale()
y_sc = LinearScale()

bar = Bars(x=x_data, y=np.random.randn(2, size), scales={'x': x_ord, 'y':


y_sc}, type='stacked')
line = Lines(x=x_data, y=np.random.randn(size), scales={'x': x_ord, 'y': y_sc},

3
bqplot Documentation, Release 0.10.0

stroke_width=3, colors=['red'], display_legend=True, labels=['Line chart


˓→ '])

ax_x = Axis(scale=x_ord, grid_lines='solid', label='X')


ax_y = Axis(scale=y_sc, orientation='vertical', tick_format='0.2f',
grid_lines='solid', label='Y')

Figure(marks=[bar, line], axes=[ax_x, ax_y], title='API Example',


legend_location='bottom-right')

[ widget ]

4 Chapter 2. Usage
CHAPTER 3

API Reference Documentation

3.1 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,
y=y_data,
scales={'x': x_sc, 'y': y_sc},
colors=['red', 'yellow'])

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

display(fig)

3.1.1 Figure

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

5
bqplot Documentation, Release 0.10.0

bqplot.figure.Figure

class bqplot.figure.Figure(**kwargs)
Main canvas for drawing a chart.
The Figure object holds the list of Marks and Axes. It also holds an optional Interaction object that is responsible
for figure-level mouse interactions, the “interaction layer”.
Besides, the Figure object has two reference scales, for positioning items in an absolute fashion in the figure
canvas.
title
string (default: ‘’) – title of the figure
axes
List of Axes (default: []) – list containing the instances of the axes for the figure
marks
List of Marks (default: []) – list containing the marks which are to be appended to the figure
interaction
Interaction or None (default: None) – optional interaction layer for the figure
scale_x
Scale – Scale representing the x values of the figure
scale_y
Scale – Scale representing the y values of the figure
padding_x
Float (default: 0.0) – Padding to be applied in the horizontal direction of the figure around the data points,
proportion of the horizontal length
padding_y
Float (default: 0.025) – Padding to be applied in the vertical direction of the figure around the data points,
proportion of the vertical length
legend_location
{‘top-right’, ‘top’, ‘top-left’, ‘left’, ‘bottom-left’, ‘bottom’, ‘bottom-right’, ‘right’} – location of the legend
relative to the center of the figure
background_style
Dict (default: {}) – CSS style to be applied to the background of the figure
legend_style
Dict (default: {}) – CSS style to be applied to the SVG legend e.g, {‘fill’: ‘white’}
legend_text
Dict (default: {}) – CSS style to be applied to the legend text e.g., {‘font-size’: 20}
title_style
Dict (default: {}) – CSS style to be applied to the title of the figure
animation_duration
nonnegative int (default: 0) – Duration of transition on change of data attributes, in milliseconds.
Layout Attributes
fig_margin
dict (default: {top=60, bottom=60, left=60, right=60}) – Dictionary containing the top, bottom, left and
right margins. The user is responsible for making sure that the width and height are greater than the sum
of the margins.

6 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

min_aspect_ratio
float – minimum width / height ratio of the figure
max_aspect_ratio
float – maximum width / height ratio of the figure
save_png:
Saves the figure as a png file

Note: The aspect ratios stand for width / height ratios.


• If the available space is within bounds in terms of min and max aspect ratio, we use the entire available
space.
• If the available space is too oblong horizontally, we use the client height and the width that corresponds
max_aspect_ratio (maximize width under the constraints).
• If the available space is too oblong vertically, we use the client width and the height that corresponds to
min_aspect_ratio (maximize height under the constraint). This corresponds to maximizing the area under
the constraints.
Default min and max aspect ratio are both equal to 16 / 9.

__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_class(className) Adds a class to the top level element of the widget.
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
Continued on next page

3.1. BQPlot Package 7


bqplot Documentation, Release 0.10.0

Table 3.2 – continued from previous page


on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
remove_class(className) Removes a class from the top level element of the wid-
get.
save_png()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.2 Scales

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.

bqplot.scales.Scale

class bqplot.scales.Scale(**kwargs)
The base scale class.
Scale objects represent a mapping between data (the domain) and a visual quantity (The range).

8 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

scale_types
dict (class-level attribute) – A registry of existing scale types.
domain_class
type (default: Float) – traitlet type used to validate values in of the domain of the scale.
reverse
bool (default: False) – whether the scale should be reversed.
allow_padding
bool (default: True) – indicates whether figures are allowed to add data padding to this scale or not.
precedence
int (class-level attribute) – attribute used to determine which scale takes precedence in cases when two or
more scales have the same rtype and dtype.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
Continued on next page

3.1. BQPlot Package 9


bqplot Documentation, Release 0.10.0

Table 3.4 – continued from previous page


send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.LinearScale

class bqplot.scales.LinearScale(**kwargs)
A linear scale.
An affine mapping from a numerical domain to a numerical range.
min
float or None (default: None) – if not None, min is the minimal value of the domain
max
float or None (default: None) – if not None, max is the maximal value of the domain
rtype
string (class-level attribute) – This attribute should not be modifed. The range type of a linear scale is
numerical.
dtype
type (class-level attribute) – the associated data type / domain type
precedence
int (class-level attribute, default_value=2) – attribute used to determine which scale takes precedence in
cases when two or more scales have the same rtype and dtype. default_value is 2 because for the same
range and domain types, LinearScale should take precedence.
stabilized
bool (default: False) – if set to False, the domain of the scale is tied to the data range if set to True,
the domain of the scale is udpated only when the data range is beyond certain thresholds, given by the
attributes mid_range and min_range.
mid_range
float (default: 0.8) – Proportion of the range that is spanned initially. Used only if stabilized is True.
min_range
float (default: 0.6) – Minimum proportion of the range that should be spanned by the data. If the data span
falls beneath that level, the scale is reset. min_range must be <= mid_range. Used only if stabilized is
True.
__init__(**kwargs)
Public constructor

10 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1. BQPlot Package 11


bqplot Documentation, Release 0.10.0

bqplot.scales.LogScale

class bqplot.scales.LogScale(**kwargs)
A log scale.
A logarithmic mapping from a numerical domain to a numerical range.
min
float or None (default: None) – if not None, min is the minimal value of the domain
max
float or None (default: None) – if not None, max is the maximal value of the domain
rtype
string (class-level attribute) – This attribute should not be modifed by the user. The range type of a linear
scale is numerical.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
Continued on next page

12 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.6 – continued from previous page


on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.DateScale

class bqplot.scales.DateScale(**kwargs)
A date scale, with customizable formatting.
An affine mapping from dates to a numerical range.
min
Date or None (default: None) – if not None, min is the minimal value of the domain
max
Date (default: None) – if not None, max is the maximal value of the domain
domain_class
type (default: Date) – traitlet type used to validate values in of the domain of the scale.
rtype
string (class-level attribute) – This attribute should not be modifed by the user. The range type of a linear
scale is numerical.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
Continued on next page

3.1. BQPlot Package 13


bqplot Documentation, Release 0.10.0

Table 3.7 – continued from previous page


class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.OrdinalScale

class bqplot.scales.OrdinalScale(**kwargs)
An ordinal scale.
A mapping from a discrete set of values to a numerical range.
domain
list (default: []) – The discrete values mapped by the ordinal scale
rtype
string (class-level attribute) – This attribute should not be modifed by the user. The range type of a linear
scale is numerical.

14 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
Continued on next page

3.1. BQPlot Package 15


bqplot Documentation, Release 0.10.0

Table 3.8 – continued from previous page


unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.ColorScale

class bqplot.scales.ColorScale(**kwargs)
A color scale.
A mapping from numbers to colors. The relation is affine by part.
scale_type
{‘linear’} – scale type
colors
list of colors (default: []) – list of colors
min
float or None (default: None) – if not None, min is the minimal value of the domain
max
float or None (default: None) – if not None, max is the maximal value of the domain
mid
float or None (default: None) – if not None, mid is the value corresponding to the mid color.
scheme
string (default: ‘RdYlGn’) – Colorbrewer color scheme of the color scale.
rtype
string (class-level attribute) – The range type of a color scale is ‘Color’. This should not be modifed.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
Continued on next page

16 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.9 – continued from previous page


has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.DateColorScale

class bqplot.scales.DateColorScale(**kwargs)
A date color scale.
A mapping from dates to a numerical domain.
min
Date or None (default: None) – if not None, min is the minimal value of the domain
max
Date or None (default: None) – if not None, max is the maximal value of the domain
mid
Date or None (default: None) – if not None, mid is the value corresponding to the mid color.
rtype
string (class-level attribute) – This attribute should not be modifed by the user. The range type of a color
scale is ‘Color’.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

3.1. BQPlot Package 17


bqplot Documentation, Release 0.10.0

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.OrdinalColorScale

class bqplot.scales.OrdinalColorScale(**kwargs)
An ordinal color scale.

18 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

A mapping from a discrete set of values to colors.


domain
list (default: []) – The discrete values mapped by the ordinal scales.
rtype
string (class-level attribute) – This attribute should not be modifed by the user. The range type of a color
scale is ‘color’.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
Continued on next page

3.1. BQPlot Package 19


bqplot Documentation, Release 0.10.0

Table 3.11 – continued from previous page


set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.GeoScale

class bqplot.scales.GeoScale(**kwargs)
The base projection scale class for Map marks.
The GeoScale represents a mapping between topographic data and a 2d visual representation.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
Continued on next page

20 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.12 – continued from previous page


on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.Mercator

class bqplot.scales.Mercator(**kwargs)
A geographical projection scale commonly used for world maps.
The Mercator projection is a cylindrical map projection which ensures that any course of constant bearing is a
straight line.
scale_factor
float (default: 190) – Specifies the scale value for the projection
center
list (default: (0, 60)) – Specifies the longitude and latitude where the map is centered.
rotate
tuple (default: (0, 0)) – Degree of rotation in each axis.
rtype
(Number, Number) (class-level attribute) – This attribute should not be modifed. The range type of a geo
scale is a tuple.
dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
Continued on next page

3.1. BQPlot Package 21


bqplot Documentation, Release 0.10.0

Table 3.13 – continued from previous page


class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.AlbersUSA

class bqplot.scales.AlbersUSA(**kwargs)
A composite projection of four Albers projections meant specifically for the United States.
scale_factor
float (default: 1200) – Specifies the scale value for the projection
rtype
(Number, Number) (class-level attribute) – This attribute should not be modifed. The range type of a geo
scale is a tuple.

22 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

dtype
type (class-level attribute) – the associated data type / domain type
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
Continued on next page

3.1. BQPlot Package 23


bqplot Documentation, Release 0.10.0

Table 3.14 – continued from previous page


unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.Gnomonic

class bqplot.scales.Gnomonic(**kwargs)
A perspective projection which displays great circles as straight lines.
The projection is neither equal-area nor conformal.
scale_factor
float (default: 145) – Specifies the scale value for the projection
center
list (default: (0, 60)) – Specifies the longitude and latitude where the map is centered.
precision
float (default: 0.1) – Specifies the threshold for the projections adaptive resampling to the specified value
in pixels.
clip_angle
float (default: 89.999) – Specifies the clipping circle radius to the specified angle in degrees.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
Continued on next page

24 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.15 – continued from previous page


on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.scales.Stereographic

class bqplot.scales.Stereographic(**kwargs)
A perspective projection that uses a bijective and smooth map at every point except the projection point.
The projection is not an equal-area projection but it is conformal.
scale_factor
float (default: 250) – Specifies the scale value for the projection
rotate
tuple (default: (96, 0)) – Degree of rotation in each axis.
center
list (default: (0, 60)) – Specifies the longitude and latitude where the map is centered.
precision
float (default: 0.1) – Specifies the threshold for the projections adaptive resampling to the specified value
in pixels.
clip_angle
float (default: 90.) – Specifies the clipping circle radius to the specified angle in degrees.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
Continued on next page

3.1. BQPlot Package 25


bqplot Documentation, Release 0.10.0

Table 3.16 – continued from previous page


class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.3 Marks

Mark(**kwargs) The base mark class.


Lines(**kwargs) Lines mark.
FlexLine(**kwargs) Flexible Lines mark.
Scatter(**kwargs) Scatter mark.
Continued on next page

26 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.17 – continued from previous page


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.

bqplot.marks.Mark

class bqplot.marks.Mark(**kwargs)
The base mark class.
Traitlet mark attributes may be decorated with metadata.
Data Attribute Decoration
Data attributes are decorated with the following values:
scaled: bool Indicates whether the considered attribute is a data attribute which must be associated with a scale
in order to be taken into account.
rtype: string Range type of the associated scale.
atype: string Key in bqplot’s axis registry of the recommended axis type to represent this scale. When not
specified, the default is ‘bqplot.Axis’.
display_name
string – Holds a user-friendly name for the trait attribute.
mark_types
dict (class-level attribute) – A registry of existing mark types.
scales
Dict of scales (default: {}) – A dictionary of scales holding scales for each data attribute. - If a mark holds
a scaled attribute named ‘x’, the scales dictionary must have a corresponding scale for the key ‘x’. - The
scale’s range type should be equal to the scaled attribute’s range type (rtype).
scales_metadata
Dict (default: {}) – A dictionary of dictionaries holding metadata on the way scales are used by the mark.
For example, a linear scale may be used to count pixels horizontally or vertically. The content of this
dictionnary may change dynamically. It is an instance-level attribute.
preserve_domain
dict (default: {}) – Indicates if this mark affects the domain(s) of the specified scale(s). The keys of this
dictionary are the same as the ones of the “scales” attribute, and values are boolean. If a key is missing, it
is considered as False.
display_legend
bool (default: False) – Display toggle for the mark legend in the general figure legend
labels
list of unicode strings (default: []) – Labels of the items of the mark. This attribute has different meanings
depending on the type of mark.
apply_clip
bool (default: True) – Indicates whether the items that are beyond the limits of the chart should be clipped.

3.1. BQPlot Package 27


bqplot Documentation, Release 0.10.0

visible
bool (default: True) – Visibility toggle for the mark.
selected_style
dict (default: {}) – CSS style to be applied to selected items in the mark.
unselected_style
dict (default: {}) – CSS style to be applied to items that are not selected in the mark, when a selection
exists.
selected
list of integers or None (default: None) – Indices of the selected items in the mark.
tooltip
DOMWidget or None (default: None) – Widget to be displayed as tooltip when elements of the scatter are
hovered on
tooltip_style
Dictionary (default: {‘opacity’: 0.9}) – Styles to be applied to the tooltip widget
enable_hover
Bool (default: True) – Boolean attribute to control the hover interaction for the scatter. If this is false, the
on_hover custom mssg is not sent back to the python side
interactions
Dictionary (default: {‘hover’: ‘tooltip’}) – Dictionary listing the different interactions for each mark. The
key is the event which triggers the interaction and the value is the kind of interactions. Keys and values
can only take strings from separate enums for each mark.
tooltip_location
{‘mouse’, ‘center’} (default: ‘mouse’) – Enum specifying the location of the tooltip. ‘mouse’ places the
tooltip at the location of the mouse when the tooltip is activated and ‘center’ places the tooltip at the center
of the figure. If tooltip is linked to a click event, ‘mouse’ places the tooltip at the location of the click that
triggered the tooltip to be visible.
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
Continued on next page

28 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.18 – continued from previous page


has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Lines

class bqplot.marks.Lines(**kwargs)
Lines mark.
In the case of the Lines mark, scales for ‘x’ and ‘y’ MUST be provided.
icon
string (class-level attribute) – Font-awesome icon for the respective mark
name
string (class-level attribute) – User-friendly name of the mark
colors
list of colors (default: CATEGORY10) – List of colors of the Lines. If the list is shorter than the number
of lines, the colors are reused.

3.1. BQPlot Package 29


bqplot Documentation, Release 0.10.0

close_path
bool (default: False) – Whether to close the paths or not.
fill
{‘none’, ‘bottom’, ‘top’, ‘inside’} – Fill in the area defined by the curves
fill_colors
list of colors (default: []) – Fill colors for the areas. Defaults to stroke-colors when no color provided.
opacities
list of floats (default: []) – Opacity for the lines and patches. Defaults to 1 when the list is too short, or the
element of the list is set to None.
fill_opacities
list of floats (default: []) – Opacity for the areas. Defaults to 1 when the list is too short, or the element of
the list is set to None.
stroke_width
float (default: 2) – Stroke width of the Lines
labels_visibility
{‘none’, ‘label’} – Visibility of the curve labels
curves_subset
list of integers or None (default: []) – If set to None, all the lines are displayed. Otherwise, only the items
in the list will have full opacity, while others will be faded.
line_style
{‘solid’, ‘dashed’, ‘dotted’, ‘dash_dotted’} – Line style.
interpolation
{‘linear’, ‘basis’, ‘cardinal’, ‘monotone’} – Interpolation scheme used for interpolation between the data
points provided. Please refer to the svg interpolate documentation for details about the different interpola-
tion schemes.
marker
{‘circle’, ‘cross’, ‘diamond’, ‘square’, ‘triangle-down’, – ‘triangle-up’, ‘arrow’, ‘rectangle’, ‘ellipse’}
Marker shape
marker_size
nonnegative int (default: 64) – Default marker size in pixels
Data Attributes
x
numpy.ndarray (default: []) – abscissas of the data points (1d or 2d array)
y
numpy.ndarray (default: []) – ordinates of the data points (1d or 2d array)
color
numpy.ndarray (default: None) – colors of the different lines based on data. If it is [], then the colors from
the colors attribute are used. Each line has a single color and if the size of colors is less than the number
of lines, the remaining lines are given the default colors.

Notes

The fields which can be passed to the default tooltip are: name: label of the line index: index of the line
being hovered on color: data attribute for the color of the line

30 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

The following are the events which can trigger interactions: click: left click of the mouse hover: mouse-
over an element
The following are the interactions which can be linked to the above events: tooltip: display tooltip

__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
Continued on next page

3.1. BQPlot Package 31


bqplot Documentation, Release 0.10.0

Table 3.19 – continued from previous page


set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.FlexLine

class bqplot.marks.FlexLine(**kwargs)
Flexible Lines mark.
In the case of the FlexLines mark, scales for ‘x’ and ‘y’ MUST be provided. Scales for the color and width data
attributes are optional. In the case where another data attribute than ‘x’ or ‘y’ is provided but the corresponding
scale is missing, the data attribute is ignored.
name
string (class-level attributes) – user-friendly name of the mark
colors
list of colors (default: CATEGORY10) – List of colors for the Lines
stroke_width
float (default: 1.5) – Default stroke width of the Lines
Data Attributes
x
numpy.ndarray (default: []) – abscissas of the data points (1d array)
y
numpy.ndarray (default: []) – ordinates of the data points (1d array)
color
numpy.ndarray or None (default: None) – Array controlling the color of the data points
width
numpy.ndarray or None (default: None) – Array controlling the widths of the Lines.
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
Continued on next page

32 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.20 – continued from previous page


class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Scatter

class bqplot.marks.Scatter(**kwargs)
Scatter mark.
In the case of the Scatter mark, scales for ‘x’ and ‘y’ MUST be provided. The scales of other data attributes
are optional. In the case where another data attribute than ‘x’ or ‘y’ is provided but the corresponding scale is

3.1. BQPlot Package 33


bqplot Documentation, Release 0.10.0

missing, the data attribute is ignored.


icon
string (class-level attribute) – Font-awesome icon for that mark
name
string (class-level attribute) – User-friendly name of the mark
marker
{‘circle’, ‘cross’, ‘diamond’, ‘square’, ‘triangle-down’, – ‘triangle-up’, ‘arrow’, ‘rectangle’, ‘ellipse’}
Marker shape
colors
list of colors (default: [‘DeepSkyBlue’]) – List of colors of the markers. If the list is shorter than the
number of points, the colors are reused.
default_colors
Deprecated – Same as colors, deprecated as of version 0.8.4
stroke
Color or None (default: None) – Stroke color of the marker
stroke_width
Float (default: 1.5) – Stroke width of the marker
default_opacities
list of floats (default: [1.0]) – Default opacities of the markers. If the list is shorter than the number of
points, the opacities are reused.
default_skew
float (default: 0.5) – Default skew of the marker. This number is validated to be between 0 and 1.
default_size
nonnegative int (default: 64) – Default marker size in pixel. If size data is provided with a scale, de-
fault_size stands for the maximal marker size (i.e. the maximum value for the ‘size’ scale range)
drag_size
nonnegative float (default: 5.) – Ratio of the size of the dragged scatter size to the default scatter size.
names
numpy.ndarray (default: None) – Labels for the points of the chart
display_names
bool (default: True) – Controls whether names are displayed for points in the scatter
enable_move
bool (default: False) – Controls whether points can be moved by dragging. Refer to restrict_x, restrict_y
for more options.
restrict_x
bool (default: False) – Restricts movement of the point to only along the x axis. This is valid only when
enable_move is set to True. If both restrict_x and restrict_y are set to True, the point cannot be moved.
restrict_y
bool (default: False) – Restricts movement of the point to only along the y axis. This is valid only when
enable_move is set to True. If both restrict_x and restrict_y are set to True, the point cannot be moved.
Data Attributes
x: numpy.ndarray (default: []) abscissas of the data points (1d array)
y: numpy.ndarray (default: []) ordinates of the data points (1d array)

34 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

color: numpy.ndarray or None (default: None) color of the data points (1d array). Defaults to default_color
when not provided or when a value is NaN
opacity: numpy.ndarray or None (default: None) opacity of the data points (1d array). Defaults to de-
fault_opacity when not provided or when a value is NaN
size: numpy.ndarray or None (default: None) size of the data points. Defaults to default_size when not pro-
vided or when a value is NaN
skew: numpy.ndarray or None (default: None) skewness of the markers representing the data points. De-
faults to default_skew when not provided or when a value is NaN
rotation: numpy.ndarray or None (default: None) orientation of the markers representing the data points.
The rotation scale’s range is [0, 180] Defaults to 0 when not provided or when a value is NaN.

Notes

The fields which can be passed to the default tooltip are: All the data attributes index: index of the marker
being hovered on
The following are the events which can trigger interactions: click: left click of the mouse hover: mouse-
over an element
The following are the interactions which can be linked to the above events: tooltip: display tooltip add:
add new points to the scatter (can only linked to click)

__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
Continued on next page

3.1. BQPlot Package 35


bqplot Documentation, Release 0.10.0

Table 3.21 – continued from previous page


on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_drag(callback[, remove])
on_drag_end(callback[, remove])
on_drag_start(callback[, remove])
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Hist

class bqplot.marks.Hist(**kwargs)
Histogram mark.
In the case of the Hist mark, scales for ‘sample’ and ‘count’ MUST be provided.
icon
string (class-level attribute) – font-awesome icon for that mark
name
string (class-level attribute) – user-friendly name of the mark
bins
nonnegative int (default: 10) – number of bins in the histogram
normalized
bool (default: False) – Boolean attribute to return normalized values which sum to 1 or direct counts for
the count attribute. The scale of count attribute is determined by the value of this flag.
colors
list of colors (default: CATEGORY10) – List of colors of the Histogram. If the list is shorter than the
number of bins, the colors are reused.

36 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

stroke
Color or None (default: None) – Stroke color of the histogram
opacities
list of floats (default: []) – Opacity for the bins of the histogram. Defaults to 1 when the list is too short,
or the element of the list is set to None.
midpoints
list (default: []) – midpoints of the bins of the histogram. It is a read-only attribute.
Data Attributes
sample
numpy.ndarray (default: []) – sample of which the histogram must be computed.
count
numpy.ndarray (read-only) – number of sample points per bin. It is a read-only attribute.

Notes

The fields which can be passed to the default tooltip are: midpoint: mid-point of the bin related to the rect-
angle hovered on count: number of elements in the bin hovered on bin_start: start point of the bin bin-end:
end point of the bin index: index of the bin

__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
Continued on next page

3.1. BQPlot Package 37


bqplot Documentation, Release 0.10.0

Table 3.22 – continued from previous page


on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Bars

class bqplot.marks.Bars(**kwargs)
Bar mark.
In the case of the Bars mark, scales for ‘x’ and ‘y’ MUST be provided. The scales of other data attributes
are optional. In the case where another data attribute than ‘x’ or ‘y’ is provided but the corresponding scale is
missing, the data attribute is ignored.
icon
string (class-level attribute) – font-awesome icon for that mark
name
string (class-level attribute) – user-friendly name of the mark
color_mode
{‘auto’, ‘group’, ‘element’} – enum attribute to specify if color should be the same for all bars with the
same x or for all bars which belong to the same array in Y ‘group’ means for every x all bars have same
color. ‘element’ means for every dimension of y, all bars have same color. ‘auto’ picks ‘group’ and
‘element’ for 1-d and 2-d values of Y respectively.
type
{‘stacked’, ‘grouped’} – whether 2-dimensional bar charts should appear grouped or stacked.
colors
list of colors (default: CATEGORY10) – list of colors for the bars.

38 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

orientation
{‘horizontal’, ‘vertical’} – Specifies whether the bar chart is drawn horizontally or vertically. If a horizontal
bar chart is drawn, the x data is drawn vertically.
padding
float (default: 0.05) – attribute to control the spacing between the bars value is specified as a percentage
of the width of the bar
stroke
Color or None (default: None) – stroke color for the bars
opacities
list of floats (default: []) – Opacities for the bars. Defaults to 1 when the list is too short, or the element of
the list is set to None.
base
float (default: 0.0) – reference value from which the bars are drawn. defaults to 0.0
align
{‘center’, ‘left’, ‘right’} – alignment of bars with respect to the tick value
Data Attributes
x
numpy.ndarray (default: []) – abscissas of the data points (1d array)
y
numpy.ndarray (default: []) – ordinates of the values for the data points
color
numpy.ndarray or None (default: None) – color of the data points (1d array). Defaults to default_color
when not provided or when a value is NaN

Notes

The fields which can be passed to the default tooltip are: All the data attributes index: index of the bar being
hovered on sub_index: if data is two dimensional, this is the minor index

__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
Continued on next page

3.1. BQPlot Package 39


bqplot Documentation, Release 0.10.0

Table 3.23 – continued from previous page


get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Graph

class bqplot.marks.Graph(**kwargs)
Graph with nodes and links.
node_data
List – list of node attributes for the graph
link_matrix
numpy.ndarray of shape(len(nodes), len(nodes)) – link data passed as 2d matrix
link_data
List – list of link attributes for the graph

40 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

charge
int (default: -300) – charge of force layout. Will be ignored when x and y data attributes are set
link_distance
float (default: 100) – link distance in pixels between nodes. Will be ignored when x and y data attributes
are set
link_type
{‘arc’, ‘line’, ‘slant_line’} (default: ‘arc’) – Enum representing link type
directed
bool (default: True) – directed or undirected graph
highlight_links
bool (default: True) – highlights incoming and outgoing links when hovered on a node
colors
list (default: CATEGORY10) – list of node colors
Data Attributes
x
numpy.ndarray (default: []) – abscissas of the node data points (1d array)
y
numpy.ndarray (default: []) – ordinates of the node data points (1d array)
color
numpy.ndarray or None (default: None) – color of the node data points (1d array).
link_color
numpy.ndarray of shape(len(nodes), len(nodes)) – link data passed as 2d matrix
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
Continued on next page

3.1. BQPlot Package 41


bqplot Documentation, Release 0.10.0

Table 3.24 – continued from previous page


hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.GridHeatMap

class bqplot.marks.GridHeatMap(**kwargs)
GridHeatMap mark.
Alignment: The tiles can be aligned so that the data matches either the start, the end or the midpoints of the tiles.
This is controlled by the align attribute.
Suppose the data passed is a m-by-n matrix. If the scale for the rows is Ordinal, then alignment is by default the
mid points. For a non-ordinal scale, the data cannot be aligned to the mid points of the rectangles.
If it is not ordinal, then two cases arise. If the number of rows passed is m, then align attribute can be used. If
the number of rows passed is m+1, then the data are the boundaries of the m rectangles.
If rows and columns are not passed, and scales for them are also not passed, then ordinal scales are generated
for the rows and columns.
row_align
Enum([‘start’, ‘end’]) – This is only valid if the number of entries in row exactly match the number of
rows in color and the row_scale is not OrdinalScale. start aligns the row values passed to be aligned with
the start of the tiles and end aligns the row values to the end of the tiles.

42 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

column_align
Enum([‘start’, end’]) – This is only valid if the number of entries in column exactly match the number of
columns in color and the column_scale is not OrdinalScale. start aligns the column values passed to be
aligned with the start of the tiles and end aligns the column values to the end of the tiles.
anchor_style
dict (default: {‘fill’: ‘white’, ‘stroke’: ‘blue’}) – Controls the style for the element which serves as the
anchor during selection.
Data Attributes
color
numpy.ndarray or None (default: None) – color of the data points (2d array). The number of elements in
this array correspond to the number of cells created in the heatmap.
row
numpy.ndarray or None (default: None) – labels for the rows of the color array passed. The length of this
can be no more than 1 away from the number of rows in color. This is a scaled attribute and can be used to
affect the height of the cells as the entries of row can indicate the start or the end points of the cells. Refer
to the property row_align. If this property is None, then a uniformly spaced grid is generated in the row
direction.
column
numpy.ndarray or None (default: None) – labels for the columns of the color array passed. The length of
this can be no more than 1 away from the number of columns in color This is a scaled attribute and can
be used to affect the width of the cells as the entries of column can indicate the start or the end points of
the cells. Refer to the property column_align. If this property is None, then a uniformly spaced grid is
generated in the column direction.
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
Continued on next page

3.1. BQPlot Package 43


bqplot Documentation, Release 0.10.0

Table 3.25 – continued from previous page


notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.HeatMap

class bqplot.marks.HeatMap(**kwargs)
HeatMap mark.
Data Attributes
color
numpy.ndarray or None (default: None) – color of the data points (2d array).
x
numpy.ndarray or None (default: None) – labels for the columns of the color array passed. The length of
this has to be the number of columns in color. This is a scaled attribute.
y
numpy.ndarray or None (default: None) – labels for the rows of the color array passed. The length of this
has to be the number of rows in color. This is a scaled attribute.
__init__(**kwargs)

Methods

44 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1. BQPlot Package 45


bqplot Documentation, Release 0.10.0

bqplot.marks.Label

class bqplot.marks.Label(**kwargs)
Label mark.
x_offset
int (default: 0) – horizontal offset in pixels from the stated x location
y_offset
int (default: 0) – vertical offset in pixels from the stated y location
text
string (default: ‘’) – text to be displayed
default_size
string (default: ‘14px’) – font size in px, em or ex
font_weight
{‘bold’, ‘normal’, ‘bolder’} – font weight of the caption
drag_size
nonnegative float (default: 1.) – Ratio of the size of the dragged label font size to the default label font
size.
align
{‘start’, ‘middle’, ‘end’} – alignment of the text with respect to the provided location enable_move: Bool
(default: False) Enable the label to be moved by dragging. Refer to restrict_x, restrict_y for more options.
restrict_x
bool (default: False) – Restricts movement of the label to only along the x axis. This is valid only when
enable_move is set to True. If both restrict_x and restrict_y are set to True, the label cannot be moved.
restrict_y
bool (default: False) – Restricts movement of the label to only along the y axis. This is valid only when
enable_move is set to True. If both restrict_x and restrict_y are set to True, the label cannot be moved.
Data Attributes
x
numpy.ndarray (default: []) – horizontal position of the labels, in data coordinates or in figure coordinates
y
numpy.ndarray (default: []) – vertical position of the labels, in data coordinates or in figure coordinates
color
numpy.ndarray or None (default: None) – label colors
size
numpy.ndarray or None (default: None) – label sizes
rotation
numpy.ndarray or None (default: None) – label rotations
opacity
numpy.ndarray or None (default: None) – label opacities
__init__(**kwargs)

Methods

46 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_drag(callback[, remove])
on_drag_end(callback[, remove])
on_drag_start(callback[, remove])
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
Continued on next page

3.1. BQPlot Package 47


bqplot Documentation, Release 0.10.0

Table 3.27 – continued from previous page


unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.OHLC

class bqplot.marks.OHLC(**kwargs)
Open/High/Low/Close marks.
icon
string (class-level attribute) – font-awesome icon for that mark
name
string (class-level attribute) – user-friendly name of the mark
marker
{‘candle’, ‘bar’} – marker type
stroke
color (default: None) – stroke color of the marker
stroke_width
float (default: 1.0) – stroke width of the marker
colors
List of colors (default: [‘limegreen’, ‘red’]) – fill colors for the markers (up/down)
opacities
list of floats (default: []) – Opacities for the markers of the OHLC mark. Defaults to 1 when the list is too
short, or the element of the list is set to None.
format
string (default: ‘ohlc’) – description of y data being passed supports all permutations of the strings ‘ohlc’,
‘oc’, and ‘hl’
Data Attributes
x
numpy.ndarray – abscissas of the data points (1d array)
y
numpy.ndarrays – Open/High/Low/Close ordinates of the data points (2d array)

Notes

The fields which can be passed to the default tooltip are: x: the x value associated with the bar/candle open:
open value for the bar/candle high: high value for the bar/candle low: low value for the bar/candle close:
close value for the bar/candle index: index of the bar/candle being hovered on

__init__(**kwargs)

Methods

__init__(**kwargs)
Continued on next page

48 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.28 – continued from previous page


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1. BQPlot Package 49


bqplot Documentation, Release 0.10.0

bqplot.marks.Pie

class bqplot.marks.Pie(**kwargs)
Piechart mark.
colors
list of colors (default: CATEGORY10) – list of colors for the slices.
stroke
color (default: ‘white’) – stroke color for the marker
opacities
list of floats (default: []) – Opacities for the slices of the Pie mark. Defaults to 1 when the list is too short,
or the element of the list is set to None.
sort
bool (default: False) – sort the pie slices by descending sizes
x
Float (default: 0.5) or Date – horizontal position of the pie center, in data coordinates or in figure coordi-
nates
y
Float (default: 0.5) – vertical y position of the pie center, in data coordinates or in figure coordinates
radius
Float – radius of the pie, in pixels
inner_radius
Float – inner radius of the pie, in pixels
start_angle
Float (default: 0.0) – start angle of the pie (from top), in degrees
end_angle
Float (default: 360.0) – end angle of the pie (from top), in degrees
display_labels
{‘none’, ‘inside’, ‘outside’} (default: ‘inside’) – label display options
display_values
bool (default: False) – if True show values along with labels
values_format
string (default: ‘.2f’) – format for displaying values
label_color
Color or None (default: None) – color of the labels
font_size
string (default: ‘14px’) – label font size in px, em or ex
font_weight
{‘bold’, ‘normal’, ‘bolder’} (default: ‘normal’) – label font weight
Data Attributes
sizes
numpy.ndarray (default: []) – proportions of the pie slices
color
numpy.ndarray or None (default: None) – color of the data points. Defaults to colors when not provided.

50 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Notes

The fields which can be passed to the default tooltip are: : the x value associated with the bar/candle open:
open value for the bar/candle high: high value for the bar/candle low: low value for the bar/candle close:
close value for the bar/candle index: index of the bar/candle being hovered on

__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
Continued on next page

3.1. BQPlot Package 51


bqplot Documentation, Release 0.10.0

Table 3.29 – continued from previous page


set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.marks.Map

class bqplot.marks.Map(**kwargs)
Map mark.
colors
Dict (default: {}) – default colors for items of the map when no color data is passed. The dictionary should
be indexed by the id of the element and have the corresponding colors as values. The key default_color
controls the items for which no color is specified.
selected_styles
Dict (default: {‘selected_fill’: ‘Red’, ‘selected_stroke’: None, ‘selected_stroke_width’: 2.0}) – Dictionary
containing the styles for selected subunits
hovered_styles
Dict (default: {‘hovered_fill’: ‘Orange’, ‘hovered_stroke’: None, ‘hovered_stroke_width’: 2.0}) – Dictio-
nary containing the styles for hovered subunits
selected
List (default: []) – list containing the selected countries in the map
hover_highlight
bool (default: True) – boolean to control if the map should be aware of which country is being hovered on.
map_data
tuple (default: topoload(“WorldMapData.json”)) – tuple containing which map is to be displayed
Data Attributes
color
Dict or None (default: None) – dictionary containing the data associated with every country for the color
scale
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
Continued on next page

52 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.30 – continued from previous page


class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_background_click(callback[, remove])
on_click(callback[, remove])
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_element_click(callback[, remove])
on_hover(callback[, remove])
on_legend_click(callback[, remove])
on_legend_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.4 Axes

3.1. BQPlot Package 53


bqplot Documentation, Release 0.10.0

Axis(**kwargs) A line axis.


ColorAxis(**kwargs) A colorbar axis.

bqplot.axes.Axis

class bqplot.axes.Axis(**kwargs)
A line axis.
A line axis is the visual representation of a numerical or date scale.
icon
string (class-level attribute) – The font-awesome icon name for this object.
axis_types
dict (class-level attribute) – A registry of existing axis types.
orientation
{‘horizontal’, ‘vertical’} – The orientation of the axis, either vertical or horizontal
side
{‘bottom’, ‘top’, ‘left’, ‘right’} or None (default: None) – The side of the axis, either bottom, top, left or
right.
label
string (default: ‘’) – The axis label
tick_format
string or None (default: ‘’) – The tick format for the axis, for dates use d3 string formatting.
scale
Scale – The scale represented by the axis
num_ticks
int or None (default: None) – If tick_values is None, number of ticks
tick_values
numpy.ndarray or None (default: None) – Tick values for the axis
offset
dict (default: {}) – Contains a scale and a value {‘scale’: scale or None, ‘value’: value of the offset} If
offset[‘scale’] is None, the corresponding figure scale is used instead.
label_location
{‘middle’, ‘start’, ‘end’} – The location of the label along the axis, one of ‘start’, ‘end’ or ‘middle’
label_color
Color or None (default: None) – The color of the axis label
grid_lines
{‘none’, ‘solid’, ‘dashed’} – The display of the grid lines
grid_color
Color or None (default: None) – The color of the grid lines
color
Color or None (default: None) – The color of the line
label_offset
string or None (default: None) – Label displacement from the axis line. Units allowed are ‘em’, ‘px’ and
‘ex’. Positive values are away from the figure and negative values are towards the figure with resepect to
the axis line.

54 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

visible
bool (default: True) – A visibility toggle for the axis
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
Continued on next page

3.1. BQPlot Package 55


bqplot Documentation, Release 0.10.0

Table 3.32 – continued from previous page


unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.axes.ColorAxis

class bqplot.axes.ColorAxis(**kwargs)
A colorbar axis.
A color axis is the visual representation of a color scale.
scale
ColorScale – The scale represented by the axis
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
Continued on next page

56 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.33 – continued from previous page


send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.5 Market Map

MarketMap(**kwargs) Waffle wrapped map.


SquareMarketMap(**kwargs)

bqplot.market_map.MarketMap

class bqplot.market_map.MarketMap(**kwargs)
Waffle wrapped map.
names
numpy.ndarray of strings (default: []) – The elements can also be objects convertible to string primary key
for the map data. A rectangle is created for each unique entry in this array
groups
numpy.ndarray (default: []) – attribute on which the groupby is run. If this is an empty arrray, then there
is no group by for the map.
display_text
numpy.ndarray or None(default: None) – data to be displayed on each rectangle of the map.If this is empty
it defaults to the names attribute.
ref_data
pandas.DataDrame or None (default: None) – Additional data associated with each element of the map.
The data in this data frame can be displayed as a tooltip.
color
numpy.ndarray (default: []) – Data to represent the color for each of the cells. If the value of the data is
NaN for a cell, then the color of the cell is the color of the group it belongs to in absence of data for color
scales
Dictionary of scales holding a scale for each data attribute – If the map has data being passed as color,
then a corresponding color scale is required
axes
List of axes – Ability to add an axis for the scales which are used to scale data represented in the map
on_hover
custom event – This event is received when the mouse is hovering over a cell. Returns the data of the cell
and the ref_data associated with the cell.

3.1. BQPlot Package 57


bqplot Documentation, Release 0.10.0

tooltip_widget
Instance of a widget – Widget to be displayed as the tooltip. This can be combined with the on_hover
event to display the chart corresponding to the cell being hovered on.
tooltip_fields
list – names of the fields from the ref_data dataframe which should be displayed in the tooltip.
tooltip_formats
list – formats for each of the fields for the tooltip data. Order should match the order of the tooltip_fields
show_groups
bool – attribute to determine if the groups should be displayed. If set to True, the finer elements are blurred
Map Drawing Attributes
cols
int – Suggestion for no of columns in the map.If not specified, value is inferred from the no of rows and
no of cells
rows
int – No of rows in the map.If not specified, value is inferred from the no of cells and no of columns. If
both rows and columns are not specified, then a square is constructed basing on the no of cells. The above
two attributes are suggestions which are respected unless they are not feasible. One required condition is
that, the number of columns is odd when row_groups is greater than 1.
row_groups
int – No of groups the rows should be divided into. This can be used to draw more square cells for each of
the groups
Layout Attributes
map_margin
dict (default: {top=50, bottom=50, left=50, right=50}) – Dictionary containing the top, bottom, left and
right margins. The user is responsible for making sure that the width and height are greater than the sum
of the margins.
min_aspect_ratio
float – minimum width / height ratio of the figure
max_aspect_ratio
float – maximum width / height ratio of the figure
Display Attributes
colors: list of colors Colors for each of the groups which are cycled over to cover all the groups
title: string Title of the Market Map
title_style: dict CSS style for the title of the Market Map
stroke: color Stroke of each of the cells of the market map
group_stroke: color Stroke of the border for the group of cells corresponding to a group
selected_stroke: color stroke for the selected cells
hovered_stroke: color stroke for the cell being hovered on
font_style: dict CSS style for the text of each cell
Other Attributes
enable_select: bool boolean to control the ability to select the cells of the map by clicking

58 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

enable_hover: bool boolean to control if the map should be aware of which cell is being hovered on. If it is set
to False, tooltip will not be displayed

Note: The aspect ratios stand for width / height ratios.


• If the available space is within bounds in terms of min and max aspect ratio, we use the entire available
space.
• If the available space is too oblong horizontally, we use the client height and the width that corresponds
max_aspect_ratio (maximize width under the constraints).
• If the available space is too oblong vertically, we use the client width and the height that corresponds to
min_aspect_ratio (maximize height under the constraint). This corresponds to maximizing the area under
the constraints.
Default min and max aspect ratio are both equal to 16 / 9.

__init__(**kwargs)

Methods

__init__(**kwargs)
add_class(className) Adds a class to the top level element of the widget.
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
Continued on next page

3.1. BQPlot Package 59


bqplot Documentation, Release 0.10.0

Table 3.35 – continued from previous page


on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
remove_class(className) Removes a class from the top level element of the wid-
get.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.market_map.SquareMarketMap

class bqplot.market_map.SquareMarketMap(**kwargs)

__init__(**kwargs)

Methods

__init__(**kwargs)
add_class(className) Adds a class to the top level element of the widget.
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
Continued on next page

60 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.36 – continued from previous page


hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_hover(callback[, remove])
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
remove_class(className) Removes a class from the top level element of the wid-
get.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.6 Interacts

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.

bqplot.interacts.BrushIntervalSelector

class bqplot.interacts.BrushIntervalSelector(**kwargs)
Brush interval selector interaction.
This 1-D selector interaction enables the user to select an interval using the brushing action of the mouse. A
mouse-down marks the start of the interval. The drag after the mouse down in the x-direction selects the extent

3.1. BQPlot Package 61


bqplot Documentation, Release 0.10.0

and a mouse-up signifies the end of the interval.


Once an interval is drawn, the selector can be moved to a new interval by dragging the selector to the new
interval.
A double click at the same point without moving the mouse in the x-direction will result in the entire interval
being selected.
selected
numpy.ndarray – Two element array containing the start and end of the interval selected in terms
of the scale of the selector. This attribute changes while the selection is being made with the
BrushIntervalSelector.
brushing
bool – Boolean attribute to indicate if the selector is being dragged. It is True when the selector is being
moved and False when it is not. This attribute can be used to trigger computationally intensive code which
should be run only on the interval selection being completed as opposed to code which should be run
whenever selected is changing.
color
Color or None (default: None) – Color of the rectangle representing the brush selector.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
Continued on next page

62 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.38 – continued from previous page


on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.BrushSelector

class bqplot.interacts.BrushSelector(**kwargs)
Brush interval selector interaction.
This 2-D selector interaction enables the user to select a rectangular region using the brushing action of the
mouse. A mouse-down marks the starting point of the interval. The drag after the mouse down selects the
rectangle of interest and a mouse-up signifies the end point of the interval.
Once an interval is drawn, the selector can be moved to a new interval by dragging the selector to the new
interval.
A double click at the same point without moving the mouse will result in the entire interval being selected.
selected
numpy.ndarray – Two element array containing the start and end of the interval selected in terms
of the scales of the selector. This attribute changes while the selection is being made with the
BrushIntervalSelector.
brushing
bool (default: False) – boolean attribute to indicate if the selector is being dragged. It is True when the
selector is being moved and False when it is not. This attribute can be used to trigger computationally
intensive code which should be run only on the interval selection being completed as opposed to code
which should be run whenever selected is changing.
color
Color or None (default: None) – Color of the rectangle representing the brush selector.
__init__(**kwargs)

Methods

__init__(**kwargs)
Continued on next page

3.1. BQPlot Package 63


bqplot Documentation, Release 0.10.0

Table 3.39 – continued from previous page


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.HandDraw

class bqplot.interacts.HandDraw(**kwargs)
A hand-draw interaction.
This can be used to edit the ‘y’ value of an existing line using the mouse. The minimum and maximum x values

64 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

of the line which can be edited may be passed as parameters. The y-values for any part of the line can be edited
by drawing the desired path while holding the mouse-down. y-values corresponding to x-values smaller than
min_x or greater than max_x cannot be edited by HandDraw.
lines
an instance Lines mark or None (default: None) – The instance of Lines which is edited using the hand-
draw interaction. The ‘y’ values of the line are changed according to the path of the mouse. If the lines
has multi dimensional ‘y’, then the ‘line_index’ attribute is used to selected the ‘y’ to be edited.
line_index
nonnegative integer (default: 0) – For a line with multi-dimensional ‘y’, this indicates the index of the ‘y’
to be edited by the handdraw.
min_x
float or Date or None (default: None) – The minimum value of ‘x’ which should be edited via the hand-
draw.
max_x
float or Date or None (default: None) – The maximum value of ‘x’ which should be edited via the hand-
draw.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
Continued on next page

3.1. BQPlot Package 65


bqplot Documentation, Release 0.10.0

Table 3.40 – continued from previous page


on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.IndexSelector

class bqplot.interacts.IndexSelector(**kwargs)
Index selector interaction.
This 1-D selector interaction uses the mouse x-cooridnate to select the corresponding point in terms of the
selector scale.
Index Selector has two modes:
1. default mode: The mouse controls the x-position of the selector.
2. frozen mode: In this mode, the selector is frozen at a point and does not respond to mouse
events.
A single click switches between the two modes.
selected
numpy.ndarray – A single element array containing the point corresponding the x-position of the mouse.
This attribute is updated as you move the mouse along the x-direction on the figure.
color
Color or None (default: None) – Color of the line representing the index selector.
line_width
nonnegative integer (default: 0) – Width of the line represetning the index selector.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
Continued on next page

66 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.41 – continued from previous page


class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.FastIntervalSelector

class bqplot.interacts.FastIntervalSelector(**kwargs)
Fast interval selector interaction.
This 1-D selector is used to select an interval on the x-scale by just moving the mouse (without clicking or
dragging). The x-coordinate of the mouse controls the mid point of the interval selected while the y-coordinate

3.1. BQPlot Package 67


bqplot Documentation, Release 0.10.0

of the mouse controls the the width of the interval. The larger the y-coordinate, the wider the interval selected.
Interval selector has three modes:
1. default mode: This is the default mode in which the mouse controls the location and width of the
interval.
2. fixed-width mode: In this mode the width of the interval is frozen and only the location of the in-
terval is controlled with the mouse. A single click from the default mode takes you to this mode.
Another single click takes you back to the default mode.
3. frozen mode: In this mode the selected interval is frozen and the selector does not respond to
mouse move. A double click from the default mode takes you to this mode. Another double
click takes you back to the default mode.
selected
numpy.ndarray – Two-element array containing the start and end of the interval selected in terms of the
scale of the selector.
color
Color or None (default: None) – color of the rectangle representing the interval selector
size
Float or None (default: None) – if not None, this is the fixed pixel-width of the interval selector
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
Continued on next page

68 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.42 – continued from previous page


on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.MultiSelector

class bqplot.interacts.MultiSelector(**kwargs)
Multi selector interaction.
This 1-D selector interaction enables the user to select multiple intervals using the mouse. A mouse-down marks
the start of the interval. The drag after the mouse down in the x-direction selects the extent and a mouse-up
signifies the end of the interval.
The current selector is highlighted with a green border and the inactive selectors are highlighted with a red
border.
The multi selector has three modes:
1. default mode: In this mode the interaction behaves exactly as the brush selector interaction with
the current selector.
2. add mode: In this mode a new selector can be added by clicking at a point and dragging over the
interval of interest. Once a new selector has been added, the multi selector is back in the default
mode. From the default mode, ctrl+click switches to the add mode.
3. choose mode: In this mode, any of the existing inactive selectors can be set as the active selector.
When an inactive selector is selected by clicking, the multi selector goes back to the default mode.
From the default mode, shift+click switches to the choose mode.
A double click at the same point without moving the mouse in the x-direction will result in the entire interval
being selected for the current selector.
selected
dict – A dictionary with keys being the names of the intervals and values being the two element arrays
containing the start and end of the interval selected by that particular selector in terms of the scale of the
selector. This is a read-only attribute. This attribute changes while the selection is being made with the
MultiSelectorinteraction.

3.1. BQPlot Package 69


bqplot Documentation, Release 0.10.0

brushing
bool (default: False) – A boolean attribute to indicate if the selector is being dragged. It is True when
the selector is being moved and false when it is not. This attribute can be used to trigger computationally
intensive code which should be run only on the interval selection being completed as opposed to code
which should be run whenever selected is changing.
names
list – A list of strings indicating the keys of the different intervals. Default values are ‘int1’, ‘int2’, ‘int3’
and so on.
show_names
bool (default: True) – Attribute to indicate if the names of the intervals are to be displayed along with the
interval.
__init__(**kwargs)

Methods

__init__(**kwargs)
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hidden_selected_changed(name, selected)
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
Continued on next page

70 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.43 – continued from previous page


send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.OneDSelector

class bqplot.interacts.OneDSelector(**kwargs)
One-dimensional selector interaction
Base class for all selectors which select data in one dimension, i.e., either the x or the y direction. The scale
attribute should be provided.
scale
An instance of Scale – This is the scale which is used for inversion from the pixels to data co-ordinates.
This scale is used for setting the selected attribute for the selector.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
Continued on next page

3.1. BQPlot Package 71


bqplot Documentation, Release 0.10.0

Table 3.44 – continued from previous page


hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.Interaction

class bqplot.interacts.Interaction(**kwargs)
The base interaction class.
An interaction is a mouse interaction layer for a figure that requires the capture of all mouse events on the plot
area. A consequence is that one can allow only one interaction at any time on a figure.
An interaction can be associated with features such as selection or manual change of specific mark. Although,
they differ from the so called ‘mark interactions’ in that they do not rely on knowing whether a specific element
of the mark are hovered by the mouse.
types
dict (class-level attribute) representing interaction types – A registry of existing interaction types.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
Continued on next page

72 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.45 – continued from previous page


class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.PanZoom

class bqplot.interacts.PanZoom(**kwargs)
An interaction to pan and zoom wrt scales.
allow_pan
bool (default: True) – Toggle the ability to pan.
allow_zoom

3.1. BQPlot Package 73


bqplot Documentation, Release 0.10.0

bool (default: True) – Toggle the ability to zoom.


scales
Dictionary of lists of Scales (default: {}) – Dictionary with keys such as ‘x’ and ‘y’ and values being the
scales in the corresponding direction (dimensions) which should be panned or zoomed.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
Continued on next page

74 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.46 – continued from previous page


trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.Selector

class bqplot.interacts.Selector(**kwargs)
Selector interaction. A selector can be used to select a subset of data
Base class for all the selectors.
marks
list (default: []) – list of marks for which the selected attribute is updated based on the data selected by the
selector.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
Continued on next page

3.1. BQPlot Package 75


bqplot Documentation, Release 0.10.0

Table 3.47 – continued from previous page


open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

bqplot.interacts.TwoDSelector

class bqplot.interacts.TwoDSelector(**kwargs)
Two-dimensional selector interaction.
Base class for all selectors which select data in both the x and y dimensions. The attributes ‘x_scale’ and
‘y_scale’ should be provided.
x_scale
An instance of Scale – This is the scale which is used for inversion from the pixels to data co-ordinates in
the x-direction. This scale is used for setting the selected attribute for the selector along with y_scale.
y_scale
An instance of Scale – This is the scale which is used for inversion from the pixels to data co-ordinates in
the y-direction. This scale is used for setting the selected attribute for the selector along with x_scale.
__init__(**kwargs)
Public constructor

Methods

__init__(**kwargs) Public constructor


add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
Continued on next page

76 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Table 3.48 – continued from previous page


get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
reset()
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1.7 Traits Types

Date([default_value]) A datetime trait type.

bqplot.traits.Date

class bqplot.traits.Date(default_value=datetime.datetime(2017, 11, 7, 20, 54, 59, 302013),


**kwargs)
A datetime trait type.
Converts the passed date into a string format that can be used to construct a JavaScript datetime.
__init__(default_value=datetime.datetime(2017, 11, 7, 20, 54, 59, 302013), **kwargs)

3.1. BQPlot Package 77


bqplot Documentation, Release 0.10.0

Methods

__init__([default_value])
class_init(cls, name) Part of the initialization which may depend on the un-
derlying HasDescriptors class.
default_value_repr()
error(obj, value)
get(obj[, cls])
get_default_value() DEPRECATED: Retrieve the static default value for this
trait.
get_metadata(key[, default]) DEPRECATED: Get a metadata value.
info()
init_default_value(obj) DEPRECATED: Set the static default value for the trait
type.
instance_init(obj)
set(obj, value)
set_metadata(key, value) DEPRECATED: Set a metadata key/value.
tag(**metadata) Sets metadata and returns self.
validate(obj, value)

3.1.8 Toolbar

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

bqplot.toolbar.Toolbar

class bqplot.toolbar.Toolbar(**kwargs)
Default toolbar for bqplot figures.
The default toolbar provides three buttons:
• A Panzoom toggle button which enables panning and zooming the figure.
• A Save button to save the figure as a png image.
• A Reset button, which resets the figure position to its original state.
When the Panzoom button is toggled to True for the first time, a new instance of PanZoom widget is created.
The created PanZoom widget uses the scales of all the marks that are on the figure at this point. When the
PanZoom widget is toggled to False, the figure retrieves its previous interaction. When the Reset button is
pressed, the PanZoom widget is deleted and the figure scales reset to their initial state. We are back to the case
where the PanZoom widget has never been set.
If new marks are added to the figure after the panzoom button is toggled, and these use new scales, those scales
will not be panned or zoomed, unless the reset button is clicked.
figure
instance of Figure – The figure to which the toolbar will apply.
__init__(**kwargs)
Public constructor

78 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

Methods

__init__(**kwargs) Public constructor


add_class(className) Adds a class to the top level element of the widget.
add_traits(**traits) Dynamically add trait attributes to the Widget.
class_own_trait_events(name) Get a dict of all event handlers defined on this class, not
a parent.
class_own_traits(**metadata) Get a dict of all the traitlets defined on this class, not a
parent.
class_trait_names(**metadata) Get a list of all the names of this class’ traits.
class_traits(**metadata) Get a dict of all the traits of this class.
close() Close method.
close_all()
get_manager_state([drop_defaults, widgets]) Returns the full state for a widget manager for embed-
ding
get_state([key, drop_defaults]) Gets the widget state, or a piece of it.
get_view_spec()
handle_comm_opened(comm, msg) Static method, called when a widget is constructed.
has_trait(name) Returns True if the object has a trait with the specified
name.
hold_sync() Hold syncing any state until the outermost context man-
ager exits
hold_trait_notifications() Context manager for bundling trait change notifications
and cross validation.
notify_change(change) Called when a property has changed.
observe(handler[, names, type]) Setup a handler to be called when a trait changes.
on_displayed(callback[, remove]) (Un)Register a widget displayed callback.
on_msg(callback[, remove]) (Un)Register a custom msg receive callback.
on_trait_change([handler, name, remove]) DEPRECATED: Setup a handler to be called when a
trait changes.
on_widget_constructed(callback) Registers a callback to be called when a widget is con-
structed.
open() Open a comm to the frontend if one isn’t already open.
remove_class(className) Removes a class from the top level element of the wid-
get.
send(content[, buffers]) Sends a custom msg to the widget model in the front-
end.
send_state([key]) Sends the widget state, or a piece of it, to the front-end,
if it exists.
set_state(sync_data) Called when a state is received from the front-end.
set_trait(name, value) Forcibly sets trait attribute, including read-only at-
tributes.
setup_instance(*args, **kwargs)
trait_events([name]) Get a dict of all the event handlers of this class.
trait_metadata(traitname, key[, default]) Get metadata values for trait by key.
trait_names(**metadata) Get a list of all the names of this class’ traits.
traits(**metadata) Get a dict of all the traits of this class.
unobserve(handler[, names, type]) Remove a trait change handler.
unobserve_all([name]) Remove trait change handlers of any type for the speci-
fied name.

3.1. BQPlot Package 79


bqplot Documentation, Release 0.10.0

3.1.9 Pyplot

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 fig-
ure.
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.

bqplot.pyplot.figure

bqplot.pyplot.figure(key=None, fig=None, **kwargs)


Creates figures and switches between figures.
If a bqplot.Figure object is provided via the fig optional argument, this figure becomes the current context
figure.
Otherwise:
• If no key is provided, a new empty context figure is created.
• If a key is provided for which a context already exists, the corresponding context becomes current.
• If a key is provided and no corresponding context exists, a new context is reated for that key and becomes
current.
Besides, optional arguments allow to set or modify Attributes of the selected context figure.
Parameters
• key (hashable, optional) – Any variable that can be used as a key for a dictionary
• fig (Figure, optional) – A bqplot Figure

bqplot.pyplot.show

bqplot.pyplot.show(key=None, display_toolbar=True)
Shows the current context figure in the output area.
Parameters

80 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

• key (hashable, optional) – Any variable that can be used as a key for a dictionary.
• display_toolbar (bool (default: True)) – If True, a toolbar for different
mouse interaction is displayed with the figure.
Raises KeyError – When no context figure is associated with the provided key.

Examples

>>> import numpy as np


>>> import pyplot as plt
>>> n = 100
>>> x = np.arange(n)
>>> y = np.cumsum(np.random.randn(n))
>>> plt.plot(x,y)
>>> plt.show()

bqplot.pyplot.axes

bqplot.pyplot.axes(mark=None, options={}, **kwargs)


Draws axes corresponding to the scales of a given mark.
It also returns a dictionary of drawn axes. If the mark is not provided, the last drawn mark is used.
Parameters
• mark (Mark or None (default: None)) – The mark to inspect to create axes. If
None, the last mark drawn is used instead.
• options (dict (default: {})) – Options for the axes to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding axis type.

bqplot.pyplot.plot

bqplot.pyplot.plot(*args, **kwargs)
Draw lines in the current context figure.
Signature: plot(x, y, **kwargs) or plot(y, **kwargs), depending of the length of the list of positional arguments.
In the case where the x array is not provided.
Parameters
• x (numpy.ndarray or list, 1d or 2d (optional)) – The x-coordinates of
the plotted line. When not provided, the function defaults to numpy.arange(len(y)) x can be
1-dimensional or 2-dimensional.
• y (numpy.ndarray or list, 1d or 2d) – The y-coordinates of the plotted line.
If argument x is 2-dimensional it must also be 2-dimensional.
• marker_str (string) – string representing line_style, marker and color. For e.g. ‘g–o’,
‘sr’ etc
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding scale type.

3.1. BQPlot Package 81


bqplot Documentation, Release 0.10.0

• axes_options (dict (default: {})) – Options for the axes to be created. If


an axis labeled ‘x’ is required for that mark, axes_options[‘x’] contains optional keyword
arguments for the constructor of the corresponding axis type.
• figure (Figure or None) – The figure to which the line is to be added. If the value
is None, the current figure is used.

bqplot.pyplot.scatter

bqplot.pyplot.scatter(x, y, **kwargs)
Draw a scatter in the current context figure.
Parameters
• x (numpy.ndarray, 1d) – The x-coordinates of the data points.
• y (numpy.ndarray, 1d) – The y-coordinates of the data points.
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding scale type.
• axes_options (dict (default: {})) – Options for the axes to be created. If
an axis labeled ‘x’ is required for that mark, axes_options[‘x’] contains optional keyword
arguments for the constructor of the corresponding axis type.

bqplot.pyplot.hist

bqplot.pyplot.hist(sample, options={}, **kwargs)


Draw a histogram in the current context figure.
Parameters
• sample (numpy.ndarray, 1d) – The sample for which the histogram must be gener-
ated.
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘counts’ is required for that mark, options[‘counts’] contains optional keyword ar-
guments for the constructor of the corresponding scale type.
• axes_options (dict (default: {})) – Options for the axes to be created. If
an axis labeled ‘counts’ is required for that mark, axes_options[‘counts’] contains optional
keyword arguments for the constructor of the corresponding axis type.

bqplot.pyplot.bar

bqplot.pyplot.bar(x, y, **kwargs)
Draws a bar chart in the current context figure.
Parameters
• x (numpy.ndarray, 1d) – The x-coordinates of the data points.
• y (numpy.ndarray, 1d) – The y-coordinates of the data pints.
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding scale type.

82 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

• axes_options (dict (default: {})) – Options for the axes to be created. If


an axis labeled ‘x’ is required for that mark, axes_options[‘x’] contains optional keyword
arguments for the constructor of the corresponding axis type.

bqplot.pyplot.ohlc

bqplot.pyplot.ohlc(*args, **kwargs)
Draw OHLC bars or candle bars in the current context figure.
Signature: ohlc(x, y, **kwargs) or ohlc(y, **kwargs), depending of the length of the list of positional arguments.
In the case where the x array is not provided
Parameters
• x (numpy.ndarray or list, 1d (optional)) – The x-coordinates of the plot-
ted line. When not provided, the function defaults to numpy.arange(len(y)).
• y (numpy.ndarray or list, 2d) – The ohlc (open/high/low/close) information. A
two dimensional array. y must have the shape (n, 4).
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding scale type.
• axes_options (dict (default: {})) – Options for the axes to be created. If
an axis labeled ‘x’ is required for that mark, axes_options[‘x’] contains optional keyword
arguments for the constructor of the corresponding axis type.

bqplot.pyplot.geo

bqplot.pyplot.geo(map_data, **kwargs)
Draw a map in the current context figure.
Parameters
• map_data (string or bqplot.map (default: WorldMap)) – Name of the
map or json file required for the map data.
• options (dict (default: {})) – Options for the scales to be created. If a scale
labeled ‘x’ is required for that mark, options[‘x’] contains optional keyword arguments for
the constructor of the corresponding scale type.
• axes_options (dict (default: {})) – Options for the axes to be created. If
an axis labeled ‘x’ is required for that mark, axes_options[‘x’] contains optional keyword
arguments for the constructor of the corresponding axis type.

bqplot.pyplot.clear

bqplot.pyplot.clear()
Clears the current context figure of all marks axes and grid lines.

bqplot.pyplot.close

bqplot.pyplot.close(key)
Closes and unregister the context figure corresponding to the key.
Parameters key (hashable) – Any variable that can be used as a key for a dictionary

3.1. BQPlot Package 83


bqplot Documentation, Release 0.10.0

bqplot.pyplot.current_figure

bqplot.pyplot.current_figure()
Returns the current context figure.

bqplot.pyplot.scales

bqplot.pyplot.scales(key=None, scales={})
Creates and switches between context scales.
If no key is provided, a new blank context is created.
If a key is provided for which a context already exists, the existing context is set as the current context.
If a key is provided and no corresponding context exists, a new context is created for that key and set as the
current context.
Parameters
• key (hashable, optional) – Any variable that can be used as a key for a dictionary
• scales (dictionary) – Dictionary of scales to be used in the new context

Example

>>> scales(scales={
>>> 'x': Keep,
>>> 'color': ColorScale(min=0, max=1)
>>> })

This creates a new scales context, where the ‘x’ scale is kept from the previous context, the ‘color’ scale is an
instance of ColorScale provided by the user. Other scales, potentially needed such as the ‘y’ scale in the case of
a line chart will be created on the fly when needed.

Notes

Every call to the function figure triggers a call to scales.


The scales parameter is ignored if the key argument is not Keep and context scales already exist for that key.

bqplot.pyplot.xlim

bqplot.pyplot.xlim(min, max)
Set the domain bounds of the current ‘x’ scale.

bqplot.pyplot.ylim

bqplot.pyplot.ylim(min, max)
Set the domain bounds of the current ‘y’ scale.

84 Chapter 3. API Reference Documentation


bqplot Documentation, Release 0.10.0

bqplot.pyplot.xlabel

bqplot.pyplot.xlabel(label=None, mark=None, **kwargs)


Sets the value of label for an axis whose associated scale has the dimension x.
Parameters label (Unicode or None (default: None)) – The label for x axis

bqplot.pyplot.ylabel

bqplot.pyplot.ylabel(label=None, mark=None, **kwargs)


Sets the value of label for an axis whose associated scale has the dimension y.
Parameters label (Unicode or None (default: None)) – The label for y axis

3.1. BQPlot Package 85


bqplot Documentation, Release 0.10.0

86 Chapter 3. API Reference Documentation


Python Module Index

b
bqplot, 5
bqplot.axes, 53
bqplot.figure, 5
bqplot.interacts, 61
bqplot.market_map, 57
bqplot.marks, 26
bqplot.pyplot, 80
bqplot.scales, 8
bqplot.toolbar, 78
bqplot.traits, 77

87
bqplot Documentation, Release 0.10.0

88 Python Module Index


Index

Symbols __init__() (bqplot.scales.LinearScale method), 10


__init__() (bqplot.axes.Axis method), 55 __init__() (bqplot.scales.LogScale method), 12
__init__() (bqplot.axes.ColorAxis method), 56 __init__() (bqplot.scales.Mercator method), 21
__init__() (bqplot.figure.Figure method), 7 __init__() (bqplot.scales.OrdinalColorScale method), 19
__init__() (bqplot.interacts.BrushIntervalSelector __init__() (bqplot.scales.OrdinalScale method), 15
method), 62 __init__() (bqplot.scales.Scale method), 9
__init__() (bqplot.interacts.BrushSelector method), 63 __init__() (bqplot.scales.Stereographic method), 25
__init__() (bqplot.interacts.FastIntervalSelector method), __init__() (bqplot.toolbar.Toolbar method), 78
68 __init__() (bqplot.traits.Date method), 77
__init__() (bqplot.interacts.HandDraw method), 65
__init__() (bqplot.interacts.IndexSelector method), 66 A
__init__() (bqplot.interacts.Interaction method), 72 AlbersUSA (class in bqplot.scales), 22
__init__() (bqplot.interacts.MultiSelector method), 70 align (bqplot.marks.Bars attribute), 39
__init__() (bqplot.interacts.OneDSelector method), 71 align (bqplot.marks.Label attribute), 46
__init__() (bqplot.interacts.PanZoom method), 74 allow_padding (bqplot.scales.Scale attribute), 9
__init__() (bqplot.interacts.Selector method), 75 allow_pan (bqplot.interacts.PanZoom attribute), 73
__init__() (bqplot.interacts.TwoDSelector method), 76 allow_zoom (bqplot.interacts.PanZoom attribute), 73
__init__() (bqplot.market_map.MarketMap method), 59 anchor_style (bqplot.marks.GridHeatMap attribute), 43
__init__() (bqplot.market_map.SquareMarketMap animation_duration (bqplot.figure.Figure attribute), 6
method), 60 apply_clip (bqplot.marks.Mark attribute), 27
__init__() (bqplot.marks.Bars method), 39 axes (bqplot.figure.Figure attribute), 6
__init__() (bqplot.marks.FlexLine method), 32 axes (bqplot.market_map.MarketMap attribute), 57
__init__() (bqplot.marks.Graph method), 41 axes() (in module bqplot.pyplot), 81
__init__() (bqplot.marks.GridHeatMap method), 43 Axis (class in bqplot.axes), 54
__init__() (bqplot.marks.HeatMap method), 44 axis_types (bqplot.axes.Axis attribute), 54
__init__() (bqplot.marks.Hist method), 37
__init__() (bqplot.marks.Label method), 46 B
__init__() (bqplot.marks.Lines method), 31 background_style (bqplot.figure.Figure attribute), 6
__init__() (bqplot.marks.Map method), 52 bar() (in module bqplot.pyplot), 82
__init__() (bqplot.marks.Mark method), 28 Bars (class in bqplot.marks), 38
__init__() (bqplot.marks.OHLC method), 48 base (bqplot.marks.Bars attribute), 39
__init__() (bqplot.marks.Pie method), 51 bins (bqplot.marks.Hist attribute), 36
__init__() (bqplot.marks.Scatter method), 35 bqplot (module), 5
__init__() (bqplot.scales.AlbersUSA method), 23 bqplot.axes (module), 53
__init__() (bqplot.scales.ColorScale method), 16 bqplot.figure (module), 5
__init__() (bqplot.scales.DateColorScale method), 17 bqplot.interacts (module), 61
__init__() (bqplot.scales.DateScale method), 13 bqplot.market_map (module), 57
__init__() (bqplot.scales.GeoScale method), 20 bqplot.marks (module), 26
__init__() (bqplot.scales.Gnomonic method), 24 bqplot.pyplot (module), 80

89
bqplot Documentation, Release 0.10.0

bqplot.scales (module), 8 curves_subset (bqplot.marks.Lines attribute), 30


bqplot.toolbar (module), 78
bqplot.traits (module), 77 D
brushing (bqplot.interacts.BrushIntervalSelector at- Date (class in bqplot.traits), 77
tribute), 62 DateColorScale (class in bqplot.scales), 17
brushing (bqplot.interacts.BrushSelector attribute), 63 DateScale (class in bqplot.scales), 13
brushing (bqplot.interacts.MultiSelector attribute), 69 default_colors (bqplot.marks.Scatter attribute), 34
BrushIntervalSelector (class in bqplot.interacts), 61 default_opacities (bqplot.marks.Scatter attribute), 34
BrushSelector (class in bqplot.interacts), 63 default_size (bqplot.marks.Label attribute), 46
default_size (bqplot.marks.Scatter attribute), 34
C default_skew (bqplot.marks.Scatter attribute), 34
center (bqplot.scales.Gnomonic attribute), 24 directed (bqplot.marks.Graph attribute), 41
center (bqplot.scales.Mercator attribute), 21 display_labels (bqplot.marks.Pie attribute), 50
center (bqplot.scales.Stereographic attribute), 25 display_legend (bqplot.marks.Mark attribute), 27
charge (bqplot.marks.Graph attribute), 40 display_name (bqplot.marks.Mark attribute), 27
clear() (in module bqplot.pyplot), 83 display_names (bqplot.marks.Scatter attribute), 34
clip_angle (bqplot.scales.Gnomonic attribute), 24 display_text (bqplot.market_map.MarketMap attribute),
clip_angle (bqplot.scales.Stereographic attribute), 25 57
close() (in module bqplot.pyplot), 83 display_values (bqplot.marks.Pie attribute), 50
close_path (bqplot.marks.Lines attribute), 29 domain (bqplot.scales.OrdinalColorScale attribute), 19
color (bqplot.axes.Axis attribute), 54 domain (bqplot.scales.OrdinalScale attribute), 14
color (bqplot.interacts.BrushIntervalSelector attribute), domain_class (bqplot.scales.DateScale attribute), 13
62 domain_class (bqplot.scales.Scale attribute), 9
color (bqplot.interacts.BrushSelector attribute), 63 drag_size (bqplot.marks.Label attribute), 46
color (bqplot.interacts.FastIntervalSelector attribute), 68 drag_size (bqplot.marks.Scatter attribute), 34
color (bqplot.interacts.IndexSelector attribute), 66 dtype (bqplot.scales.AlbersUSA attribute), 23
color (bqplot.market_map.MarketMap attribute), 57 dtype (bqplot.scales.ColorScale attribute), 16
color (bqplot.marks.Bars attribute), 39 dtype (bqplot.scales.DateColorScale attribute), 17
color (bqplot.marks.FlexLine attribute), 32 dtype (bqplot.scales.DateScale attribute), 13
color (bqplot.marks.Graph attribute), 41 dtype (bqplot.scales.LinearScale attribute), 10
color (bqplot.marks.GridHeatMap attribute), 43 dtype (bqplot.scales.LogScale attribute), 12
color (bqplot.marks.HeatMap attribute), 44 dtype (bqplot.scales.Mercator attribute), 21
color (bqplot.marks.Label attribute), 46 dtype (bqplot.scales.OrdinalColorScale attribute), 19
color (bqplot.marks.Lines attribute), 30 dtype (bqplot.scales.OrdinalScale attribute), 14
color (bqplot.marks.Map attribute), 52
color (bqplot.marks.Pie attribute), 50 E
color_mode (bqplot.marks.Bars attribute), 38 enable_hover (bqplot.marks.Mark attribute), 28
ColorAxis (class in bqplot.axes), 56 enable_move (bqplot.marks.Scatter attribute), 34
colors (bqplot.marks.Bars attribute), 38 end_angle (bqplot.marks.Pie attribute), 50
colors (bqplot.marks.FlexLine attribute), 32
colors (bqplot.marks.Graph attribute), 41 F
colors (bqplot.marks.Hist attribute), 36 FastIntervalSelector (class in bqplot.interacts), 67
colors (bqplot.marks.Lines attribute), 29 fig_margin (bqplot.figure.Figure attribute), 6
colors (bqplot.marks.Map attribute), 52 figure (bqplot.toolbar.Toolbar attribute), 78
colors (bqplot.marks.OHLC attribute), 48 Figure (class in bqplot.figure), 6
colors (bqplot.marks.Pie attribute), 50 figure() (in module bqplot.pyplot), 80
colors (bqplot.marks.Scatter attribute), 34 fill (bqplot.marks.Lines attribute), 30
colors (bqplot.scales.ColorScale attribute), 16 fill_colors (bqplot.marks.Lines attribute), 30
ColorScale (class in bqplot.scales), 16 fill_opacities (bqplot.marks.Lines attribute), 30
cols (bqplot.market_map.MarketMap attribute), 58 FlexLine (class in bqplot.marks), 32
column (bqplot.marks.GridHeatMap attribute), 43 font_size (bqplot.marks.Pie attribute), 50
column_align (bqplot.marks.GridHeatMap attribute), 42 font_weight (bqplot.marks.Label attribute), 46
count (bqplot.marks.Hist attribute), 37 font_weight (bqplot.marks.Pie attribute), 50
current_figure() (in module bqplot.pyplot), 84 format (bqplot.marks.OHLC attribute), 48

90 Index
bqplot Documentation, Release 0.10.0

G link_distance (bqplot.marks.Graph attribute), 41


geo() (in module bqplot.pyplot), 83 link_matrix (bqplot.marks.Graph attribute), 40
GeoScale (class in bqplot.scales), 20 link_type (bqplot.marks.Graph attribute), 41
Gnomonic (class in bqplot.scales), 24 LogScale (class in bqplot.scales), 12
Graph (class in bqplot.marks), 40
grid_color (bqplot.axes.Axis attribute), 54 M
grid_lines (bqplot.axes.Axis attribute), 54 Map (class in bqplot.marks), 52
GridHeatMap (class in bqplot.marks), 42 map_data (bqplot.marks.Map attribute), 52
groups (bqplot.market_map.MarketMap attribute), 57 map_margin (bqplot.market_map.MarketMap attribute),
58
H Mark (class in bqplot.marks), 27
HandDraw (class in bqplot.interacts), 64 mark_types (bqplot.marks.Mark attribute), 27
HeatMap (class in bqplot.marks), 44 marker (bqplot.marks.Lines attribute), 30
highlight_links (bqplot.marks.Graph attribute), 41 marker (bqplot.marks.OHLC attribute), 48
Hist (class in bqplot.marks), 36 marker (bqplot.marks.Scatter attribute), 34
hist() (in module bqplot.pyplot), 82 marker_size (bqplot.marks.Lines attribute), 30
hover_highlight (bqplot.marks.Map attribute), 52 MarketMap (class in bqplot.market_map), 57
hovered_styles (bqplot.marks.Map attribute), 52 marks (bqplot.figure.Figure attribute), 6
marks (bqplot.interacts.Selector attribute), 75
I max (bqplot.scales.ColorScale attribute), 16
max (bqplot.scales.DateColorScale attribute), 17
icon (bqplot.axes.Axis attribute), 54
max (bqplot.scales.DateScale attribute), 13
icon (bqplot.marks.Bars attribute), 38
max (bqplot.scales.LinearScale attribute), 10
icon (bqplot.marks.Hist attribute), 36
max (bqplot.scales.LogScale attribute), 12
icon (bqplot.marks.Lines attribute), 29
max_aspect_ratio (bqplot.figure.Figure attribute), 7
icon (bqplot.marks.OHLC attribute), 48
max_aspect_ratio (bqplot.market_map.MarketMap at-
icon (bqplot.marks.Scatter attribute), 34
tribute), 58
IndexSelector (class in bqplot.interacts), 66
max_x (bqplot.interacts.HandDraw attribute), 65
inner_radius (bqplot.marks.Pie attribute), 50
Mercator (class in bqplot.scales), 21
interaction (bqplot.figure.Figure attribute), 6
mid (bqplot.scales.ColorScale attribute), 16
Interaction (class in bqplot.interacts), 72
mid (bqplot.scales.DateColorScale attribute), 17
interactions (bqplot.marks.Mark attribute), 28
mid_range (bqplot.scales.LinearScale attribute), 10
interpolation (bqplot.marks.Lines attribute), 30
midpoints (bqplot.marks.Hist attribute), 37
min (bqplot.scales.ColorScale attribute), 16
L min (bqplot.scales.DateColorScale attribute), 17
label (bqplot.axes.Axis attribute), 54 min (bqplot.scales.DateScale attribute), 13
Label (class in bqplot.marks), 46 min (bqplot.scales.LinearScale attribute), 10
label_color (bqplot.axes.Axis attribute), 54 min (bqplot.scales.LogScale attribute), 12
label_color (bqplot.marks.Pie attribute), 50 min_aspect_ratio (bqplot.figure.Figure attribute), 6
label_location (bqplot.axes.Axis attribute), 54 min_aspect_ratio (bqplot.market_map.MarketMap
label_offset (bqplot.axes.Axis attribute), 54 attribute), 58
labels (bqplot.marks.Mark attribute), 27 min_range (bqplot.scales.LinearScale attribute), 10
labels_visibility (bqplot.marks.Lines attribute), 30 min_x (bqplot.interacts.HandDraw attribute), 65
legend_location (bqplot.figure.Figure attribute), 6 MultiSelector (class in bqplot.interacts), 69
legend_style (bqplot.figure.Figure attribute), 6
legend_text (bqplot.figure.Figure attribute), 6 N
line_index (bqplot.interacts.HandDraw attribute), 65
name (bqplot.marks.Bars attribute), 38
line_style (bqplot.marks.Lines attribute), 30
name (bqplot.marks.FlexLine attribute), 32
line_width (bqplot.interacts.IndexSelector attribute), 66
name (bqplot.marks.Hist attribute), 36
LinearScale (class in bqplot.scales), 10
name (bqplot.marks.Lines attribute), 29
lines (bqplot.interacts.HandDraw attribute), 65
name (bqplot.marks.OHLC attribute), 48
Lines (class in bqplot.marks), 29
name (bqplot.marks.Scatter attribute), 34
link_color (bqplot.marks.Graph attribute), 41
names (bqplot.interacts.MultiSelector attribute), 70
link_data (bqplot.marks.Graph attribute), 40
names (bqplot.market_map.MarketMap attribute), 57

Index 91
bqplot Documentation, Release 0.10.0

names (bqplot.marks.Scatter attribute), 34 rtype (bqplot.scales.DateScale attribute), 13


node_data (bqplot.marks.Graph attribute), 40 rtype (bqplot.scales.LinearScale attribute), 10
normalized (bqplot.marks.Hist attribute), 36 rtype (bqplot.scales.LogScale attribute), 12
num_ticks (bqplot.axes.Axis attribute), 54 rtype (bqplot.scales.Mercator attribute), 21
rtype (bqplot.scales.OrdinalColorScale attribute), 19
O rtype (bqplot.scales.OrdinalScale attribute), 14
offset (bqplot.axes.Axis attribute), 54
OHLC (class in bqplot.marks), 48 S
ohlc() (in module bqplot.pyplot), 83 sample (bqplot.marks.Hist attribute), 37
on_hover (bqplot.market_map.MarketMap attribute), 57 scale (bqplot.axes.Axis attribute), 54
OneDSelector (class in bqplot.interacts), 71 scale (bqplot.axes.ColorAxis attribute), 56
opacities (bqplot.marks.Bars attribute), 39 scale (bqplot.interacts.OneDSelector attribute), 71
opacities (bqplot.marks.Hist attribute), 37 Scale (class in bqplot.scales), 8
opacities (bqplot.marks.Lines attribute), 30 scale_factor (bqplot.scales.AlbersUSA attribute), 22
opacities (bqplot.marks.OHLC attribute), 48 scale_factor (bqplot.scales.Gnomonic attribute), 24
opacities (bqplot.marks.Pie attribute), 50 scale_factor (bqplot.scales.Mercator attribute), 21
opacity (bqplot.marks.Label attribute), 46 scale_factor (bqplot.scales.Stereographic attribute), 25
OrdinalColorScale (class in bqplot.scales), 18 scale_type (bqplot.scales.ColorScale attribute), 16
OrdinalScale (class in bqplot.scales), 14 scale_types (bqplot.scales.Scale attribute), 8
orientation (bqplot.axes.Axis attribute), 54 scale_x (bqplot.figure.Figure attribute), 6
orientation (bqplot.marks.Bars attribute), 38 scale_y (bqplot.figure.Figure attribute), 6
scales (bqplot.interacts.PanZoom attribute), 74
P scales (bqplot.market_map.MarketMap attribute), 57
padding (bqplot.marks.Bars attribute), 39 scales (bqplot.marks.Mark attribute), 27
padding_x (bqplot.figure.Figure attribute), 6 scales() (in module bqplot.pyplot), 84
padding_y (bqplot.figure.Figure attribute), 6 scales_metadata (bqplot.marks.Mark attribute), 27
PanZoom (class in bqplot.interacts), 73 Scatter (class in bqplot.marks), 33
Pie (class in bqplot.marks), 50 scatter() (in module bqplot.pyplot), 82
plot() (in module bqplot.pyplot), 81 scheme (bqplot.scales.ColorScale attribute), 16
precedence (bqplot.scales.LinearScale attribute), 10 selected (bqplot.interacts.BrushIntervalSelector at-
precedence (bqplot.scales.Scale attribute), 9 tribute), 62
precision (bqplot.scales.Gnomonic attribute), 24 selected (bqplot.interacts.BrushSelector attribute), 63
precision (bqplot.scales.Stereographic attribute), 25 selected (bqplot.interacts.FastIntervalSelector attribute),
preserve_domain (bqplot.marks.Mark attribute), 27 68
selected (bqplot.interacts.IndexSelector attribute), 66
R selected (bqplot.interacts.MultiSelector attribute), 69
radius (bqplot.marks.Pie attribute), 50 selected (bqplot.marks.Map attribute), 52
ref_data (bqplot.market_map.MarketMap attribute), 57 selected (bqplot.marks.Mark attribute), 28
restrict_x (bqplot.marks.Label attribute), 46 selected_style (bqplot.marks.Mark attribute), 28
restrict_x (bqplot.marks.Scatter attribute), 34 selected_styles (bqplot.marks.Map attribute), 52
restrict_y (bqplot.marks.Label attribute), 46 Selector (class in bqplot.interacts), 75
restrict_y (bqplot.marks.Scatter attribute), 34 show() (in module bqplot.pyplot), 80
reverse (bqplot.scales.Scale attribute), 9 show_groups (bqplot.market_map.MarketMap attribute),
rotate (bqplot.scales.Mercator attribute), 21 58
rotate (bqplot.scales.Stereographic attribute), 25 show_names (bqplot.interacts.MultiSelector attribute), 70
rotation (bqplot.marks.Label attribute), 46 side (bqplot.axes.Axis attribute), 54
row (bqplot.marks.GridHeatMap attribute), 43 size (bqplot.interacts.FastIntervalSelector attribute), 68
row_align (bqplot.marks.GridHeatMap attribute), 42 size (bqplot.marks.Label attribute), 46
row_groups (bqplot.market_map.MarketMap attribute), sizes (bqplot.marks.Pie attribute), 50
58 sort (bqplot.marks.Pie attribute), 50
rows (bqplot.market_map.MarketMap attribute), 58 SquareMarketMap (class in bqplot.market_map), 60
rtype (bqplot.scales.AlbersUSA attribute), 22 stabilized (bqplot.scales.LinearScale attribute), 10
rtype (bqplot.scales.ColorScale attribute), 16 start_angle (bqplot.marks.Pie attribute), 50
rtype (bqplot.scales.DateColorScale attribute), 17 Stereographic (class in bqplot.scales), 25

92 Index
bqplot Documentation, Release 0.10.0

stroke (bqplot.marks.Bars attribute), 39 xlim() (in module bqplot.pyplot), 84


stroke (bqplot.marks.Hist attribute), 36
stroke (bqplot.marks.OHLC attribute), 48 Y
stroke (bqplot.marks.Pie attribute), 50 y (bqplot.marks.Bars attribute), 39
stroke (bqplot.marks.Scatter attribute), 34 y (bqplot.marks.FlexLine attribute), 32
stroke_width (bqplot.marks.FlexLine attribute), 32 y (bqplot.marks.Graph attribute), 41
stroke_width (bqplot.marks.Lines attribute), 30 y (bqplot.marks.HeatMap attribute), 44
stroke_width (bqplot.marks.OHLC attribute), 48 y (bqplot.marks.Label attribute), 46
stroke_width (bqplot.marks.Scatter attribute), 34 y (bqplot.marks.Lines attribute), 30
y (bqplot.marks.OHLC attribute), 48
T y (bqplot.marks.Pie attribute), 50
text (bqplot.marks.Label attribute), 46 y_offset (bqplot.marks.Label attribute), 46
tick_format (bqplot.axes.Axis attribute), 54 y_scale (bqplot.interacts.TwoDSelector attribute), 76
tick_values (bqplot.axes.Axis attribute), 54 ylabel() (in module bqplot.pyplot), 85
title (bqplot.figure.Figure attribute), 6 ylim() (in module bqplot.pyplot), 84
title_style (bqplot.figure.Figure attribute), 6
Toolbar (class in bqplot.toolbar), 78
tooltip (bqplot.marks.Mark attribute), 28
tooltip_fields (bqplot.market_map.MarketMap attribute),
58
tooltip_formats (bqplot.market_map.MarketMap at-
tribute), 58
tooltip_location (bqplot.marks.Mark attribute), 28
tooltip_style (bqplot.marks.Mark attribute), 28
tooltip_widget (bqplot.market_map.MarketMap at-
tribute), 57
TwoDSelector (class in bqplot.interacts), 76
type (bqplot.marks.Bars attribute), 38
types (bqplot.interacts.Interaction attribute), 72

U
unselected_style (bqplot.marks.Mark attribute), 28

V
values_format (bqplot.marks.Pie attribute), 50
visible (bqplot.axes.Axis attribute), 54
visible (bqplot.marks.Mark attribute), 27

W
width (bqplot.marks.FlexLine attribute), 32

X
x (bqplot.marks.Bars attribute), 39
x (bqplot.marks.FlexLine attribute), 32
x (bqplot.marks.Graph attribute), 41
x (bqplot.marks.HeatMap attribute), 44
x (bqplot.marks.Label attribute), 46
x (bqplot.marks.Lines attribute), 30
x (bqplot.marks.OHLC attribute), 48
x (bqplot.marks.Pie attribute), 50
x_offset (bqplot.marks.Label attribute), 46
x_scale (bqplot.interacts.TwoDSelector attribute), 76
xlabel() (in module bqplot.pyplot), 85

Index 93

You might also like