Bokeh Charts¶
Bar Chart¶
- bokeh.bar(y=None, data_points=None, add_interaction=True, aggregate_fn='count', width=400, height=400, step_size=None, step_size_type=<class 'int'>, title='', autoscaling=True, **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 None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- 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
- title: str,
chart title
- autoscaling: bool,
set whether chart scale is updated automatically for y_axis when data updates
- 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}
- **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
import cuxfilter
cux_df = cuxfilter.DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
bar_chart_1 = cuxfilter.charts.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
#await d.preview()
bar_chart_1.view()
Line Chart¶
- bokeh.line(y=None, data_points=None, add_interaction=True, aggregate_fn='count', width=400, height=400, step_size=None, step_size_type=<class 'int'>, title='', autoscaling=True, **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 None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- 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
- title: str,
chart title
- autoscaling: bool,
set whether chart scale is updated automatically for y_axis when data updates
- 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}
- **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
import cuxfilter
cux_df = cuxfilter.DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
line_chart_1 = cuxfilter.charts.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
#await d.preview()
line_chart_1.view()