A collection of sloppy snippets for scientific computing and data visualization in Python.

Thursday, December 12, 2013

Multiple axes and subplots in Plotly

Some time ago we have seen how to visualize 2D histograms with Plotly and in this post we will see how to use one of the mostin interesting new features introduced by the Plotly guys: multiple axes into subplots. This features makes us able to couple subplots, so when you zoom or pan in one subplot, it zooms and pans in the other subplots. Just like the graphs produced by D3.
Here's how to plot a subplots matrix where each cell is a scatterplot between the features of the Iris dataset that we already used here.
The first thing we need to do is to convert the data in the format required by the Plotly API:

The result should be as follows:
This interactive graph of the iris data set below was inspired by this wonderful D3 example by Mike Bostock.
Find out more example of Plotly visualizations in Python inside the IPython notebook here.