The Sweet Spot of Plotly
By: Moorissa Tjokro
Tags: Data Visualization, Data Scientist, Data Science, Plotly, Exploratory Data Analysis

The Sweet Spot of Plotly

Credits: plot.ly

In the past two years working in the tech industry as a data scientist, I have used a variety of exploratory tools to build web apps for both technical and non-technical stakeholders. Plotly, among many others, is a graphing library designed especially for data scientists, engineers, and programmers to easily visualize trends in their data using Python, R, Matlab, or Javascript.

There are definitely other tools out there that can help you plot your data, such as Matplotlib, Seaborn, Bokeh, and even D3 if you want to build a visualization dashboard like those popularized by New York Times web pages.

However, developing fancy web apps comes with the opportunity cost of time to build and a steep learning curve to start. This is the sweet spot that Plotly has over other tools, which makes visualizing data at any scale much easier for data scientists. If you see yourself in many of the following criteria, this tool might be the right one for you.

Why it’s great for data scientists and engineers

Most of data scientists and engineers write in Python. Their roles oftentimes require them to be able to aggregate small and big datasets fluently, to manipulate any kinds of data efficiently, and to work with libraries like Pandas. Plotly allows us to build charts for the web right from Pandas dataframe.

Also, building interactive charts with Javascript (HTML/SVG) can be a steep learning curve for non front-end engineers. Plotly allows for interactive plotting from a commonly used scripting language like Python/R. It’s indeed built on top of d3.js and stack.gl.

Having user interactive visualizations

If you or your clients are looking to have some interactions with your graphs, Plotly might be a good shot to try. Built on top of Plotly JavaScript library (plotly .js), plotly.py enables users to create beautiful interactive web-based visualizations that can be displayed in Jupyter notebooks, saved to standalone HTML files, or served as part of pure Python-built web applications using Dash.

While Seaborn and Matplotlib graphics are static, Plotly charts allow you to hover over values and zoom in/out your graphs, like identifying outliers among a large number of data points or detecting anomalies in time series plots.

Freedom to use as many data sources as you wish

With Plotly, you are not constrained by the layouts specified in your data source — which I oftentimes found to be the case in tools like Tableau. You can easily entangle, transform, or freely assign the code variables as you want.

Platforms like Tableau, Kibana, and Superset offer features such as dropdown that accept only one data table as an input per graph. This makes it hard to do a complex visualization of multiple sources. Plotly, on the other hand, allows for developing charts that involve manipulation and calculation of two or more tables in database.

Flexibility for values transformation

I noticed we could also perform any kinds of arithmetical operations on data columns before visualizing it. A simple example is unit conversion. This is an advantage Plotly has over other tools, since adjusting values of columns using mathematical operations is generally harder or not supported.

Creativity to tell your story with Dash

Flexibility leads to creativity. A major advantage of using Plotly is that it encourages us to be as creative as possible with your visualization since any complex plots only use three main concepts: data, layout, and figure objects. As an engineer, this is probably one of the best things to have as we can build and rebuild graphs in any way we want.

We can also create a dashboard with Plotly Dash, a tool for displaying a collective set of Plotly charts. In my work, I’ve built a number of dashboards that allow teams to understand data trends over different user input.

Cross-filtering features on dashboards are also easily managed using Plotly Dash. While in tools like Metabase, you have to adjust SQL queries to modify multiple graphs at once.

Built-in feature for real-time updates

I remember setting up an automated job in Jenkins or Airflow only to update my graphs in Tableau or Superset. In Plotly, I could simply write a chunk of codes to add the interval feature that automatically activates real-time updates on the background without any external jobs.

Dealing with a huge dataset

It’s not uncommon for data scientists to deal with a huge dataset and millions of rows. Plotly Dash integrates datashader to work with big data visualizations.