Bokeh Charts¶
Bar Chart¶
-
bokeh.
bar
(x, y=None, data_points=100, add_interaction=True, aggregate_fn='count', width=400, height=400, step_size=None, step_size_type=<class 'int'>, **library_specific_params)¶ - Parameters
- x: str
x-axis column name from the gpu dataframe
- y: str, default None
y-axis column name from the gpu dataframe
- data_points: int, default 100
- add_interaction: {True, False}, default True
- aggregate_fn: {‘count’, ‘mean’}, default ‘count’
- width: int, default 400
- height: int, default 400
- step_size: int, default 1
- step_size_type: {int, float}, default int
- x_label_map: dict, default None
label maps for x axis {value: mapped_str}
- y_label_map: dict, default None
label maps for y axis {value: mapped_str}
- title: str,
chart title
- **library_specific_params:
additional library specific keyword arguments to be passed to the function
- Returns
- A bokeh chart object of type vbar
Example¶
import cudf
from cuxfilter import DataFrame
from cuxfilter.charts import bokeh
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
bar_chart_1 = bokeh.bar('key', 'val', data_points=5, add_interaction=False)
d = cux_df.dashboard([bar_chart_1])
#view the individual bar chart part of the dashboard d
bar_chart_1.view()
Line Chart¶
-
bokeh.
line
(x, y=None, data_points=100, add_interaction=True, aggregate_fn='count', width=400, height=400, step_size=None, step_size_type=<class 'int'>, **library_specific_params)¶ - Parameters
- x: str
x-axis column name from the gpu dataframe
- y: str, default None
y-axis column name from the gpu dataframe
- data_points: int, default 100
- add_interaction: {True, False}, default True
- aggregate_fn: {‘count’, ‘mean’}, default ‘count’
- width: int, default 400
- height: int, default 400
- step_size: int, default 1
- step_size_type: {int, float}, default int
- x_label_map: dict, default None
label maps for x axis {value: mapped_str}
- y_label_map: dict, default None
label maps for y axis {value: mapped_str}
- title: str,
chart title
- **library_specific_params:
additional library specific keyword arguments to be passed to the function
- Returns
- A bokeh chart object of type line
Example¶
import cudf
from cuxfilter import DataFrame
from cuxfilter.charts import bokeh
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
line_chart_1 = bokeh.line('key', 'val', data_points=5, add_interaction=False)
d = cux_df.dashboard([line_chart_1])
#view the individual bar chart part of the dashboard d
line_chart_1.view()
Choropleth Chart¶
-
bokeh.
choropleth
(x, y=None, data_points=100, add_interaction=True, aggregate_fn='count', width=800, height=400, step_size=None, step_size_type=<class 'int'>, geoJSONSource=None, geoJSONProperty=None, geo_color_palette=None, tile_provider=None, **library_specific_params)¶ - Parameters
- x: str
x-axis column name from the gpu dataframe
- y: str, default None
y-axis column name from the gpu dataframe
- data_points: int, default 100
- add_interaction: {True, False}, default True
- aggregate_fn: {‘count’, ‘mean’}, default ‘count’
defaults to ‘count’
- width: int, default 800
- height: int, default 400
- step_size: int, default 1
- step_size_type: {int, float}, default int
- x_label_map: dict, default None
label maps for x axis {value: mapped_str}
- y_label_map: dict, default None
label maps for y axis {value: mapped_str}
- geoJSONSource: str
url to the geoJSON file
- geoJSONProperty: str, optional
Property to use while doing aggregation operations using the geoJSON file. Defaults to the first value in properties in geoJSON file.
- geo_color_palette: bokeh.palette, default bokeh.palettes.Inferno256
- nan_color: str, default white
color of the patches of value NaN in the map.
- tile_provider: bokeh.tile_provider object or
cuxfilter.assets.custom_tiles.get_provider object, default None
- title: str,
chart title
- **library_specific_params:
additional library specific keyword arguments to be passed to the function
- Returns
- A bokeh chart object of type choropleth
Example¶
import cudf
from cuxfilter import DataFrame
from cuxfilter.charts import bokeh
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'states': [i for i in range(57)], 'val':[float(i + 10) for i in range(57)]}))
choropleth_chart_1 = bokeh.choropleth(x = 'states', y = 'val', aggregate_fn='mean', data_points=57, add_interaction=False,
geoJSONSource= 'https://eric.clst.org/assets/wiki/uploads/Stuff/gz_2010_us_040_00_500k.json', geoJSONProperty='STATE',
)
d = cux_df.dashboard([choropleth_chart_1])
#view the individual bar chart part of the dashboard d
choropleth_chart_1.view()