Marks
bqplot.marks
Bars
Bases: Mark
Bar mark.
Warning
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.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the data points (1d array)
TYPE:
|
y |
ordinates of the values for the data points
TYPE:
|
color |
color of the data points (1d array). Defaults to default_color when not provided or when a value is NaN
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
font-awesome icon for that mark
TYPE:
|
name |
user-friendly name of the mark
TYPE:
|
color_mode |
Specify how default colors are applied to bars. The 'group' mode means colors are assigned per group. If the list of colors is shorter than the number of groups, colors are reused. The 'element' mode means colors are assigned per group element. If the list of colors is shorter than the number of bars in a group, colors are reused. The 'no_group' mode means colors are assigned per bar, discarding the fact that there are groups or stacks. If the list of colors is shorter than the total number of bars, colors are reused.
TYPE:
|
opacity_mode |
Same as the
TYPE:
|
type |
whether 2-dimensional bar charts should appear grouped or stacked.
TYPE:
|
colors |
list of colors for the bars.
TYPE:
|
orientation |
Specifies whether the bar chart is drawn horizontally or vertically. If a horizontal bar chart is drawn, the x data is drawn vertically.
TYPE:
|
padding |
Attribute to control the spacing between the bars value is specified as a percentage of the width of the bar
TYPE:
|
fill |
Whether to fill the bars or not
TYPE:
|
stroke |
Stroke color for the bars
TYPE:
|
stroke_width |
Stroke width of the bars
TYPE:
|
opacities |
Opacities for the bars. Defaults to 1 when the list is too short, or the element of the list is set to None.
TYPE:
|
base |
reference value from which the bars are drawn. defaults to 0.0
TYPE:
|
align |
alignment of bars with respect to the tick value
TYPE:
|
label_display |
whether or not to display bar data labels
TYPE:
|
label_display_format |
format for displaying values.
TYPE:
|
label_font_style |
CSS style for the text of each cell
TYPE:
|
label_display_vertical_offset |
vertical offset value for the label display
TYPE:
|
label_display_horizontal_offset |
horizontal offset value for the label display
TYPE:
|
!!! Note |
|
Bins
Bases: Bars
Backend histogram mark.
A Bars
instance that bins sample data.
It is very similar in purpose to the Hist
mark, the difference being that
the binning is done in the backend (python), which avoids large amounts of
data being shipped back and forth to the frontend. It should therefore be
preferred for large data.
The binning method is the numpy histogram
method.
The following documentation is in part taken from the numpy documentation.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
sample |
sample of which the histogram must be computed.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
font-awesome icon for that mark
TYPE:
|
name |
user-friendly name of the mark
TYPE:
|
bins |
or {'auto', 'fd', 'doane', 'scott', 'rice', 'sturges', 'sqrt'}
If
TYPE:
|
density |
If
TYPE:
|
min |
The lower range of the bins. If not provided, lower range
is simply
TYPE:
|
max |
The upper range of the bins. If not provided, lower range
is simply
TYPE:
|
!!! Note |
|
Boxplot
Bases: Mark
Boxplot marks.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
|
abscissas of the data points (1d array)
TYPE:
|
y |
Sample data points (2d array)
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
stroke |
stroke color of the marker
TYPE:
|
color |
fill color of the box
TYPE:
|
opacities |
Opacities for the markers of the boxplot. Defaults to 1 when the list is too short, or the element of the list is set to None.
TYPE:
|
outlier-color |
color for the outlier
TYPE:
|
box_width |
width of the box in pixels. The minimum value is 5. If set to None, box_with is auto calculated
TYPE:
|
auto_detect_outliers |
Flag to toggle outlier auto-detection
TYPE:
|
FlexLine
Bases: Mark
Lines mark with the possibility to change the line width and color for each segment.
Warning
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.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the data points (1d array)
TYPE:
|
y |
ordinates of the data points (1d array)
TYPE:
|
color |
Array controlling the color of the data points
TYPE:
|
width |
Array controlling the widths of the Lines.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
name |
user-friendly name of the mark
TYPE:
|
colors |
List of colors for the Lines
TYPE:
|
stroke_width |
Default stroke width of the Lines
TYPE:
|
Graph
Bases: Mark
Graph with nodes and links.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the node data points (1d array)
TYPE:
|
y |
ordinates of the node data points (1d array)
TYPE:
|
color |
color of the node data points (1d array).
TYPE:
|
link_color |
link data passed as 2d matrix
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
node_data |
list of node attributes for the graph
TYPE:
|
link_matrix |
link data passed as 2d matrix
TYPE:
|
link_data |
list of link attributes for the graph
TYPE:
|
charge |
charge of force layout. Will be ignored when x and y data attributes are set
TYPE:
|
static |
whether the graph is static or not
TYPE:
|
link_distance |
link distance in pixels between nodes. Will be ignored when x and y data attributes are set
TYPE:
|
link_type |
Enum representing link type
TYPE:
|
directed |
directed or undirected graph
TYPE:
|
highlight_links |
highlights incoming and outgoing links when hovered on a node
TYPE:
|
colors |
list of node colors
TYPE:
|
GridHeatMap
Bases: Mark
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.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
color |
color of the data points (2d array). The number of elements in this array correspond to the number of cells created in the heatmap.
TYPE:
|
row |
labels for the rows of the
TYPE:
|
column |
labels for the columns of the
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
row_align |
This is only valid if the number of entries in
TYPE:
|
column_align |
This is only valid if the number of entries in
TYPE:
|
anchor_style |
Controls the style for the element which serves as the anchor during selection.
TYPE:
|
display_format |
format for displaying values. If None, then values are not displayed
TYPE:
|
font_style |
CSS style for the text of each cell
TYPE:
|
HeatMap
Bases: Mark
HeatMap mark.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
color |
color of the data points (2d array).
TYPE:
|
x |
labels for the columns of the
TYPE:
|
y |
labels for the rows of the
TYPE:
|
Hist
Bases: Mark
Histogram mark.
Warning
In the case of the Hist mark, scales for 'sample' and 'count' must be provided.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
sample |
sample of which the histogram must be computed.
TYPE:
|
count |
number of sample points per bin. It is a read-only attribute.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
font-awesome icon for that mark
TYPE:
|
name |
user-friendly name of the mark
TYPE:
|
bins |
number of bins in the histogram
TYPE:
|
normalized |
Boolean attribute to return normalized values which
sum to 1 or direct counts for the
TYPE:
|
colors |
List of colors of the Histogram. If the list is shorter than the number of bins, the colors are reused.
TYPE:
|
stroke |
Stroke color of the histogram
TYPE:
|
opacities |
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.
TYPE:
|
midpoints |
midpoints of the bins of the histogram. It is a read-only attribute.
TYPE:
|
!!! Note |
|
Image
Bases: Mark
Image mark, based on the ipywidgets image
If no scales are passed, uses the parent Figure scales.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
image |
Image to be displayed
TYPE:
|
x |
abscissas of the left and right-hand side of the image in the format (x0, x1)
TYPE:
|
y |
ordinates of the bottom and top side of the image in the format (y0, y1)
TYPE:
|
Label
Bases: _ScatterBase
Label mark.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
horizontal position of the labels, in data coordinates or in figure coordinates
TYPE:
|
y |
vertical position of the labels, in data coordinates or in figure coordinates
TYPE:
|
color |
label colors
TYPE:
|
size |
label sizes
TYPE:
|
rotation |
label rotations
TYPE:
|
opacity |
label opacities
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x_offset |
horizontal offset in pixels from the stated x location
TYPE:
|
y_offset |
vertical offset in pixels from the stated y location
TYPE:
|
text |
text to be displayed
TYPE:
|
default_size |
font size in px, em or ex
TYPE:
|
font_weight |
font weight of the caption
TYPE:
|
drag_size |
Ratio of the size of the dragged label font size to the default label font size.
TYPE:
|
align |
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.
TYPE:
|
restrict_x |
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.
TYPE:
|
restrict_y |
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.
TYPE:
|
Lines
Bases: Mark
Lines mark.
Warning
In the case of the Lines mark, scales for 'x' and 'y' must be provided.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the data points (1d or 2d array)
TYPE:
|
y |
ordinates of the data points (1d or 2d array)
TYPE:
|
color |
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.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
Font-awesome icon for the respective mark
TYPE:
|
name |
User-friendly name of the mark
TYPE:
|
colors |
List of colors of the Lines. If the list is shorter than the number of lines, the colors are reused.
TYPE:
|
close_path |
Whether to close the paths or not.
TYPE:
|
fill |
Fill in the area defined by the curves
TYPE:
|
fill_colors |
Fill colors for the areas. Defaults to stroke-colors when no color provided
TYPE:
|
opacities |
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.
TYPE:
|
fill_opacities |
Opacity for the areas. Defaults to 1 when the list is too short, or the element of the list is set to None.
TYPE:
|
stroke_width |
Stroke width of the Lines
TYPE:
|
labels_visibility |
Visibility of the curve labels
TYPE:
|
curves_subset |
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.
TYPE:
|
line_style |
Line style.
TYPE:
|
interpolation |
TYPE:
|
'cardinal-closed', 'monotone', 'step-before', 'step-after'} |
Interpolation scheme used for interpolation between the data points provided. Please refer to the svg interpolate documentation for details about the different interpolation schemes.
|
marker |
Marker shape
TYPE:
|
marker_size |
Default marker size in pixels
TYPE:
|
!!! note |
|
Map
Bases: Mark
Map mark.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
color |
dictionary containing the data associated with every country for the color scale
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
colors |
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
TYPE:
|
selected_styles |
TYPE:
|
selected_stroke |
Dictionary containing the styles for selected subunits
TYPE:
|
hovered_styles |
TYPE:
|
hovered_stroke |
Dictionary containing the styles for hovered subunits
TYPE:
|
hover_highlight |
boolean to control if the map should be aware of which country is being hovered on.
TYPE:
|
map_data |
a topojson-formatted dictionary with the objects to map under the key 'subunits'.
TYPE:
|
Mark
Bases: Widget
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'.
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
display_name |
Holds a user-friendly name for the trait attribute.
TYPE:
|
mark_types |
A registry of existing mark types.
TYPE:
|
scales |
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).
TYPE:
|
scales_metadata |
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 dictionary may change dynamically. It is an instance-level attribute.
TYPE:
|
preserve_domain |
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.
TYPE:
|
display_legend |
Display toggle for the mark legend in the general figure legend
TYPE:
|
labels |
Labels of the items of the mark. This attribute has different meanings depending on the type of mark.
TYPE:
|
apply_clip |
Indicates whether the items that are beyond the limits of the chart should be clipped.
TYPE:
|
visible |
Visibility toggle for the mark.
TYPE:
|
selected_style |
CSS style to be applied to selected items in the mark.
TYPE:
|
unselected_style |
CSS style to be applied to items that are not selected in the mark, when a selection exists.
TYPE:
|
selected |
Indices of the selected items in the mark.
TYPE:
|
tooltip |
Widget to be displayed as tooltip when elements of the scatter are hovered on
TYPE:
|
tooltip_style |
Styles to be applied to the tooltip widget
TYPE:
|
enable_hover |
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
TYPE:
|
interactions |
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.
TYPE:
|
tooltip_location |
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.
TYPE:
|
METHOD | DESCRIPTION |
---|---|
Attributes |
|
---------- |
|
on_hover |
Register a callback that will be triggered on hover. |
on_click |
Register a callback that will be triggered on click. |
on_legend_hover |
Register a callback that will be triggered on legend hover. |
on_legend_click |
Register a callback that will be triggered on legend click. |
on_element_click |
Register a callback that will be triggered on element click. |
on_background_click |
Register a callback that will be triggered on background click. |
OHLC
Bases: Mark
Open/High/Low/Close marks.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the data points (1d array)
TYPE:
|
y |
Open/High/Low/Close ordinates of the data points (2d array)
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
font-awesome icon for that mark
TYPE:
|
name |
user-friendly name of the mark
TYPE:
|
marker |
marker type
TYPE:
|
stroke |
stroke color of the marker
TYPE:
|
stroke_width |
stroke width of the marker
TYPE:
|
colors |
fill colors for the markers (up/down)
TYPE:
|
opacities |
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.
TYPE:
|
format |
description of y data being passed supports all permutations of the strings 'ohlc', 'oc', and 'hl'
TYPE:
|
!!! Note |
|
Pie
Bases: Mark
Piechart mark.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
sizes |
proportions of the pie slices
TYPE:
|
color |
color of the data points. Defaults to colors when not provided.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
colors |
list of colors for the slices.
TYPE:
|
stroke |
stroke color for the marker
TYPE:
|
opacities |
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.
TYPE:
|
sort |
sort the pie slices by descending sizes
TYPE:
|
x |
horizontal position of the pie center, in data coordinates or in figure coordinates
TYPE:
|
y |
vertical y position of the pie center, in data coordinates or in figure coordinates
TYPE:
|
radius |
radius of the pie, in pixels
TYPE:
|
inner_radius |
inner radius of the pie, in pixels
TYPE:
|
start_angle |
start angle of the pie (from top), in degrees
TYPE:
|
end_angle |
end angle of the pie (from top), in degrees
TYPE:
|
display_labels |
label display options
TYPE:
|
display_values |
if True show values along with labels
TYPE:
|
values_format |
format for displaying values
TYPE:
|
label_color |
color of the labels
TYPE:
|
font_size |
label font size in px, em or ex
TYPE:
|
font_weight |
label font weight
TYPE:
|
Scatter
Bases: _ScatterBase
Scatter mark.
Warning
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 missing, the data attribute is ignored.
Data Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
x |
abscissas of the data points (1d array)
TYPE:
|
y |
ordinates of the data points (1d array)
TYPE:
|
color |
color of the data points (1d array). Defaults to default_color when not provided or when a value is NaN
TYPE:
|
opacity |
opacity of the data points (1d array). Defaults to default_opacity when not provided or when a value is NaN
TYPE:
|
size |
size of the data points. Defaults to default_size when not provided or when a value is NaN
TYPE:
|
skew |
skewness of the markers representing the data points. Defaults to default_skew when not provided or when a value is NaN
TYPE:
|
rotation |
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.
TYPE:
|
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
icon |
Font-awesome icon for that mark
TYPE:
|
name |
User-friendly name of the mark
TYPE:
|
marker |
Marker shape
TYPE:
|
colors |
List of colors of the markers. If the list is shorter than the number of points, the colors are reused.
TYPE:
|
default_colors |
Same as
TYPE:
|
fill |
Whether to fill the markers or not
TYPE:
|
stroke |
Stroke color of the marker
TYPE:
|
stroke_width |
Stroke width of the marker
TYPE:
|
opacities |
Default opacities of the markers. If the list is shorter than the number of points, the opacities are reused.
TYPE:
|
default_skew |
Default skew of the marker. This number is validated to be between 0 and 1.
TYPE:
|
default_size |
Default marker size in pixel. If size data is provided with a scale, default_size stands for the maximal marker size (i.e. the maximum value for the 'size' scale range)
TYPE:
|
drag_size |
Ratio of the size of the dragged scatter size to the default scatter size.
TYPE:
|
names |
Labels for the points of the chart
TYPE:
|
display_names |
Controls whether names are displayed for points in the scatter
TYPE:
|
label_display_horizontal_offset |
Adds an offset, in pixels, to the horizontal positioning of the 'names' label above each data point
TYPE:
|
label_display_vertical_offset |
Adds an offset, in pixels, to the vertical positioning of the 'names' label above each data point
TYPE:
|
enable_move |
Controls whether points can be moved by dragging. Refer to restrict_x, restrict_y for more options.
TYPE:
|
restrict_x |
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.
TYPE:
|
restrict_y |
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.
TYPE:
|
!!! Note |
|