Bearcart.Chart

Generate a Rickshaw time series visualization with Pandas Series and DataFrames.

The bearcart Chart generates the Rickshaw visualization of a Pandas timeseries Series or DataFrame. The only required parameters are data, width, height, and type. Colors is an optional parameter; bearcart will default to the Rickshaw spectrum14 color palette if none are passed. Keyword arguments can be passed to disable the following components:

  • x_axis
  • y_axis
  • hover
  • legend
class bearcart.Chart(data=None, width=750, height=400, plt_type='line', colors=None, x_time=True, y_zero=False, **kwargs)

Visualize Pandas Timeseries with Rickshaw.js

create_chart(html_path='index.html', data_path='data.json', js_path='rickshaw.min.js', css_path='rickshaw.min.css', html_prefix='')

Save bearcart output to HTML and JSON.

html_path: string, default ‘index.html’
Path for html output
data_path: string, default ‘data.json’
Path for data JSON output
js_path: string, default ‘rickshaw.min.js’
If passed, the Rickshaw javascript library will be saved to the path. The file must be named “rickshaw.min.js”
css_path: string, default ‘rickshaw.min.css’
If passed, the Rickshaw css library will be saved to the path. The file must be named “rickshaw.min.css”
html_prefix: Prefix path to be appended to all the other paths for file
creation, but not in the generated html file. This is needed if the html file does not live in the same folder as the running python script.

HTML, JSON, JS, and CSS

>>>vis.create_chart(html_path=’myvis.html’, data_path=’visdata.json’),
js_path=’rickshaw.min.js’, cs_path=’rickshaw.min.css’)
display()

Display the visualization inline in the IPython notebook.

This is deprecated, use the following instead:

from IPython.display import display
display(viz)
transform_data(data)

Transform Pandas Timeseries into JSON format

data: DataFrame or Series
Pandas DataFrame or Series must have datetime index

JSON to object.json_data

>>>vis.transform_data(df) >>>vis.json_data