Python is great for data exploration and data analysis and it’s all thanks to the support of amazing libraries like numpy, pandas, matplotlib, and many others. During our data exploration and data analysis phase it’s very important to understand the data we are dealing with, and for that visual representations of our data can be extremely important.

It is common for us to work on these projects using Jupyter notebooks because they are great, fast, simple and they allow us to interact and play with our data. However there are limitations to what we can do, normally when we work with charts we use libraries like matplotlib, or seaborn, but those libraries render static images of our charts and graphs. But many things get lost in the details, and thus we need to fine-tune our charts just to explore sections of our data. Wouldn’t it be great if we could just interact with our charts by zooming in, adding contextual information to our data points like hover interactions? Here is where Plotly can help us.

Plotly is a python library that makes interactive, publication-quality graphs like line plots, scatter plots, area plots, bar charts, error bars, box plots, histograms, heatmaps, subplots, and much much more.

But we talked enough, let’s start building some charts…


Installing Dependencies

Before we build anything, let’s install dependencies. I like to use pipenv but the same applies to anaconda or other package managers.

Here is the list of dependencies we need

  • jupyter: Web application that allows you to create and share documents that contain live code, equations…. you know it!
  • pandas: Very powerful library for data analysis in general and we will use it in our project to handle our data
  • numpy: Scientific computing for Python, used in our project for math and generating random numbers
  • seaborn: Statistical data visualization based on matplotlib, we will be using it to load some sample data that comes with the library
  • cufflinks: Allows plotly to work with pandas
  • plotly: Interactive charting library

Here are the commands to install them:

pipenv install jupyter
pipenv install plotly cufflinks pandas seaborn numpy

#python #using plotly #interactive data visualization

Interactive Data Visualization Using Plotly And Python
1.15 GEEK