Plotly : A new tool for 'Interactive Plotting'



Lets explore a little more about Plotly and Cufflinks libraries we used earlier for geographical mapping. We will see how these libraries can make plotting interactive and more sophisticated.

We will be using the house prices data set we saw in the earlier posts to elicit the beauty of interactive plotting.


As usual, lets import the libraries needed

 
We will be drawing the plots OFFLINE. If you're interested in hosting your graphs online, the approach will be a little different. Check the documentation for more info.



Description:

iplot() offers a ton of parameter to make the graphs more readable and beautiful. Lets see a few parameters we used in the graph shown above.

kind: the type of graph to plot. It could be "hist","surface","spread","bar" etc
mode: only markers like we did above or markers plus lines etc
symbol: shape of the markers
theme: as the name suggests the theme of the graph, we can use "white" if we need a clean graph without any background color.

The best thing about plotly is it gives the user a fine grained access to the graphs. You can select a particular region on the graph and select a frame to focus on that exact portion of graph. The graph below shows the zoomed portion of the above graph focusing on a specific region.



Here is an example of box plots. As you can see, howering over the graph will display the information related to that particular data point or the entire graph itself.


We can save the graphs locally by clicking on the save button shown on the top right corner of the graph, rather than writing the piece of code to save the image. Just makes us more lazy :)


The above graph looks familiar doesn't it? Its like our favorite Seaborn Pair Plot. Looks like the seaborn plot went through an upgrade and came out as a brand new interactive and more beautiful graph.

Comments