Figure
bqplot.Figure
Bases: DOMWidget
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.
Style Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
title |
title of the figure
TYPE:
|
axes |
list containing the instances of the axes for the figure
TYPE:
|
marks |
list containing the marks which are to be appended to the figure
TYPE:
|
interaction |
optional interaction layer for the figure
TYPE:
|
scale_x |
Scale representing the x values of the figure
TYPE:
|
scale_y |
Scale representing the y values of the figure
TYPE:
|
padding_x |
Padding to be applied in the horizontal direction of the figure around the data points, proportion of the horizontal length
TYPE:
|
padding_y |
Padding to be applied in the vertical direction of the figure around the data points, proportion of the vertical length
TYPE:
|
legend_location |
'bottom-left', 'bottom', 'bottom-right', 'right'} location of the legend relative to the center of the figure
TYPE:
|
background_style |
CSS style to be applied to the background of the figure
TYPE:
|
legend_style |
CSS style to be applied to the SVG legend e.g, {'fill': 'white'}
TYPE:
|
legend_text |
CSS style to be applied to the legend text e.g., {'font-size': 20}
TYPE:
|
title_style |
CSS style to be applied to the title of the figure
TYPE:
|
animation_duration |
Duration of transition on change of data attributes, in milliseconds.
TYPE:
|
Layout Attributes
ATTRIBUTE | DESCRIPTION |
---|---|
pixel_ratio |
Pixel ratio of the WebGL canvas (2 on retina screens). Set to 1 for better performance, but less crisp edges. If set to None it will use the browser's window.devicePixelRatio.
|
display_toolbar |
Show or hide the integrated toolbar.
TYPE:
|
fig_margin |
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.
TYPE:
|
auto_layout |
Whether to use the auto-layout solver or not
TYPE:
|
min_aspect_ratio |
Minimum width / height ratio of the figure
TYPE:
|
max_aspect_ratio |
Maximum width / height ratio of the figure
TYPE:
|
!!! Note |
The aspect ratios stand for width / height ratios.
Default min and max aspect ratio are both equal to 16 / 9.
|
get_png_data(callback, scale=None)
Gets the Figure as a PNG memory view
PARAMETER | DESCRIPTION |
---|---|
callback |
Called with the PNG data as the only positional argument.
|
scale |
Scale up the png resolution when scale > 1, when not given base this on the screen pixel ratio.
DEFAULT:
|
save_png(filename='bqplot.png', scale=None)
Saves the Figure as a PNG file
PARAMETER | DESCRIPTION |
---|---|
filename |
name of the saved file
DEFAULT:
|
scale |
Scale up the png resolution when scale > 1, when not given base this on the screen pixel ratio.
DEFAULT:
|
save_svg(filename='bqplot.svg')
Saves the Figure as an SVG file
PARAMETER | DESCRIPTION |
---|---|
filename |
name of the saved file
DEFAULT:
|