bokeh.charts
¶
Chart Options¶
See the options available as input to all Charts in Chart Defaults. Each of these can be set at a global level with the shared defaults object, or can be passed as kwargs to each Chart.
Charts¶
Area¶
Area
(data=None, x=None, y=None, **kws)¶Create an area chart using
AreaBuilder
to render the geometry from values.
Parameters:
- data (Accepted Charts Data Formats) – table-like data
- x (str or list(str) – the column label to use for the x dimension
- y (str or list(str) – the column label to use for the y dimension
In addition the the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate the area glyphs Return type: Chart
Examples:
from bokeh.charts import Area, show, output_file # create some example data data = dict( python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111], pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130], jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160], ) area = Area(data, title="Area Chart", legend="top_left", xlabel='time', ylabel='memory') output_file('area.html') show(area)
Bar¶
Bar
(data, label=None, values=None, color=None, stack=None, group=None, agg='sum', xscale='categorical', yscale='linear', xgrid=False, ygrid=True, continuous_range=None, **kw)¶Create a Bar chart using
BarBuilder
render the geometry from values, cat and stacked.
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart.
- label (list(str) – list of string representing the categories. (Defaults to None)
- values (str, optional) – iterable 2d representing the data series values matrix.
- color (str or list(str) – string color, string column name, list of string columns or a custom ColorAttr, which replaces the default ColorAttr for the builder.
- stack (list(str) – columns to use for stacking. (Defaults to False, so grouping is assumed)
- group (list(str) – columns to use for grouping.
- agg (str) – how to aggregate the values. (Defaults to ‘sum’, or only label is provided, then performs a count)
- continuous_range (Range1d, optional) – Custom continuous_range to be used. (Defaults to None)
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate bars Return type: Chart
Examples
from bokeh.charts import Bar, output_file, show from bokeh.layouts import row # best support is with data in a format that is table-like data = { 'sample': ['1st', '2nd', '1st', '2nd', '1st', '2nd'], 'interpreter': ['python', 'python', 'pypy', 'pypy', 'jython', 'jython'], 'timing': [-2, 5, 12, 40, 22, 30] } # x-axis labels pulled from the interpreter column, stacking labels from sample column bar = Bar(data, values='timing', label='interpreter', stack='sample', agg='mean', title="Python Interpreter Sampling", legend='top_right', plot_width=400) # table-like data results in reconfiguration of the chart with no data manipulation bar2 = Bar(data, values='timing', label=['interpreter', 'sample'], agg='mean', title="Python Interpreters", plot_width=400) output_file("stacked_bar.html") show(row(bar, bar2))
BoxPlot¶
BoxPlot
(data, label=None, values=None, color=None, group=None, xscale='categorical', yscale='linear', xgrid=False, ygrid=True, continuous_range=None, **kw)¶Create a BoxPlot chart containing one or more boxes from table-like data.
Create a boxplot chart using
BoxPlotBuilder
to render the glyphs from input data and specification. This primary use case for the boxplot is to depict the distribution of a variable by providing summary statistics for it. This boxplot is particularly useful at comparing distributions between categorical variables.This chart implements functionality for segmenting and comparing the values of a variable by an associated categorical variable.
Reference: BoxPlot on Wikipedia
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart
- values (str, optional) – the values to use for producing the boxplot using table-like input data
- label (str or list(str) – the categorical variable to use for creating separate boxes
- color (str or list(str) – the categorical variable or color attribute specification to use for coloring the boxes.
- whisker_color (str or list(str) – the color of the “whiskers” that show the spread of values outside the .25 and .75 quartiles.
- marker (str or list(str) – the marker glyph to use for the outliers
- outliers (bool, optional) – whether to show outliers. Defaults to True.
- **kw –
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate Boxes and Whiskers Return type: Chart
Examples:
from bokeh.charts import BoxPlot, output_file, show from bokeh.layouts import row from bokeh.sampledata.autompg import autompg as df box = BoxPlot(df, values='mpg', label='cyl', title="Auto MPG Box Plot", plot_width=400) box2 = BoxPlot(df, values='mpg', label='cyl', color='cyl', title="MPG Box Plot by Cylinder Count", plot_width=400) output_file('box.html') show(row(box, box2))
Chord¶
Chord
(data, source=None, target=None, value=None, square_matrix=False, label=None, xgrid=False, ygrid=False, **kw)¶Create a chord chart using
ChordBuilder
to render a chord graph from a variety of value forms. This chart displays the inter-relationships between data in a matrix.The data can be generated by the chart interface. Given a
DataFrame
, select two columns to be used as arcs with source and target attributes, passing by the name of those columns. TheChord
chart will then deduce the relationship between the arcs.The value of the connections can be inferred automatically by counting source and target. If you prefer you can assign a fixed value for all the connections with value simply passing by a number. A third option is to pass a reference to a third column in the
DataFrame
with the values for the connections.If you want to plot the relationships in a squared matrix, simply pass the matrix and set square_matrix attribute to True.
Reference: Chord diagram on Wikipedia
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart.
- source (list(str) – Data source to use as origin of the connection to a destination.
- target (list(str) – Data source to use as destination of a connection.
- value (list(num) – The value the connection should have.
- square_matrix (bool, optional) – If square matrix, avoid any calculations during the setup.
- label (list(str) – The labels to be put in the areas.
Returns: includes glyph renderers that generate the chord
Return type: Examples:
import pandas as pd from bokeh.charts import Chord from bokeh.io import show, output_file from bokeh.sampledata.les_mis import data nodes = data['nodes'] links = data['links'] nodes_df = pd.DataFrame(nodes) links_df = pd.DataFrame(links) source_data = links_df.merge(nodes_df, how='left', left_on='source', right_index=True) source_data = source_data.merge(nodes_df, how='left', left_on='target', right_index=True) source_data = source_data[source_data["value"] > 5] # Select those with 5 or more connections chord_from_df = Chord(source_data, source="name_x", target="name_y", value="value") output_file('chord_from_df.html') show(chord_from_df)
Donut¶
Donut
(data, label='index', values=None, color=None, agg=None, hover_tool=True, hover_text=None, plot_height=400, plot_width=400, xgrid=False, ygrid=False, **kw)¶Create a Donut chart containing one or more layers from table-like data.
Create a donut chart using
DonutBuilder
to render the glyphs from input data and specification. The primary use case for the donut chart is to show relative amount each category, within a categorical array or multiple categorical arrays, makes up of the whole for some array of values.
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart label (str or list(str), optional): the categorical variable to use for creating separate boxes
- values (str, optional) – the values to use for producing the boxplot using table-like input data
- color (str or list(str) – the categorical variable or color attribute specification to use for coloring the wedges
- agg (str, optional) – how the values associated with a wedge should be aggregated hover_tool (bool, optional): whether to show the value of the wedge when hovering
- hover_text (str, optional) – provide an alternative string to use label the value shown with the hover tool
- **kw –
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate the wedges the make up the donut(s) Return type: Chart
Examples:
from bokeh.charts import Donut, show, output_file from bokeh.charts.utils import df_from_json from bokeh.sampledata.olympics2014 import data import pandas as pd # utilize utility to make it easy to get json/dict data converted to a dataframe df = df_from_json(data) # filter by countries with at least one medal and sort by total medals df = df[df['total'] > 8] df = df.sort_values(by="total", ascending=False) df = pd.melt(df, id_vars=['abbr'], value_vars=['bronze', 'silver', 'gold'], value_name='medal_count', var_name='medal') # original example d = Donut(df, label=['abbr', 'medal'], values='medal_count', text_font_size='8pt', hover_text='medal_count') output_file("donut.html") show(d)
HeatMap¶
HeatMap
(data, x=None, y=None, values=None, stat='count', xgrid=False, ygrid=False, hover_tool=True, hover_text=None, **kw)¶Represent 3 dimensions in a HeatMap chart using x, y, and values.
Uses the
HeatMapBuilder
to render the geometry from values.A HeatMap is a 3 Dimensional chart that crosses two dimensions, then aggregates values that correspond to the intersection of the horizontal and vertical dimensions. The value that falls at the intersection is then mapped to a color in a palette by default. All values that map to the positions on the chart are binned by the number of discrete colors in the palette.
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart
- x (str or list(str) – specifies variable(s) to use for x axis
- y (str or list(str) – specifies variable(s) to use for y axis
- values (str, optional) – the values to use for producing the histogram using table-like input data
- stat (str, optional) – the aggregation to use. Defaults to count. If provided None, then no aggregation will be attempted. This is useful for cases when the values have already been aggregated.
- hover_tool (bool, optional) – whether to show the hover tool. Defaults to True
- hover_text (str, optional) – a string to place beside the value in the hover tooltip. Defaults to None. When None, a hover_text will be derived from the aggregation and the values column.
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: a new Chart
Examples:
from bokeh.charts import HeatMap, output_file, show # (dict, OrderedDict, lists, arrays and DataFrames are valid inputs) data = {'fruit': ['apples']*3 + ['bananas']*3 + ['pears']*3, 'fruit_count': [4, 5, 8, 1, 2, 4, 6, 5, 4], 'sample': [1, 2, 3]*3} hm = HeatMap(data, x='fruit', y='sample', values='fruit_count', title='Fruits', stat=None) output_file('heatmap.html') show(hm)
Histogram¶
Histogram
(data, values=None, label=None, color=None, agg='count', bins=None, yscale='linear', xgrid=False, ygrid=True, continuous_range=None, **kw)¶Create a histogram chart with one or more histograms.
Create a histogram chart using
HistogramBuilder
to render the glyphs from input data and specification. This primary use case for the histogram is to depict the distribution of a variable by binning and aggregating the values in each bin.This chart implements functionality to provide convenience in optimal selection of bin count, but also for segmenting and comparing segments of the variable by a categorical variable.
Parameters:
- data (Accepted Charts Data Formats) – the data source for the chart. Must consist of at least 2 values. If all values are equal, the result is a single bin with arbitrary width.
- values (str, optional) – the values to use for producing the histogram using table-like input data
- label (str or list(str) – the categorical variable to use for creating separate histograms
- color (str or list(str) – the categorical variable or color attribute specification to use for coloring the histogram, or explicit color as a string.
- agg (str, optional) – how to aggregate the bins. Defaults to “count”.
- bins (int, optional) – the number of bins to use. Defaults to None to auto select.
- density (bool, optional) – whether to normalize the histogram. Defaults to False.
- **kw –
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate the histograms Return type: Chart
Examples:
from bokeh.charts import Histogram, output_file, show from bokeh.layouts import row from bokeh.sampledata.autompg import autompg as df hist = Histogram(df, values='mpg', title="Auto MPG Histogram", plot_width=400) hist2 = Histogram(df, values='mpg', label='cyl', color='cyl', legend='top_right', title="MPG Histogram by Cylinder Count", plot_width=400) output_file('hist.html') show(row(hist, hist2))
Horizon¶
Horizon
(data=None, x=None, y=None, series=None, **kws)¶Create a horizon chart using
HorizonBuilder
to render the geometry from values.
Parameters:
- data (Accepted Charts Data Formats) – table-like data
- x (str or list(str) – the column label to use for the x dimension
- y (str or list(str) – the column label to use for the y dimension
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate the scatter points Return type: Chart
Examples:
import pandas as pd from bokeh.charts import Horizon, output_file, show # read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) MSFT = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) IBM = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) data = dict([ ('AAPL', AAPL['Adj Close']), ('Date', AAPL['Date']), ('MSFT', MSFT['Adj Close']), ('IBM', IBM['Adj Close'])] ) hp = Horizon(data, x='Date', plot_width=800, plot_height=300, title="horizon plot using stock inputs") output_file("horizon.html") show(hp)
Line¶
Line
(data=None, x=None, y=None, **kws)¶Create a line chart using
LineBuilder
to render the glyphs.The line chart is typically is used with column oriented data, where each column contains comparable measurements and the column names are treated as a categorical variable for differentiating the measurement values. One of the columns can be used as an index for either the x or y axis.
Note
Only the x or y axis can display multiple variables, while the other is used as an index.
Parameters:
- data (list(list) – a 2d data source with columns of data for each line.
- x (str or list(str) – specifies variable(s) to use for x axis
- y (str or list(str) – specifies variable(s) to use for y axis
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Note
This chart type differs on input types as compared to other charts, due to the way that line charts typically are plotting labeled series. For example, a column for AAPL stock prices over time. Another way this could be plotted is to have a DataFrame with a column of stock_label and columns of price, which is the stacked format. Both should be supported, but the former is the expected one. Internally, the latter format is being derived.
Returns: includes glyph renderers that generate the lines Return type: Chart
Examples:
import numpy as np from bokeh.charts import Line, output_file, show # (dict, OrderedDict, lists, arrays and DataFrames are valid inputs) xyvalues = np.array([[2, 3, 7, 5, 26], [12, 33, 47, 15, 126], [22, 43, 10, 25, 26]]) line = Line(xyvalues, title="line", legend="top_left", ylabel='Languages') output_file('line.html') show(line)
Scatter¶
Scatter
(data=None, x=None, y=None, **kws)¶Create a scatter chart using
ScatterBuilder
to render the geometry from values.
Parameters:
- data (Accepted Charts Data Formats) – table-like data
- x (str or list(str) – the column label to use for the x dimension
- y (str or list(str) – the column label to use for the y dimension
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: includes glyph renderers that generate the scatter points Return type: Chart
Examples:
from bokeh.sampledata.autompg import autompg as df from bokeh.charts import Scatter, output_file, show scatter = Scatter(df, x='mpg', y='hp', color='cyl', marker='origin', title="Auto MPG", xlabel="Miles Per Gallon", ylabel="Horsepower") output_file('scatter.html') show(scatter)
Step¶
Step
(data=None, x=None, y=None, **kws)¶Create a step chart using
StepBuilder
to render the geometry from the inputs.Note
Only the x or y axis can display multiple variables, while the other is used as an index.
Parameters:
- data (list(list) – a 2d data source with columns of data for each stepped line.
- x (str or list(str) – specifies variable(s) to use for x axis
- y (str or list(str) – specifies variable(s) to use for y axis
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Note
This chart type differs on input types as compared to other charts, due to the way that series-type charts typically are plotting labeled series. For example, a column for AAPL stock prices over time. Another way this could be plotted is to have a DataFrame with a column of stock_label and columns of price, which is the stacked format. Both should be supported, but the former is the expected one. Internally, the latter format is being derived.
Returns: includes glyph renderers that generate the stepped lines Return type: Chart
Examples:
from bokeh.charts import Step, show, output_file # build a dataset where multiple columns measure the same thing data = dict( stamp=[.33, .33, .34, .37, .37, .37, .37, .39, .41, .42, .44, .44, .44, .45, .46, .49, .49], postcard=[.20, .20, .21, .23, .23, .23, .23, .24, .26, .27, .28, .28, .29, .32, .33, .34, .35] ) # create a step chart where each column of measures receives a unique color and dash style step = Step(data, y=['stamp', 'postcard'], dash=['stamp', 'postcard'], color=['stamp', 'postcard'], title="U.S. Postage Rates (1999-2015)", ylabel='Rate per ounce', legend=True) output_file("steps.html") show(step)
TimeSeries¶
TimeSeries
(data=None, x=None, y=None, builder_type=<class 'bokeh.charts.builders.line_builder.LineBuilder'>, **kws)¶Create a timeseries chart using
LineBuilder
to produce the renderers from the inputs. The timeseries chart acts as a switchboard to produce charts for timeseries data with different glyph representations.
Parameters:
- data (list(list) – a 2d data source with columns of data for each stepped line.
- x (str or list(str) – specifies variable(s) to use for x axis
- y (str or list(str) – specifies variable(s) to use for y axis
- builder_type (str or Builder, optional) – the type of builder to use to produce the renderers. Supported options are ‘line’, ‘step’, or ‘point’.
In addition to the parameters specific to this chart, Chart Defaults are also accepted as keyword parameters.
Returns: a new Chart
Examples:
import pandas as pd from bokeh.charts import TimeSeries, show, output_file from bokeh.layouts import column # read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) MSFT = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=MSFT&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) IBM = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) data = dict( AAPL=AAPL['Adj Close'], Date=AAPL['Date'], MSFT=MSFT['Adj Close'], IBM=IBM['Adj Close'], ) tsline = TimeSeries(data, x='Date', y=['IBM', 'MSFT', 'AAPL'], color=['IBM', 'MSFT', 'AAPL'], dash=['IBM', 'MSFT', 'AAPL'], title="Timeseries", ylabel='Stock Prices', legend=True) tspoint = TimeSeries(data, x='Date', y=['IBM', 'MSFT', 'AAPL'], color=['IBM', 'MSFT', 'AAPL'], dash=['IBM', 'MSFT', 'AAPL'], builder_type='point', title="Timeseries Points", ylabel='Stock Prices', legend=True) output_file("timeseries.html") show(column(tsline, tspoint))
Chart Functions¶
Data Operations¶
-
blend
(*cols, **kwargs)¶ Provides a simple function for specifying a Blend data operation.
Parameters: - cols (str) – each column to use for blending by name
- **kwargs –
the keyword args supported by
Blend
- name (str): name of the column to contain the blended values
- labels_name (str): name of the column to contain the name of the columns used for blending
See
Blend
-
bins
(data, values=None, column=None, bins=None, labels=None, **kwargs)¶ Specify binning or bins to be used for column or values.
Attribute Generators¶
-
color
(columns=None, palette=None, bin=False, **kwargs)¶ Produces a ColorAttr specification for coloring groups of data based on columns.
Parameters: - columns (str or list(str) – a column or list of columns for coloring
- palette (list(str) – a list of colors to use for assigning to unique values in columns.
- **kwargs – any keyword, arg supported by
AttrSpec
Returns: a ColorAttr object
-
marker
(columns=None, markers=None, **kwargs)¶ Specifies detailed configuration for a marker attribute.
Parameters: - columns (list or str) –
- markers (list(str) – a custom list of markers. Must exist within
marker_types
. - **kwargs – any keyword, arg supported by
AttrSpec
Returns: a MarkerAttr object
-
cat
(columns=None, cats=None, sort=True, ascending=True, **kwargs)¶ Specifies detailed configuration for a chart attribute that uses categoricals.
Parameters: - columns (list or str) – the columns used to generate the categorical variable
- cats (list, optional) – overrides the values derived from columns
- sort (bool, optional) – whether to sort the categorical values (default=True)
- ascending (bool, optional) – whether to sort the categorical values (default=True)
- **kwargs – any keyword, arg supported by
AttrSpec
Returns: a CatAttr object
Builders¶
-
class
AreaBuilder
(*args, **kws)¶ This is the Area builder and it is in charge of generating glyph renderers that together produce an area chart.
Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed glyphs (markers) taking the references from the source.
-
glyph
¶ alias of
AreaGlyph
-
-
class
BarBuilder
(*args, **kws)¶ This is the Bar builder and it is in charge of plotting Bar chart (grouped and stacked) in an easy and intuitive way.
Essentially, it utilizes a standardized way to ingest the data, make the proper calculations and generate renderers. The renderers reference the transformed data, which represent the groups of data that were derived from the inputs. We additionally make calculations for the ranges.
The x_range is categorical, and is made either from the label argument or from the pandas.DataFrame.index. The y_range can be supplied as the parameter continuous_range, or will be calculated as a linear range (Range1d) based on the supplied values.
The bar builder is and can be further used as a base class for other builders that might also be performing some aggregation across derived groups of data.
-
glyph
¶ alias of
BarGlyph
-
get_extra_args
()¶
-
set_ranges
()¶ Push the Bar data into the ColumnDataSource and calculate the proper ranges.
-
setup
()¶
-
yield_renderers
()¶ Use the rect glyphs to display the bars.
Takes reference points from data loaded at the ColumnDataSource.
-
agg
¶ property type: agg:Enum(‘sum’, ‘mean’, ‘count’, ‘nunique’, ‘median’, ‘min’, ‘max’)
-
bar_width
¶ property type: bar_width:Float
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e757d0>, 'line_color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75810>, 'group': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e75890>, 'stack': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e75850>, 'label': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e75790>}¶
-
dimensions
= ['values']¶
-
fill_alpha
¶ property type: fill_alpha:Float
-
label_attributes
= ['stack', 'group']¶
-
label_only
¶ property type: label_only:Bool
-
max_height
¶ property type: max_height:Float
-
min_height
¶ property type: min_height:Float
-
values
= <bokeh.charts.properties.Dimension object>¶
-
values_only
¶ property type: values_only:Bool
-
-
class
BoxPlotBuilder
(*args, **kws)¶ Produces Box Glyphs for groups of data.
Handles box plot options to produce one to many boxes, which are used to describe the distribution of a variable.
-
glyph
¶ alias of
BoxGlyph
-
setup
()¶
-
default_attributes
= {'line_color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e89050>, 'outlier_fill_color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75f90>, 'group': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e890d0>, 'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75f50>, 'label': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e75f10>, 'whisker_color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75fd0>, 'stack': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e89090>}¶
-
marker
¶ property type: marker:String
The marker type to use (e.g.,
circle
) if outliers=True.
-
outliers
¶ property type: outliers:Bool
Whether to display markers for any outliers.
-
-
class
ChordBuilder
(*args, **kws)¶ This is the Chord builder and it is in charge of plotting Chord graphs in an easy and intuitive way.
Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed glyphs (markers) taking the references from the source.
-
process_data
()¶
-
set_ranges
()¶
-
setup
()¶
-
yield_renderers
()¶ Use the marker glyphs to display the arcs and beziers. Takes reference points from data loaded at the ColumnDataSource.
-
arcs_data
¶ property type: arcs_data:Instance(ColumnDataSource)
-
connection_data
¶ property type: connection_data:Instance(ColumnDataSource)
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e9e090>, 'marker': <bokeh.charts.attributes.MarkerAttr object at 0x2ab5e9e9e490>, 'stack': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e9e4d0>}¶
-
destination
¶ property type: destination:String
-
dimensions
= ['values']¶
-
label
¶ property type: label:Seq(Any)
-
matrix
¶ property type: matrix:Array(Array(Either(Float, Int)))
-
origin
¶ property type: origin:String
-
square_matrix
¶ property type: square_matrix:Bool
-
text_data
¶ property type: text_data:Instance(ColumnDataSource)
-
value
¶ property type: value:Any
-
values
= <bokeh.charts.properties.Dimension object>¶
-
-
class
DonutBuilder
(*args, **kws)¶ Produces layered donut for hierarchical groups of data.
Handles derivation of chart settings from inputs and assignment of attributes to each group of data.
-
process_data
()¶
-
set_ranges
()¶
-
setup
()¶
-
yield_renderers
()¶
-
agg
¶ property type: agg:String
-
chart_data
¶ property type: chart_data:Instance(ColumnDataSource)
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e93990>, 'stack': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e93a10>, 'label': <bokeh.charts.attributes.CatAttr object at 0x2ab5e9e939d0>}¶
-
dimensions
= ['values']¶
-
level_spacing
¶ property type: level_spacing:Either(Float, List(Float))
-
level_width
¶ property type: level_width:Float
-
line_color
¶ property type: line_color:Color
-
text_data
¶ property type: text_data:Instance(ColumnDataSource)
-
text_font_size
¶ property type: text_font_size:String
-
values
= <bokeh.charts.properties.Dimension object>¶
-
-
class
HeatMapBuilder
(*args, **kws)¶ Assists in producing glyphs required to represent values by a glyph attribute.
Primary use case is to display the 3rd dimension of a value by binning and aggregating as needed and assigning the results to color. This color is represented on a glyph that is positioned by the x and y dimensions.
-
process_data
()¶ Perform aggregation and binning as requried.
-
setup
()¶
-
yield_renderers
()¶ Generate a set fo bins for each group of data.
-
bin_height
¶ property type: bin_height:Float
A derived property that is used to size the glyph in height.
-
bin_width
¶ property type: bin_width:Float
A derived property that is used to size the glyph in width.
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e936d0>}¶
-
dimensions
= ['x', 'y', 'values']¶
-
req_dimensions
= [['x', 'y'], ['x', 'y', 'values']]¶ The heatmap uses color to bin the values and assign discrete colors. The values are sorted descending and assigned to the palette by default.
-
spacing_ratio
¶ property type: spacing_ratio:Float
Multiplied by the bin height and width to shrink or grow the relative size of the glyphs. The closer to 0 this becomes, the amount of space between the glyphs will increase. When above 1.0, the glyphs will begin to overlap.
-
stat
¶ property type: stat:String
The stat to be applied to the values that fall into each x and y intersection. When stat is set to None, then no aggregation will occur.
-
values
= <bokeh.charts.properties.Dimension object>¶
-
-
class
HistogramBuilder
(*args, **kws)¶ Generates one to many histograms with unique attributes.
The HistogramBuilder is responsible for producing a chart containing one to many histograms from table-like inputs.
-
glyph
¶ alias of
HistogramGlyph
-
get_extra_args
()¶ Build kwargs that are unique to the histogram builder.
-
set_ranges
()¶ Push the Bar data into the ColumnDataSource and calculate the proper ranges.
-
setup
()¶
-
bins
¶ property type: bins:Either(List(Float), Int)
If bins is an int, it defines the number of equal-width bins in the given range. If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths.
(default: None, use Freedman-Diaconis rule)
-
density
¶ property type: density:Bool
Whether to normalize the histogram.
If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. If False, the result will contain the number of samples in each bin.
For more info check
HistogramGlyph
documentation.(default: False)
-
-
class
HorizonBuilder
(*args, **kws)¶ Produces glyph renderers representing a horizon chart from many input types.
The builder handles ingesting the data, deriving settings when not provided, building the renderers, then setting ranges, and modifying the chart as needed.
-
glyph
¶ alias of
HorizonGlyph
-
process_data
()¶
-
set_ranges
()¶
-
setup
()¶
-
bins
¶ property type: bins:List(Float)
- The binedges calculated from the number of folds,
- and the maximum value of the entire source data.
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e89650>, 'series': <bokeh.charts.attributes.IdAttr object at 0x2ab5e9e89790>}¶
-
flip_neg
¶ property type: flip_neg:Bool
- When True, the negative values will be
- plotted as their absolute value, then their individual axes is flipped. If False, then the negative values will still be taken as their absolute value, but the base of their shape will start from the same origin as the positive values.
-
fold_height
¶ property type: fold_height:Float
The size of the bin.
-
neg_color
¶ property type: neg_color:Color
The color of the negative folds. (default: “#6495ed”)
-
num_folds
¶ property type: num_folds:Int
The number of folds stacked on top of each other. (default: 3)
-
pos_color
¶ property type: pos_color:Color
The color of the positive folds. (default: “#006400”)
-
series_column
¶ property type: series_column:String
The column that contains the series names.
-
series_count
¶ property type: series_count:Int
Count of the unique series names.
-
-
class
LineBuilder
(*args, **kws)¶ This is the Line class and it is in charge of plotting Line charts in an easy and intuitive way. Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed lines taking the references from the source.
-
column_selector
¶ alias of
NumericalColumnsAssigner
-
glyph
¶ alias of
LineGlyph
-
attr_measurement
(attr_name)¶ Detect if the attribute has been given measurement columns.
-
get_builder_attr
()¶
-
get_id_cols
(stack_flags)¶
-
set_series
(col_name)¶
-
setup
()¶ Handle input options that require transforming data and/or user selections.
-
yield_renderers
()¶
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75090>, 'dash': <bokeh.charts.attributes.DashAttr object at 0x2ab5e9e750d0>, 'marker': <bokeh.charts.attributes.MarkerAttr object at 0x2ab5e9e75110>}¶
-
dimensions
= ['y', 'x']¶
-
measure_input
¶
-
measures
¶
-
series_names
¶ property type: series_names:List(String)
Names that represent the items being plotted.
-
stack
¶ property type: stack:Bool
-
stack_flags
¶
-
-
class
ScatterBuilder
(*args, **kws)¶ This is the Scatter class and it is in charge of plotting Scatter charts in an easy and intuitive way.
Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed glyphs (markers) taking the references from the source.
-
yield_renderers
()¶ Use the marker glyphs to display the points.
Takes reference points from data loaded at the ColumnDataSource.
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75dd0>, 'marker': <bokeh.charts.attributes.MarkerAttr object at 0x2ab5e9e75e90>}¶
-
-
class
ScatterBuilder
(*args, **kws) This is the Scatter class and it is in charge of plotting Scatter charts in an easy and intuitive way.
Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the ranges. And finally add the needed glyphs (markers) taking the references from the source.
-
yield_renderers
() Use the marker glyphs to display the points.
Takes reference points from data loaded at the ColumnDataSource.
-
default_attributes
= {'color': <bokeh.charts.attributes.ColorAttr object at 0x2ab5e9e75dd0>, 'marker': <bokeh.charts.attributes.MarkerAttr object at 0x2ab5e9e75e90>}
-
-
class
StepBuilder
(*args, **kws)¶ This is the Step builder and it is in charge of plotting Step charts in an easy and intuitive way.
Essentially, we provide a way to ingest the data, make the proper calculations and push the references into a source object.
We additionally make calculations for the ranges, and finally add the needed stepped lines taking the references from the source.
-
yield_renderers
()¶
-
Helper Classes¶
Core Classes¶
-
class
Chart
(*args, **kwargs)¶ The main Chart class, the core of the
Bokeh.charts
interface.-
__init__
(*args, **kwargs)¶
-
add_builder
(builder)¶
-
add_labels
(dim, label)¶
-
add_legend
(legends)¶ Add the legend to your plot, and the plot to a new Document.
It also add the Document to a new Session in the case of server output.
Parameters: legends (List(Tuple(String, List(GlyphRenderer) – A list of tuples that maps text labels to the legend to corresponding renderers that should draw sample representations for those labels.
-
add_ranges
(dim, range)¶
-
add_renderers
(builder, renderers)¶
-
add_scales
(dim, scale)¶
-
add_tooltips
(tooltips)¶
-
annular_wedge
(*args, **kwargs)¶ Configure and add AnnularWedge glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the center of the annular wedges. (default None)
- y (DataSpecProperty) – The y-coordinates of the center of the annular wedges. (default None)
- inner_radius (UnitsSpecProperty) – The inner radii of the annular wedges. (default None)
- outer_radius (UnitsSpecProperty) – The outer radii of the annular wedges. (default None)
- start_angle (UnitsSpecProperty) – The angles to start the annular wedges, as measured from the horizontal. (default None)
- end_angle (UnitsSpecProperty) – The angles to end the annular wedges, as measured from the horizontal. (default None)
- direction (BasicProperty) – Which direction to stroke between the start and end angles. (default ‘anticlock’)
Keyword Arguments: - end_angle_units (end_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the annular wedges. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the annular wedges. (default ‘gray’)
- inner_radius_units (inner_radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the annular wedges. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the annular wedges. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the annular wedges. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the annular wedges. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the annular wedges. (default 0)
- line_join (BasicProperty) – The line join values for the annular wedges. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the annular wedges. (default 1)
- name (name – String) : (default None)
- outer_radius_units (outer_radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- start_angle_units (start_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
annulus
(*args, **kwargs)¶ Configure and add Annulus glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the center of the annuli. (default None)
- y (DataSpecProperty) – The y-coordinates of the center of the annuli. (default None)
- inner_radius (UnitsSpecProperty) – The inner radii of the annuli. (default None)
- outer_radius (UnitsSpecProperty) – The outer radii of the annuli. (default None)
Keyword Arguments: - fill_alpha (DataSpecProperty) – The fill alpha values for the annuli. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the annuli. (default ‘gray’)
- inner_radius_units (inner_radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the annuli. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the annuli. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the annuli. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the annuli. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the annuli. (default 0)
- line_join (BasicProperty) – The line join values for the annuli. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the annuli. (default 1)
- name (name – String) : (default None)
- outer_radius_units (outer_radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
arc
(*args, **kwargs)¶ Configure and add Arc glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the center of the arcs. (default None)
- y (DataSpecProperty) – The y-coordinates of the center of the arcs. (default None)
- radius (UnitsSpecProperty) – Radius of the arc. (default None)
- start_angle (UnitsSpecProperty) – The angles to start the arcs, as measured from the horizontal. (default None)
- end_angle (UnitsSpecProperty) – The angles to end the arcs, as measured from the horizontal. (default None)
- direction (BasicProperty) – Which direction to stroke between the start and end angles. (default ‘anticlock’)
Keyword Arguments: - end_angle_units (end_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- line_alpha (DataSpecProperty) – The line alpha values for the arcs. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the arcs. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the arcs. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the arcs. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the arcs. (default 0)
- line_join (BasicProperty) – The line join values for the arcs. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the arcs. (default 1)
- name (name – String) : (default None)
- radius_units (radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- start_angle_units (start_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
asterisk
(*args, **kwargs)¶ Configure and add Asterisk glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
bezier
(*args, **kwargs)¶ Configure and add Bezier glyphs to this Figure.
Parameters: - x0 (DataSpecProperty) – The x-coordinates of the starting points. (default None)
- y0 (DataSpecProperty) – The y-coordinates of the starting points. (default None)
- x1 (DataSpecProperty) – The x-coordinates of the ending points. (default None)
- y1 (DataSpecProperty) – The y-coordinates of the ending points. (default None)
- cx0 (DataSpecProperty) – The x-coordinates of first control points. (default None)
- cy0 (DataSpecProperty) – The y-coordinates of first control points. (default None)
- cx1 (DataSpecProperty) – The x-coordinates of second control points. (default None)
- cy1 (DataSpecProperty) – The y-coordinates of second control points. (default None)
Keyword Arguments: - line_alpha (DataSpecProperty) – The line alpha values for the Bézier curves. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the Bézier curves. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the Bézier curves. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the Bézier curves. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the Bézier curves. (default 0)
- line_join (BasicProperty) – The line join values for the Bézier curves. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the Bézier curves. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
circle
(*args, **kwargs)¶ Configure and add Circle glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
Keyword Arguments: - angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
- angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- radius (UnitsSpecProperty) – The radius values for circle markers (in “data space” units, by default). (default None)
- radius_dimension (BasicProperty) – What dimension to measure circle radii along. (default ‘x’)
- radius_units (radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
circle_cross
(*args, **kwargs)¶ Configure and add CircleCross glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
circle_x
(*args, **kwargs)¶ Configure and add CircleX glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
create_axes
()¶
-
create_grids
(xgrid=True, ygrid=True)¶
-
create_tools
(tools, active_drag, active_scroll, active_tap)¶ Create tools if given tools=True input.
Only adds tools if given boolean and does not already have tools added to self.
-
cross
(*args, **kwargs)¶ Configure and add Cross glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
diamond
(*args, **kwargs)¶ Configure and add Diamond glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
diamond_cross
(*args, **kwargs)¶ Configure and add DiamondCross glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
ellipse
(*args, **kwargs)¶ Configure and add Ellipse glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the centers of the ellipses. (default None)
- y (DataSpecProperty) – The y-coordinates of the centers of the ellipses. (default None)
- width (UnitsSpecProperty) – The widths of each ellipse. (default None)
- height (UnitsSpecProperty) – The heights of each ellipse. (default None)
- angle (UnitsSpecProperty) – The angle the ellipses are rotated from horizontal. [rad] (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the ovals. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the ovals. (default ‘gray’)
- height_units (height_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the ovals. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the ovals. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the ovals. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the ovals. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the ovals. (default 0)
- line_join (BasicProperty) – The line join values for the ovals. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the ovals. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
- width_units (width_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
get_class
(view_model_name)¶ Given a __view_model__ name, returns the corresponding class object
-
image
(*args, **kwargs)¶ Configure and add Image glyphs to this Figure.
Parameters: - image (DataSpecProperty) – The arrays of scalar data for the images to be colormapped. (default None)
- x (DataSpecProperty) – The x-coordinates to locate the image anchors. (default None)
- y (DataSpecProperty) – The y-coordinates to locate the image anchors. (default None)
- dw (UnitsSpecProperty) – The widths of the plot regions that the images will occupy. (default None)
- dh (UnitsSpecProperty) – The height of the plot region that the image will occupy. (default None)
- dilate (BasicProperty) – Whether to always round fractional pixel locations in such a way as to make the images bigger. (default False)
Keyword Arguments: - color_mapper (BasicProperty) – A
ColorMapper
to use to map the scalar data fromimage
into RGBA values for display. (default None) - dh_units (dh_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- dw_units (dw_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
image_rgba
(*args, **kwargs)¶ Configure and add ImageRGBA glyphs to this Figure.
Parameters: - image (DataSpecProperty) – The arrays of RGBA data for the images. (default None)
- x (DataSpecProperty) – The x-coordinates to locate the image anchors. (default None)
- y (DataSpecProperty) – The y-coordinates to locate the image anchors. (default None)
- dw (UnitsSpecProperty) – The widths of the plot regions that the images will occupy. (default None)
- dh (UnitsSpecProperty) – The height of the plot region that the image will occupy. (default None)
- dilate (BasicProperty) – Whether to always round fractional pixel locations in such a way as to make the images bigger. (default False)
Keyword Arguments: - cols (DataSpecProperty) – The numbers of columns in the images (default None)
- dh_units (dh_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- dw_units (dw_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- name (name – String) : (default None)
- rows (DataSpecProperty) – The numbers of rows in the images (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
image_url
(*args, **kwargs)¶ Configure and add ImageURL glyphs to this Figure.
Parameters: - url (DataSpecProperty) – The URLs to retrieve images from. (default None)
- x (DataSpecProperty) – The x-coordinates to locate the image anchors. (default None)
- y (DataSpecProperty) – The y-coordinates to locate the image anchors. (default None)
- w (UnitsSpecProperty) – The widths of the plot regions that the images will occupy. (default None)
- h (UnitsSpecProperty) – The height of the plot region that the image will occupy. (default None)
- angle (UnitsSpecProperty) – The angles to rotate the images, as measured from the horizontal. (default 0)
- global_alpha (BasicProperty) – An overall opacity that each image is rendered with (in addition to any inherent alpha values in the image itself). (default 1.0)
- dilate (BasicProperty) – Whether to always round fractional pixel locations in such a way as to make the images bigger. (default False)
Keyword Arguments: - anchor (BasicProperty) – What position of the image should be anchored at the x, y coordinates. (default ‘top_left’)
- angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- h_units (h_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- name (name – String) : (default None)
- retry_attempts (BasicProperty) – Number of attempts to retry loading the images from the specified URL. Default is zero. (default 0)
- retry_timeout (BasicProperty) – Timeout (in ms) between retry attempts to load the image from the specified URL. Default is zero ms. (default 0)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
- w_units (w_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
inverted_triangle
(*args, **kwargs)¶ Configure and add InvertedTriangle glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
line
(*args, **kwargs)¶ Configure and add Line glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates for the points of the line. (default None)
- y (DataSpecProperty) – The y-coordinates for the points of the line. (default None)
Keyword Arguments: - line_alpha (DataSpecProperty) – The line alpha values for the line. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the line. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the line. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the line. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the line. (default 0)
- line_join (BasicProperty) – The line join values for the line. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the line. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
make_axis
(dim, location, scale, label)¶ Create linear, date or categorical axis depending on the location, scale and with the proper labels.
Parameters: Returns: Axis instance
Return type:
-
make_grid
(dimension, ticker)¶ Create the grid just passing the axis and dimension.
Parameters: - dimension (int) – the dimension of the axis, ie. xaxis=0, yaxis=1.
- ticker (obj) – the axis.ticker object
Returns: Grid instance
Return type:
-
multi_line
(*args, **kwargs)¶ Configure and add MultiLine glyphs to this Figure.
Parameters: - xs (DataSpecProperty) – The x-coordinates for all the lines, given as a “list of lists”. (default None)
- ys (DataSpecProperty) – The x-coordinates for all the lines, given as a “list of lists”. (default None)
Keyword Arguments: - line_alpha (DataSpecProperty) – The line alpha values for the lines. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the lines. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the lines. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the lines. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the lines. (default 0)
- line_join (BasicProperty) – The line join values for the lines. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the lines. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
oval
(*args, **kwargs)¶ Configure and add Oval glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the centers of the ovals. (default None)
- y (DataSpecProperty) – The y-coordinates of the centers of the ovals. (default None)
- width (UnitsSpecProperty) – The overall widths of each oval. (default None)
- height (UnitsSpecProperty) – The overall height of each oval. (default None)
- angle (UnitsSpecProperty) – The angle the ovals are rotated from horizontal. [rad] (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the ovals. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the ovals. (default ‘gray’)
- height_units (height_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the ovals. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the ovals. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the ovals. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the ovals. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the ovals. (default 0)
- line_join (BasicProperty) – The line join values for the ovals. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the ovals. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
- width_units (width_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
patch
(*args, **kwargs)¶ Configure and add Patch glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates for the points of the patch. (default None)
- y (DataSpecProperty) – The y-coordinates for the points of the patch. (default None)
Keyword Arguments: - fill_alpha (DataSpecProperty) – The fill alpha values for the patch. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the patch. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the patch. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the patch. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the patch. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the patch. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the patch. (default 0)
- line_join (BasicProperty) – The line join values for the patch. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the patch. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
patches
(*args, **kwargs)¶ Configure and add Patches glyphs to this Figure.
Parameters: - xs (DataSpecProperty) – The x-coordinates for all the patches, given as a “list of lists”. (default None)
- ys (DataSpecProperty) – The y-coordinates for all the patches, given as a “list of lists”. (default None)
Keyword Arguments: - fill_alpha (DataSpecProperty) – The fill alpha values for the patches. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the patches. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the patches. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the patches. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the patches. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the patches. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the patches. (default 0)
- line_join (BasicProperty) – The line join values for the patches. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the patches. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
quad
(*args, **kwargs)¶ Configure and add Quad glyphs to this Figure.
Parameters: - left (DataSpecProperty) – The x-coordinates of the left edges. (default None)
- right (DataSpecProperty) – The x-coordinates of the right edges. (default None)
- top (DataSpecProperty) – The y-coordinates of the top edges. (default None)
- bottom (DataSpecProperty) – The y-coordinates of the bottom edges. (default None)
Keyword Arguments: - fill_alpha (DataSpecProperty) – The fill alpha values for the quads. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the quads. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the quads. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the quads. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the quads. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the quads. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the quads. (default 0)
- line_join (BasicProperty) – The line join values for the quads. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the quads. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
quadratic
(*args, **kwargs)¶ Configure and add Quadratic glyphs to this Figure.
Parameters: - x0 (DataSpecProperty) – The x-coordinates of the starting points. (default None)
- y0 (DataSpecProperty) – The y-coordinates of the starting points. (default None)
- x1 (DataSpecProperty) – The x-coordinates of the ending points. (default None)
- y1 (DataSpecProperty) – The y-coordinates of the ending points. (default None)
- cx (DataSpecProperty) – The x-coordinates of the control points. (default None)
- cy (DataSpecProperty) – The y-coordinates of the control points. (default None)
Keyword Arguments: - line_alpha (DataSpecProperty) – The line alpha values for the parabolas. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the parabolas. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the parabolas. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the parabolas. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the parabolas. (default 0)
- line_join (BasicProperty) – The line join values for the parabolas. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the parabolas. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
ray
(*args, **kwargs)¶ Configure and add Ray glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates to start the rays. (default None)
- y (DataSpecProperty) – The y-coordinates to start the rays. (default None)
- length (UnitsSpecProperty) – The length to extend the ray. Note that this
length
defaults to screen units. (default None) - angle (UnitsSpecProperty) – The angles in radians to extend the rays, as measured from the horizontal. (default None)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- length_units (length_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the rays. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the rays. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the rays. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the rays. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the rays. (default 0)
- line_join (BasicProperty) – The line join values for the rays. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the rays. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
rect
(*args, **kwargs)¶ Configure and add Rect glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the centers of the rectangles. (default None)
- y (DataSpecProperty) – The y-coordinates of the centers of the rectangles. (default None)
- width (UnitsSpecProperty) – The overall widths of the rectangles. (default None)
- height (UnitsSpecProperty) – The overall heights of the rectangles. (default None)
- angle (UnitsSpecProperty) – The angles to rotate the rectangles, as measured from the horizontal. (default 0.0)
- dilate (BasicProperty) – Whether to always round fractional pixel locations in such a way as to make the rectangles bigger. (default False)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the rectangles. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the rectangles. (default ‘gray’)
- height_units (height_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- line_alpha (DataSpecProperty) – The line alpha values for the rectangles. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the rectangles. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the rectangles. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the rectangles. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the rectangles. (default 0)
- line_join (BasicProperty) – The line join values for the rectangles. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the rectangles. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
- width_units (width_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
segment
(*args, **kwargs)¶ Configure and add Segment glyphs to this Figure.
Parameters: - x0 (DataSpecProperty) – The x-coordinates of the starting points. (default None)
- y0 (DataSpecProperty) – The y-coordinates of the starting points. (default None)
- x1 (DataSpecProperty) – The x-coordinates of the ending points. (default None)
- y1 (DataSpecProperty) – The y-coordinates of the ending points. (default None)
Keyword Arguments: - line_alpha (DataSpecProperty) – The line alpha values for the segments. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the segments. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the segments. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the segments. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the segments. (default 0)
- line_join (BasicProperty) – The line join values for the segments. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the segments. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
show
(*args, **kwargs)¶ Deprecated in Bokeh 0.11; please use bokeh.io.show instead.
-
square
(*args, **kwargs)¶ Configure and add Square glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
square_cross
(*args, **kwargs)¶ Configure and add SquareCross glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
square_x
(*args, **kwargs)¶ Configure and add SquareX glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
start_plot
()¶ Add the axis, grids and tools
-
text
(*args, **kwargs)¶ Configure and add Text glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates to locate the text anchors. (default None)
- y (DataSpecProperty) – The y-coordinates to locate the text anchors. (default None)
- text (DataSpecProperty) – The text values to render. (default ‘text’)
- angle (UnitsSpecProperty) – The angles to rotate the text, as measured from the horizontal. (default 0)
- x_offset (DataSpecProperty) – Offset values to apply to the x-coordinates. (default 0)
- y_offset (DataSpecProperty) – Offset values to apply to the y-coordinates. (default 0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- text_align (BasicProperty) – The text align values for the text. (default ‘left’)
- text_alpha (DataSpecProperty) – The text alpha values for the text. (default 1.0)
- text_baseline (BasicProperty) – The text baseline values for the text. (default ‘bottom’)
- text_color (DataSpecProperty) – The text color values for the text. (default ‘#444444’)
- text_font (BasicProperty) – The text font values for the text. (default ‘helvetica’)
- text_font_size (DataSpecProperty) – The text font size values for the text. (default {‘value’: ‘12pt’})
- text_font_style (BasicProperty) – The text font style values for the text. (default ‘normal’)
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
triangle
(*args, **kwargs)¶ Configure and add Triangle glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
wedge
(*args, **kwargs)¶ Configure and add Wedge glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-coordinates of the points of the wedges. (default None)
- y (DataSpecProperty) – The y-coordinates of the points of the wedges. (default None)
- radius (UnitsSpecProperty) – Radii of the wedges. (default None)
- start_angle (UnitsSpecProperty) – The angles to start the wedges, as measured from the horizontal. (default None)
- end_angle (UnitsSpecProperty) – The angles to end the wedges, as measured from the horizontal. (default None)
- direction (BasicProperty) – Which direction to stroke between the start and end angles. (default ‘anticlock’)
Keyword Arguments: - end_angle_units (end_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the wedges. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the wedges. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the wedges. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the wedges. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the wedges. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the wedges. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the wedges. (default 0)
- line_join (BasicProperty) – The line join values for the wedges. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the wedges. (default 1)
- name (name – String) : (default None)
- radius_units (radius_units – Enum(‘screen’, ‘data’)) : (default ‘data’)
- start_angle_units (start_angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
x
(*args, **kwargs)¶ Configure and add X glyphs to this Figure.
Parameters: - x (DataSpecProperty) – The x-axis coordinates for the center of the markers. (default None)
- y (DataSpecProperty) – The y-axis coordinates for the center of the markers. (default None)
- size (DataSpecProperty) – The size (diameter) values for the markers in screen space units. (default 4)
- angle (UnitsSpecProperty) – The angles to rotate the markers. (default 0.0)
Keyword Arguments: - angle_units (angle_units – Enum(‘deg’, ‘rad’)) : (default ‘rad’)
- fill_alpha (DataSpecProperty) – The fill alpha values for the markers. (default 1.0)
- fill_color (DataSpecProperty) – The fill color values for the markers. (default ‘gray’)
- line_alpha (DataSpecProperty) – The line alpha values for the markers. (default 1.0)
- line_cap (BasicProperty) – The line cap values for the markers. (default ‘butt’)
- line_color (DataSpecProperty) – The line color values for the markers. (default ‘black’)
- line_dash (BasicProperty) – The line dash values for the markers. (default [])
- line_dash_offset (BasicProperty) – The line dash offset values for the markers. (default 0)
- line_join (BasicProperty) – The line join values for the markers. (default ‘miter’)
- line_width (DataSpecProperty) – The line width values for the markers. (default 1)
- name (name – String) : (default None)
- tags (tags – List(Any)) : (default [])
- visible (BasicProperty) – Whether the glyph should render or not. (default True)
Other Parameters: - alpha (float) – an alias to set all alpha keyword args at once
- color (Color) – an alias to set all color keyword args at once
- source (ColumnDataSource) – a user supplied data source
- legend (str) – a legend tag for this glyph
- x_range_name (str) – name an extra range to use for mapping x-coordinates
- y_range_name (str) – name an extra range to use for mapping y-coordinates
- level (Enum) – control the render level order for this glyph
It is also possible to set the color and alpha parameters of a “nonselection” glyph. To do so, prefix any visual parameter with
'nonselection_'
. For example, passnonselection_alpha
ornonselection_fill_alpha
.Returns: GlyphRenderer
-
filename
¶
-
notebook
¶
-
server
¶
-
xlabel
¶ property type: xlabel:String
A label for the x-axis. (default: None)
-
xscale
¶ property type: xscale:Either(Auto, Enum(‘linear’, ‘categorical’, ‘datetime’))
What kind of scale to use for the x-axis.
-
ylabel
¶ property type: ylabel:String
A label for the y-axis. (default: None)
-
yscale
¶ property type: yscale:Either(Auto, Enum(‘linear’, ‘categorical’, ‘datetime’))
What kind of scale to use for the y-axis.
-
-
class
Builder
(*args, **kws)¶ A prototype class to inherit each new chart Builder type.
It provides useful methods to be used by the inherited builder classes, in order to automate most of the charts creation tasks and leave the core customization to specialized builder classes. In that pattern inherited builders just need to provide the following methods:
Required:
yield_renderers()
: yields the glyphs to be rendered into the plot. Here you should call theadd_glyph()
method so that the builder can setup the legend for you.set_ranges()
: setup the ranges for the glyphs. This is called after glyph creation, so you are able to inspect the comp_glyphs for their minimum and maximum values. See thecreate()
method for more information on when this is called and how the builder provides the ranges to the containingChart
using theChart.add_ranges()
method.
Optional:
setup()
: provides an area where subclasses of builder can introspect properties, setup attributes, or change property values. This is called beforeprocess_data()
.process_data()
: provides an area where subclasses of builder can manipulate the source data before renderers are created.
-
__init__
(*args, **kws)¶ Common arguments to be used by all the inherited classes.
Parameters: - data (Accepted Charts Data Formats) – source data for the chart
- legend (str, bool) – the legend of your plot. The legend content is
inferred from incoming input.It can be
top_left
,top_right
,bottom_left
,bottom_right
. It istop_right
is you set it as True.
-
source
¶ obj – datasource object for your plot, initialized as a dummy None.
-
x_range
¶ obj – x-associated datarange object for you plot, initialized as a dummy None.
-
y_range
¶ obj – y-associated datarange object for you plot, initialized as a dummy None.
-
groups
¶ list – to be filled with the incoming groups of data. Useful for legend construction.
-
data
¶ dict – to be filled with the incoming data and be passed to the ChartDataSource for each Builder class.
-
attr
¶ list(AttrSpec – to be filled with the new attributes created after loading the data dict.
-
column_selector
¶ alias of
OrderedAssigner
-
add_glyph
(group, glyph)¶ Add a composite glyph.
Manages the legend, since the builder might not want all attribute types used for the legend.
Parameters: - group (
DataGroup
) – the data the glyph is associated with - glyph (
CompositeGlyph
) – the glyph associated with the group
Returns: None
- group (
-
collect_attr_kwargs
()¶
-
create
(chart=None)¶ Builds the renderers, adding them and other components to the chart.
Parameters: chart ( Chart
, optional) – the chart that will contain the glyph renderers that the Builder produces.Returns: Chart
-
classmethod
generate_help
()¶
-
get_dim_extents
()¶ Helper method to retrieve maximum extents of all the renderers.
Returns: a dict mapping between dimension and value for x_max, y_max, x_min, y_min
-
get_group_kwargs
(group, attrs)¶
-
process_data
()¶ Make any global data manipulations before grouping.
It has to be implemented by any of the inherited class representing each different chart type. It is the place where we make specific calculations for each chart.
Returns: None
-
set_ranges
()¶ Calculate and set the x and y ranges.
It has to be implemented by any of the subclasses of builder representing each different chart type, and is called after
yield_renderers()
.Returns: None
-
setup
()¶ Perform any initial pre-processing, attribute config.
Returns: None
-
yield_renderers
()¶ Generator that yields the glyphs to be draw on the plot
It has to be implemented by any of the inherited class representing each different chart type.
Yields: GlyphRenderer
-
attribute_columns
¶ property type: attribute_columns:List(Column Name or Column String)
All columns used for specifying attributes for the Chart. The Builder will set this value on creation so that the subclasses can know the distinct set of columns that are being used to assign attributes.
-
attributes
¶ property type: attributes:Dict(String, Instance(AttrSpec))
The attribute specs used to group data. This is a mapping between the role of the attribute spec (e.g. ‘color’) and the
AttrSpec
class (e.g.,ColorAttr
). The Builder will use this attributes property during runtime, which will consist of any attribute specs that are passed into the chart creation function (e.g.,Bar
), ones that are created for the user from simple input types (e.g. Bar(..., color=’red’) or Bar(..., color=<column_name>)), or lastly, the attribute spec found in the default_attributes configured for the subclass ofBuilder
.
-
comp_glyph_types
¶ property type: comp_glyph_types:List(Instance(CompositeGlyph))
-
comp_glyphs
¶ property type: comp_glyphs:List(Instance(CompositeGlyph))
A list of composite glyphs, where each represents a unique subset of data. The composite glyph is a helper class that encapsulates all low level
Glyph
, that represent a higher level group of data. For example, theBoxGlyph
is a single class that yields eachGlyphRenderer
needed to produce a Box on aBoxPlot
. The single Box represents a full array of values that are aggregated, and is made up of multipleRect
andSegment
glyphs.
-
default_attributes
= None¶
-
dimensions
= None¶ The dimension labels that must exist to produce the glyphs. This specifies what are the valid configurations for the chart, with the option of specifying the type of the columns. The
ChartDataSource
will inspect this property of your subclass of Builder and use this to fill in any required dimensions if no keyword arguments are used.
-
label_attributes
= []¶ Used to assign columns to dimensions when no selections have been provided. The default behavior is provided by the
OrderedAssigner
, which assigns a single column to each dimension available in the Builder‘s dims property.
-
labels
¶ property type: labels:List(String)
Represents the unique labels to be used for legends.
-
legend_sort_direction
¶ property type: legend_sort_direction:Enum(‘ascending’, ‘descending’)
Sort direction to apply to
sort_legend
. Valid values are: ascending or descending.
-
legend_sort_field
¶ property type: legend_sort_field:String
Attribute that should be used to sort the legend, for example: color, dash, maker, etc. Valid values for this property depend on the type of chart.
-
palette
¶ property type: palette:List(Color)
- Optional input to override the default palette used
- by any color attribute.
-
req_dimensions
= []¶
-
sort_dim
¶ property type: sort_dim:Dict(String, Bool)
-
sort_legend
¶
-
source
¶ property type: source:Instance(ColumnDataSource)
-
tooltips
¶ property type: tooltips:Either(List(Tuple(String, String)), List(String), Bool)
Tells the builder to add tooltips to the chart by either using the columns specified to the chart attributes (True), or by generating tooltips for each column specified (list(str)), or by explicit specification of the tooltips using the valid input for the HoverTool tooltips kwarg.
-
x_range
¶ property type: x_range:Instance(Range)
-
xlabel
¶ property type: xlabel:String
-
xscale
¶ property type: xscale:String
-
y_range
¶ property type: y_range:Instance(Range)
-
ylabel
¶ property type: ylabel:String
-
yscale
¶ property type: yscale:String
-
class
ChartDataSource
(df, dims=None, required_dims=None, selections=None, column_assigner=<class 'bokeh.charts.data_source.OrderedAssigner'>, attrs=None, **kwargs)¶ Validates, normalizes, groups, and assigns Chart attributes to groups.
Supported inputs are:
Array-like: list, tuple,
numpy.ndarray
,pandas.Series
- Table-like:
- records: list(dict)
- columns: dict(list),
pandas.DataFrame
, or blaze resource
Converts inputs that could be treated as table-like data to pandas DataFrame, which is used for assigning attributes to data groups.
-
__init__
(df, dims=None, required_dims=None, selections=None, column_assigner=<class 'bokeh.charts.data_source.OrderedAssigner'>, attrs=None, **kwargs)¶ Create a
ChartDataSource
.Parameters: - df (
pandas.DataFrame
) – the original data source for the chart - dims (List(Str) – list of valid dimensions for the chart.
- required_dims (List(List(Str) – list of list of valid dimensional selections for the chart.
- selections (Dict(dimension, List(Column) – mapping between a dimension and the column name(s) associated with it. This represents what the user selected for the current chart.
- column_assigner (
ColumnAssigner
, optional) – a reference to a ColumnAssigner class, which is used to collect dimension column assignment when keyword arguments aren’t provided. The default value isOrderedAssigner
, which assumes you want to assign each column or array to each dimension of the chart in order that they are received. - attrs (list(str) – list of attribute names the chart uses
- df (
-
apply_operations
()¶ Applies each data operation.
-
static
collect_metadata
(data)¶ Introspect which columns match to which types of data.
-
classmethod
from_arrays
(arrays, column_names=None, **kwargs)¶ Produce
ColumnDataSource
from array-like data.Returns: ColumnDataSource
-
classmethod
from_data
(*args, **kwargs)¶ Automatically handle all valid inputs.
Attempts to use any data that can be represented in a Table-like format, along with any generated requirements, to produce a
ChartDataSource
. Internally, these data types are generated, so that apandas.DataFrame
can be generated.Identifies inputs that are array vs table like, handling them accordingly. If possible, existing column names are used, otherwise column names are generated.
Returns: ColumnDataSource
-
classmethod
from_dict
(data, **kwargs)¶ Produce
ColumnDataSource
from table-like dict.Returns: ColumnDataSource
-
get_selections
(selections, **kwargs)¶ Maps chart dimensions to selections and checks input requirements.
Returns: mapping between each dimension and the selected columns. If no selection is made for a dimension, then the dimension will be associated with None.
-
groupby
(**specs)¶ Iterable of chart attribute specifications, associated with columns.
Iterates over DataGroup, which represent the lowest level of data that is assigned to the attributes for plotting.
Yields: a DataGroup, which contains metadata and attributes assigned to the group of data
-
static
is_array
(data)¶ Verify if data is array-like.
Returns: bool
-
static
is_computed
(column)¶ Verify if the column provided matches to known computed columns.
Returns: bool
-
static
is_datetime
(value)¶ Verifies that value is a valid Datetime type, or can be converted to it.
Returns: bool
-
static
is_list_arrays
(data)¶ Verify if input data is a list of array-like data.
Returns: bool
-
static
is_list_dicts
(data)¶ Verify if data is row-oriented, table-like data.
Returns: bool
-
static
is_number
(value)¶ Verifies that value is a numerical type.
Returns: bool
-
static
is_table
(data)¶ Verify if data is table-like.
Inspects the types and structure of data.
Returns: bool
-
join_attrs
(**attr_specs)¶ Produce new DataFrame from source data and AttrSpec provided.
Parameters: **attr_specs (str, AttrSpec, optional) – pairs of names and attribute spec objects. This is optional and not required only if the ChartDataSource already contains references to the attribute specs. Returns: - a new dataframe that includes a column for each of the
- attribute specs joined in, plus one special column called chart_index, which contains the unique items between the different attribute specs.
Return type: pd.DataFrame
-
setup_derived_columns
()¶ Attempt to add special case columns to the DataFrame for the builder.
-
stack_measures
(measures, ids=None, var_name='variable', value_name='value')¶ De-pivots _data from a ‘wide’ to ‘tall’ layout.
A wide table is one where the column names represent a categorical variable and each contains only the values associated with each unique value of the categorical variable.
This method uses the
pandas.melt()
function with additional logic to make sure that the same data source can have multiple operations applied, and so all other columns are maintained through the stacking process.Example
Note
This example is fairly low level and is not something the typical user should worry about. The interface for data transformations from the user perspective are the Chart Functions.
>>> data = {'a': [1, 2, 3, 4], ... 'b': [2, 3, 4, 5], ... 'month': ['jan', 'jan', 'feb', 'feb'] ... }
>>> ds = ChartDataSource.from_data(data) >>> ds['x'] =['a', 'b'] # say we selected a and b for dimension x
We may want to combine ‘a’ and ‘b’ together. The final data would look like the following:
>>> ds.stack_measures(['c', 'd'], var_name='c_d_variable', ... value_name='c_d_value') >>> ds.df Out[35]: month a_b_variable a_b_value 0 jan a 1 1 jan a 2 2 feb a 3 3 feb a 4 4 jan b 2 5 jan b 3 6 feb b 4 7 feb b 5
The transformed data will use the var_name and value_name inputs to name the columns. These derived columns can then be used as a single column to reference the values and the labels of the data. In the example, I could plot a_b_value vs month, and color by a_b_variable.
What this does for you over the
pandas.melt()
method is that it will apply theDataOperator
for a dimension if it exists (e.g.Blend
, generated byblend()
), and it will try to handle the id columns for you so you don’t lose other columns with the melt transformation.Returns: None
-
attr_specs
¶
-
columns
¶ All column names associated with the data.
Returns: List(Str)
-
df
¶
-
index
¶ The index for the
pandas.DataFrame
data source.
-
source
¶
-
values
¶
-
class
DataGroup
(label, data, attr_specs)¶ Contains subset of data and metadata about it.
The DataGroup contains a map from the labels of each attribute associated with an
AttrSpec
to the value of the attribute assigned to the DataGroup.-
__init__
(label, data, attr_specs)¶ Create a DataGroup for the data, with a label and associated attributes.
Parameters: - label (str) – the label for the group based on unique values of each column
- data (
pandas.DataFrame
) – the subset of data associated with the group - dict (attr_specs) – mapping between attribute name and
the associated
AttrSpec
.
-
get_values
(selection)¶ Get the data associated with the selection of columns.
Parameters: selection (List(Str) – the column or columns selected Returns: pandas.DataFrame
-
to_dict
()¶
-
attributes
¶
-
source
¶ The
ColumnDataSource
representation of the DataFrame.
-
-
class
CompositeGlyph
(**properties)¶ Represents a subset of data.
A collection of hetero or homogeneous glyph renderers which represent a subset of data. The purpose of the composite glyph is to abstract away the details of constructing glyphs, based on the details of a subset of data, from the grouping operations that a generalized builders must implement.
In general, the Builder operates at the full column oriented data source level, segmenting and assigning attributes from a large selection, while the composite glyphs will typically be passed an array-like structures with one or more singular attributes to apply.
Another way to explain the concept is that the Builder operates as the groupby, as in pandas, while the CompositeGlyph operates as the function used in the apply.
- What is the responsibility of the Composite Glyph?
Produce GlyphRenderers
Apply any aggregations
Tag the GlyphRenderers with the group label
- Apply transforms due to chart operations
- Note: Operations require implementation of special methods
-
__init__
(**properties)¶
-
add_chart_index
(data)¶ Add identifier of the data group as a column for each row.
Parameters: data (dict or ColumnDataSource) – can be the type of data used internally to ColumnDataSource, or a ColumnDataSource. Returns: returns the same type of data provided Return type: dict or ColumnDataSource
-
apply_operations
()¶
-
build_renderers
()¶
-
build_source
()¶
-
classmethod
glyph_properties
()¶
-
refresh
()¶ Update the GlyphRenderers.
-
setup
()¶ Build renderers and data source and set sources on renderers.
-
bottom_buffer
¶ property type: bottom_buffer:Float
-
color
¶ property type: color:Color
- A high level color. Some glyphs will
- implement more specific color attributes for parts or specific glyphs.
-
data
¶
-
df
¶
-
fill_alpha
¶ property type: fill_alpha:Float
-
fill_color
¶ property type: fill_color:Color
-
glyphs
¶ property type: glyphs:Dict(String, Any)
-
label
¶ property type: label:Either(String, Dict(String, Any))
Identifies the subset of data.
-
left_buffer
¶ property type: left_buffer:Float
-
line_alpha
¶ property type: line_alpha:Float
-
line_color
¶ property type: line_color:Color
- A default outline color for contained
- glyphs.
-
operations
¶ property type: operations:List(Any)
- A list of chart operations that can be applied to
- manipulate their visual depiction.
-
renderers
¶ property type: renderers:List(Instance(GlyphRenderer))
-
right_buffer
¶ property type: right_buffer:Float
-
source
¶ property type: source:Instance(ColumnDataSource)
- The data source used for the contained
- glyph renderers. Simple glyphs part of the composite glyph might not use the column data source.
-
top_buffer
¶ property type: top_buffer:Float
-
values
¶ property type: values:Either(Column(Float), Column(String))
Array-like values, which are used as the input to the composite glyph.
Most composite glyphs add their own representation of one or more values-like columns/arrays that they receive as inputs. These are compiled together for generating source, data, and df by the individual composite glyphs.
Attribute Specs¶
-
class
AttrSpec
(columns=None, df=None, iterable=None, default=None, items=None, **properties)¶ A container for assigning attributes to values and retrieving them as needed.
A special function this provides is automatically handling cases where the provided iterator is too short compared to the distinct values provided.
Once created as attr_spec, you can do attr_spec[data_label], where data_label must be a one dimensional tuple of values, representing the unique group in the data.
See the
AttrSpec.setup()
method for the primary way to provide an existing AttrSpec with data and column values and update all derived property values.-
__init__
(columns=None, df=None, iterable=None, default=None, items=None, **properties)¶ Create a lazy evaluated attribute specification.
Parameters: - columns – a list of column labels
- df (
DataFrame
) – the data source for the attribute spec. - iterable – an iterable of distinct attribute values
- default – a value to use as the default attribute when no columns are passed
- items – the distinct values in columns. If items is provided as input, then the values provided are used instead of being calculated. This can be used to force a specific order for assignment.
- **properties – other properties to pass to parent
HasProps
-
set_columns
(columns)¶ Set columns property and update derived properties as needed.
-
setup
(data=None, columns=None)¶ Set the data and update derived properties as needed.
-
update_data
(data)¶
-
ascending
¶ property type: ascending:Bool
A boolean flag to tell the attribute specification how to sort items if the sort property is set to True. The default setting for ascending is True.
-
attr_map
¶ property type: attr_map:Dict(Any, Any)
Created by the attribute specification when iterable and data are available. The attr_map will include a mapping between the distinct value(s) found in columns and the attribute value that has been assigned.
-
attrname
¶ property type: attrname:String
Name of the attribute the spec provides.
-
bins
¶ property type: bins:Instance(Bins)
If an attribute spec is binning data, so that we can map one value in the iterable to one value in items, then this attribute will contain an instance of the Bins stat. This is used to create unique labels for each bin, which is then used for items instead of the actual unique values in columns.
-
columns
¶ property type: columns:Either(Column Name or Column String, List(Column Name or Column String))
The label or list of column labels that correspond to the columns that will be used to find all distinct values (single column) or combination of values ( multiple columns) to then assign a unique attribute to. If not enough unique attribute values are found, then the attribute values will be cycled.
-
data
¶ property type: data:Instance(ColumnDataSource)
-
default
¶ property type: default:Any
The default value for the attribute, which is used if no column is assigned to the attribute for plotting. If the default value is not provided, the first value in the iterable property is used.
-
items
¶ property type: items:Any
The attribute specification calculates this list of distinct values that are found in columns of data.
-
iterable
¶ property type: iterable:List(Any)
-
series
¶
-
sort
¶ property type: sort:Bool
A boolean flag to tell the attribute specification to sort items, when it is calculated. This affects which value of iterable is assigned to each distinct value in items.
-
-
class
ColorAttr
(**kwargs)¶ An attribute specification for mapping unique data values to colors.
Note
Should be expanded to support more complex coloring options.
-
add_bin_labels
(data)¶
-
bin
¶ property type: bin:Bool
-
-
class
MarkerAttr
(**kwargs)¶ An attribute specification for mapping unique data values to markers.
-
class
DashAttr
(**kwargs)¶ An attribute specification for mapping unique data values to line dashes.
-
class
CatAttr
(**kwargs)¶ An attribute specification for mapping unique data values to labels.
Note
this is a special attribute specification, which is used for defining which labels are used for one aspect of a chart (grouping) vs another (stacking or legend)
-
get_levels
(columns)¶ Provides a list of levels the attribute represents.
-
Utilities¶
-
df_from_json
(data, rename=True, **kwargs)¶ Attempt to produce
pandas.DataFrame
from hierarchical json-like data.This utility wraps the
pandas.io.json.json_normalize()
function and by default will try to rename the columns produced by it.Parameters: - data (str or list(dict) – a path to json data or loaded json data. This function will look into the data and try to parse it correctly based on common structures of json data.
- (bool, optional (rename) – try to rename column hierarchy to the base name. So medals.bronze would end up being bronze. This will only rename to the base column name if the name is unique, and only if the pandas json parser produced columns that have a ‘.’ in the column name.
- **kwargs – any kwarg supported by
pandas.io.json.json_normalize()
Returns: - a parsed pandas dataframe from the json data, unless the path does not exist,
the input data is nether a list or dict. In that case, it will return None.