Create an area chart using the AreaBuilder to render the geometry from values.
Parameters: |
|
---|
Returns: | a new Chart |
---|
Examples
from bokeh.charts import Area, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
xyvalues = dict(
python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120],
pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110],
jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139],
)
area = Area(
xyvalues, title="Area Chart", xlabel='time', legend=True,
ylabel='memory', stacked=True,
)
output_file('area.html')
show(area)
Create a Bar chart using BarBuilder render the geometry from values, cat and stacked.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples
from collections import OrderedDict
from bokeh.charts import Bar, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
xyvalues = OrderedDict()
xyvalues['python']=[-2, 5]
xyvalues['pypy']=[12, 40]
xyvalues['jython']=[22, 30]
cat = ['1st', '2nd']
bar = Bar(xyvalues, cat, title="Stacked bars",
xlabel="category", ylabel="language")
output_file("stacked_bar.html")
show(bar)
Create a BoxPlot chart using BoxPlotBuilder to render the geometry from values, marker and outliers arguments.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
import numpy as np
from bokeh.charts import BoxPlot, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames of arrays are valid inputs)
medals = dict([
('bronze', np.array([7.0, 10.0, 8.0, 7.0, 4.0, 4.0, 1.0, 5.0, 2.0, 1.0,
4.0, 2.0, 1.0, 2.0, 4.0, 1.0, 0.0, 1.0, 1.0, 2.0,
0.0, 1.0, 0.0, 0.0, 1.0, 1.0])),
('silver', np.array([8., 4., 6., 4., 8., 3., 3., 2., 5., 6.,
1., 4., 2., 3., 2., 0., 0., 1., 2., 1.,
3., 0., 0., 1., 0., 0.])),
('gold', np.array([6., 6., 6., 8., 4., 8., 6., 3., 2., 2., 2., 1.,
3., 1., 0., 5., 4., 2., 0., 0., 0., 1., 1., 0., 0.,
0.]))
])
boxplot = BoxPlot(medals, marker="circle", outliers=True, title="boxplot",
xlabel="medal type", ylabel="medal count")
output_file('boxplot.html')
show(boxplot)
Creates a Donut chart using DonutBuilder to render the geometry from values and cat.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from bokeh.charts import Donut, output_file, show
# dict, OrderedDict, lists, arrays and DataFrames are valid inputs
xyvalues = [[2., 5., 3.], [4., 1., 4.], [6., 4., 3.]]
donut = Donut(xyvalues, ['cpu1', 'cpu2', 'cpu3'])
output_file('donut.html')
show(donut)
Create a dot chart using DotBuilder to render the geometry from values and cat.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from collections import OrderedDict
from bokeh.charts import Dot, output_file, show
# dict, OrderedDict, lists, arrays and DataFrames are valid inputs
xyvalues = OrderedDict()
xyvalues['python']=[2, 5]
xyvalues['pypy']=[12, 40]
xyvalues['jython']=[22, 30]
dot = Dot(xyvalues, ['cpu1', 'cpu2'], title='dots')
output_file('dot.html')
show(dot)
Create a HeatMap chart using HeatMapBuilder to render the geometry from values.
Parameters: | values (iterable) – iterable 2d representing the data series values matrix. |
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from collections import OrderedDict
from bokeh.charts import HeatMap, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
xyvalues = OrderedDict()
xyvalues['apples'] = [4,5,8]
xyvalues['bananas'] = [1,2,4]
xyvalues['pears'] = [6,5,4]
hm = HeatMap(xyvalues, title='Fruits')
output_file('heatmap.html')
show(hm)
Create a histogram chart using HistogramBuilder to render the geometry from values, bins, sigma and density.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
import pandas as pd
from bokeh.charts import Histogram, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
xyvalues = pd.DataFrame(dict(normal=[1, 2, 3, 1], lognormal=[5, 4, 4, 1]))
hm = Histogram(xyvalues, bins=5, title='Histogram')
output_file('histogram.html')
show(hm)
Create a Horizon chart using HorizonBuilder render the geometry from values, index and num_folds.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
import datetime
from collections import OrderedDict
from bokeh.charts import Horizon, output_file, show
now = datetime.datetime.now()
dts = [now+datetime.timedelta(seconds=i) for i in range(10)]
xyvalues = OrderedDict({'Date': dts})
y_python = xyvalues['python'] = [2, 3, 7, 5, 26, 27, 27, 28, 26, 20]
y_pypy = xyvalues['pypy'] = [12, 33, 47, 15, 126, 122, 95, 90, 110, 112]
y_jython = xyvalues['jython'] = [22, 43, 10, 25, 26, 25, 26, 45, 26, 30]
hz = Horizon(xyvalues, index='Date', title="Horizon Example", ylabel='Sample Data', xlabel='')
output_file('horizon.html')
show(hz)
Create a line chart using LineBuilder to render the geometry from values and index.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new 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)
Create a scatter chart using ScatterBuilder to render the geometry from values.
Parameters: | values (iterable) – iterable 2d representing the data series values matrix. |
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from collections import OrderedDict
from bokeh.charts import Scatter, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames of (x, y) tuples are valid inputs)
xyvalues = OrderedDict()
xyvalues['python'] = [(1, 2), (3, 3), (4, 7), (5, 5), (8, 26)]
xyvalues['pypy'] = [(1, 12), (2, 23), (4, 47), (5, 15), (8, 46)]
xyvalues['jython'] = [(1, 22), (2, 43), (4, 10), (6, 25), (8, 26)]
scatter = Scatter(xyvalues, title="Scatter", legend="top_left", ylabel='Languages')
output_file('scatter.html')
show(scatter)
Create a step chart using StepBuilder render the geometry from values and index.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from collections import OrderedDict
from bokeh.charts import Step, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
xyvalues = [[2, 3, 7, 5, 26], [12, 33, 47, 15, 126], [22, 43, 10, 25, 26]]
step = Step(xyvalues, title="Steps", legend="top_left", ylabel='Languages')
output_file('step.html')
show(step)
Create a timeseries chart using TimeSeriesBuilder to render the lines from values and index.
Parameters: |
|
---|
In addition the the parameters specific to this chart, Generic arguments are also accepted as keyword parameters.
Returns: | a new Chart |
---|
Examples:
from collections import OrderedDict
import datetime
from bokeh.charts import TimeSeries, output_file, show
# (dict, OrderedDict, lists, arrays and DataFrames are valid inputs)
now = datetime.datetime.now()
delta = datetime.timedelta(minutes=1)
dts = [now + delta*i for i in range(5)]
xyvalues = OrderedDict({'Date': dts})
y_python = xyvalues['python'] = [2, 3, 7, 5, 26]
y_pypy = xyvalues['pypy'] = [12, 33, 47, 15, 126]
y_jython = xyvalues['jython'] = [22, 43, 10, 25, 26]
ts = TimeSeries(xyvalues, index='Date', title="TimeSeries", legend="top_left",
ylabel='Languages')
output_file('timeseries.html')
show(ts)
The main Chart class, the core of the Bokeh.charts interface.
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. |
---|
Chained method for filename option.
Given a __view_model__ name, returns the corresponding class object
Chained method for height option.
Chained method for id option.
Chained method for legend option.
Create linear, date or categorical axis depending on the location, scale and with the proper labels.
Parameters: |
|
---|---|
Returns: | Axis instance |
Return type: | axis |
Create the grid just passing the axis and dimension.
Parameters: |
|
---|---|
Returns: | Grid instance |
Return type: | grid |
Chained method for notebook option.
Chained method for server option.
Main show function.
It shows the plot in file, server and notebook outputs.
Add the axis, grids and tools
Chained method for width option.
Chained method for xgrid option.
Chained method for xlabel option.
Chained method for xscale option.
Chained method for ygrid option.
Chained method for ylabel option.
Chained method for yscale option.
Adapter object used to normalize Charts inputs to a common interface. Supported inputs are dict, list, tuple, np.ndarray and pd.DataFrame.
Parse values (that must be one of the DataAdapter supported input types) and create an separate/create index and data depending on values type and index.
Parameters: | values (iterable) – container that holds data to be plotted using on the Chart classes |
---|---|
Returns: | iterable that represents the data index values: iterable containing the values to be plotted |
Return type: | xs |
This is the Area class and it is in charge of plotting Area chart in an easy and intuitive way.
Essentially, it provides 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 (patch) taking the references from the source.
property type: Any
An index to be used for all data series as follows:
series common index
mapping to be used as index (and not as data series) if area.values is a mapping (like a dict, an OrderedDict or a pandas DataFrame)
This is the Bar class and it is in charge of plotting Bar chart (grouped and stacked) in an easy and intuitive way.
Essentially, it provides 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 (rects) taking the references from the source.
The x_range is categorical, and is made either from the cat argument or from the indexes of the passed values if no cat is supplied. 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 using the following rules:
- with all positive data: start = 0, end = 1.1 * max
- with all negative data: start = 1.1 * min, end = 0
- with mixed sign data: start = 1.1 * min, end = 1.1 * max
This is the BoxPlot class and it is in charge of plotting scatter plots 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 (rects, lines and markers) taking the references from the source.
Set a new attr and then get it to fill the self._data dict.
Keep track of the attributes created.
Parameters: |
|
---|
This is the Donut class and it is in charge of plotting Donut chart in an easy and intuitive way.
Essentially, it provides a way to ingest the data, make the proper calculations and push the references into a source object. We additionally make calculations for the donut slices and angles. And finally add the needed glyphs (Wedges and AnnularWedges) taking the references from the source.
Draw the descriptions to be placed on the central part of the donut wedge
Draw the central part of the donut wedge from donut.source and its calculated start and end angles.
Draw the external part of the donut wedge from donut.source and its related descriptions
Essentially, it provides 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 (segments and circles) taking the references from the source.
This is the HeatMap class and it is in charge of plotting HeatMap chart in an easy and intuitive way.
Essentially, it provides 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 (rects) taking the references from the source.
This is the Histogram class and it is in charge of plotting histograms 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 (quads and lines) taking the references from the source.
property type: Bool
Whether to normalize the histogram. (default: True)
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 numpy.histogram function documentation.
This is the Horizon class and it is in charge of plotting Horizon charts in an easy and intuitive way.
Essentially, we provide a way to ingest the data, separate the data into a number of folds which stack on top of each others. We additionally make calculations for the ranges. And finally add the needed lines taking the references from the source.
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.
property type: Any
An index to be used for all data series as follows:
series common index
mapping to be used as index (and not as data series) if area.values is a mapping (like a dict, an OrderedDict or a pandas DataFrame)
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.
Parse data received from self._values and create correct x, y series values checking if input is a pandas DataFrameGroupBy object or one of the stardard supported types (that can be converted to a DataAdapter)
This is the Step class 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 lines taking the references from the source.
property type: Any
An index to be used for all data series as follows:
series common index
mapping to be used as index (and not as data series) if area.values is a mapping (like a dict, an OrderedDict or a pandas DataFrame)
This is the TimeSeries class and it is in charge of plotting TimeSeries 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.
property type: Any
An index to be used for all data series as follows:
series common index
mapping to be used as index (and not as data series) if area.values is a mapping (like a dict, an OrderedDict or a pandas DataFrame)