vislib package

Submodules

vislib.taucharts module

vislib.taucharts.chart(data, x, y, color=None, title=None, width=800, height=400, **options)

Renders a basic taucharts chart with the given data. See https://www.taucharts.com/

>>> from vislib.taucharts import chart
>>> chart([{'item': 'car', 'amount': 1},
>>>        {'item': 'book', 'amount': 10},
>>>        {'item': 'bed', 'amount': 3}], x='item', y='amount', title='Taucharts example')
Parameters:
  • data – a pandas DataFrame or list of dictionaries that specify the data to visualize
  • x – the field to map as the x coordinate
  • y – the field to map as the y coordinate
  • color – the field to map to the color of the datapoints
  • title – A title to assign to your timeline view, this will be the filename of the saved html file on disk
  • width
  • height
  • options – Additional options to pass as the chart definition (See https://api.taucharts.com/basic/index.html) Some common options include * type: scatterplot, line, bar, horizontalBar, stacked-bar, stacked-area * size: field to map to the size of a node * dimensions: allows setting custom axis labels and types * guide: allows customizing visual elements of the chart presentation
Returns:

in ipython, a visualized chart, otherwise None, but triggers opening your default browser with the generated file

vislib.treant module

vislib.treant.tree(data, title=None, width=800, height=400, styling='', **options)

Renders a Treant.js tree. See http://fperucic.github.io/treant-js/

Example:
>>> from vislib.treant import tree
>>> tree({
>>>         'text': { 'name': "Parent node" },
>>>         'children': [{
>>>             'text': { 'name': "First child" }
>>>         },{
>>>             'text': { 'name': "Second child" }
>>>         }]
>>>     })
Parameters:
  • data – A dict in the json format specified for treant.
  • title – A title to assign to your timeline view, this will be the filename of the saved html file on disk
  • width
  • height
  • styling – Custom raw css to apply to the chart
  • options – Additional chart options for the treant tree
Returns:

in ipython, a visualized tree, otherwise None, but triggers opening your default browser with the generated file

vislib.visjs module

vislib.visjs.timeline(data, content_field='contents', start_field='start', end_field=None, type_field=None, group_field=None, title=None, width=600, height=400, **options)

Renders a vis.js timeline component (See http://visjs.org/docs/timeline/ for more information)

Example:
>>> from vislib.visjs import timeline
>>> timeline([{'text': 'first item', 'start': '2018-05-21 17:30:08.202'},
>>>           {'text': 'second item', 'start': "2018-05-21 17:31:53.712"},
>>>           {'text': 'third item', 'start': "2018-05-21 18:14:05.843"}], content_field='text', title='example1')
Parameters:
  • data – a pandas DataFrame or list of dictionaries that specify the data to visualize
  • content_field – the field representing the textual contents of each timeline node
  • start_field – the field representing the start time (as a date or string) of each timeline node
  • end_field – the field representing the end time of each timeline node
  • type_field – the field representing the type of node. Can be ‘box’, ‘point’ (default), ‘range’, or ‘background’
  • group_field – the field representing the group name to assign the timeline node to. Groups appear as swimlanes in the timeline view if they exist
  • title – A title to assign to your timeline view, this will be the filename of the saved html file on disk
  • height
  • width
  • options – Additional options to specify for the timeline. See http://visjs.org/docs/timeline/#Configuration_Options
Returns:

in ipython, a visualized timeline, otherwise None, but triggers opening your default browser with the generated file

Module contents