IBM  Data Science  Experience

Brunel interactive visualizations in Jupyter notebooks

Data scientists spend a lot of time and effort manipulating data to conform to chart tool requirements, especially when they want to change visualizations.

Brunel Visualization Language is a high-level language developed by IBM and open-sourced in 2015. Brunel describes visualizations in terms of composable actions, and drives a visualization engine (D3) that performs the actual rendering and interactivity. Brunel makes it easy to build fun and inventive visualizations that can be rapidly deployed on the web. Today we are announcing the availability of Brunel in our Jupyter notebooks for Scala and Python, and very soon for R, too.

How does Brunel work?

Brunel provides a novel language that produces interactive data visualizations using pandas.DataFrame objects. The language is well suited for both data scientists and more aggressive business users. The system interprets the language syntax and produces live visualizations directly within Jupyter notebooks.

Load libraries and data
import pandas as pd  
import brunel

cars = pd.read_csv("https://github.com/Brunel-Visualization/Brunel/raw/master/python/examples/data/cars.csv")

cars.head(6)  

Create the visualization

Data defines the pandas.DataFrame object to use. If not specified, the pandas.DataFrame object that best fits the action command will be used. You can specify Width and height to set the resulting size.

%brunel data('cars') x(mpg) y(horsepower) color(origin) filter(horsepower)  :: width=800, height=300

Sample notebooks to get started
Core Features of Brunel
  • Automatically chooses appropriate transforms, mappings, and formatting for your data.
  • Allows multiple combinations of visualization “elements” — overlay points, bars, lines, paths, areas and text — freely and in a coordinated space.
  • Handles building structures for D3 diagram-like hierarchies, treemaps, and chords.
  • Handles data ranges, binning, and stacking automatically.
  • Automatically wraps and fits text, even when animating.
  • Intelligently works out a good layout for the chart aspects, taking the data into account so that you don’t have to guess axis sizes, for example.
  • Provides flexible interactivity including tooltips, pan & zoom, and interactive brushing.
  • Coordinates multiple visualizations in the same space, including interactive brushing.
  • Adds features such as word clouds and paths with smoothly varying size.
  • The data engine is in the Javascript code, so high-speed interactivity works with binning, aggregation, and filtering.

If you want to learn more about Brunel:

I would like to thank Dan Rope and Graham Wills for their great contribution to the Open Source community with Brunel!

Armand Ruiz

Lead Product Manager IBM Data Science Experience & Watson ML

Chicago, IL

Subscribe to IBM Data Science Experience Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!