Python Visualization Plotting Libraries Every Data Scientist Should Know About

Est. Reading Time: 10 mins

There are dozens of great python libraries and tools available to Data Scientists that want to create engaging plot and graph visualizations.

From the old guard like Matplotlib to the beautifully crafted newer entrants like PlotAPI, each has unique capabilities, syntax, flexibility, and levels of interactivity.

We think there are seven python libraries in particular that every Data Scientist should know about: Matplotlib, Seaborn, Folium, Bokeh, Plotly, Altair, and PlotAPI.

Choosing the right one depends mainly on what features and capabilities you need and your experience level.

Read on to dig deeper into each library, visualize it, and get the tl;dr on its pros and cons. You'll get all the info you need to select the best library for your next python visualization project.

Interactive data visualization is more engaging

Interactive data visualization is more engaging for stakeholders, without a doubt. But interactive plots can take more time to create.

Decide how interactive you want your plots to be because it will affect the framework you choose.

For instance, Matplotlib and Seaborn are suitable for creating static visualizations that effectively explain concepts in a presentation, paper, or slide deck.

Great to move quickly and get a report or app published and shared, albeit less likely to wow your audience.

On the other hand, Altair, Bokeh, PlotAPI, and Plotly allow for the creation of highly interactive graphs that enable users to explore the data for themselves.

Great to get something beautiful into the hands of your stakeholders, but it may take slightly longer.

Syntax and flexibility matter

You also need to know the syntax of each library and how it aligns with your data and use case.

Lower-level libraries like Matplotlib offer a lot of flexibility, but the API may be more verbose.

On the other hand, libraries like Altair and Seaborn offer more declarative syntax, making it easier to map your data to the visualization.

Select a library aligned with your use case

If you have a specialized use case, like a geographical plot or large data, or a specific plot type, you may want a library tailored to those needs.

For example, Folium is specifically designed for creating geographical plots.

Libraries such as Bokeh and Plotly offer a wide range of plot types and are good for unique visualization needs.

Libraries like PlotAPI supercharge your visuals even more, adding an extra layer of quality to your report or app.

Don't forget the delivery method

When you've chosen a library and built your visualizations, remember to think carefully about how you deliver those insights to colleagues or stakeholders.

Downloading a report as a PDF or screenshotting your notebook is not only underwhelming, but you also lose interactivity and visual quality.

Exporting to HTML, even if you strip your notebook of the code, is better - but you'll need to update it every time you make a change.

Tools like Streamlit and Dash can be great for building and sharing interactive python analysis as a web app but might require learning new skills.

Whilst Datapane lets you convert any notebook into a beautiful, shareable, interactive app from inside Jupyter.

Remember this last step. The format your visualization takes is often as important as the library!

Altair‍

Altair is a declarative statistical visualization library for Python. 

Altair's design means that users can create visualizations by simply "declaring" the links between data columns and visualizations without needing to write complex plotting commands.

Its API is simple, friendly, consistent, and built on top of the powerful Vega-Lite visualization grammar, so it's great for producing beautiful and compelling visualizations with minimal code.

Altair Examples
Examples from Altair

Pros ✅

  • Its declarative design makes it relatively easy to create visualizations with minimal code
  • As it's built on top of the Vega-Lite grammar, it's powerful and flexible
  • It supports various visualizations, from bar and line charts to more complex plots like scatter plots with multiple axes and faceting
  • It has several compound plot types that allow you to overlay two different charts on the same set of axes

Cons ❌

  • Altair is still a relatively new library, so it may have less community support or fewer third-party packages and extensions than other popular libraries
  • Users may need to learn the underlying Vega-Lite system to fully utilize it
  • By default, Altair does not support the visualization of large datasets
  • Altair does not support 3D plots

Installing Altair

You can install Altair using:

$ pip install altair vega_datasets
$ conda install -c conda-forge altair vega_datasets

See it in action

We built a simple visualization using Altair and Datapane. See its documentation to get started.

Bokeh

Bokeh is a browser-optimized data visualization library for Python that enables users to create interactive, web-based plots and charts.

It has an intuitive API, plots can be interactive, and users can apply themes to easily control the appearance of simple plots or complex, multi-layered visualizations. 

Because it's built for web browsers and easily customizable, it's a good tool for creating interactive visualizations that can be easily shared with others.

Bokeh Examples
Examples from Bokeh

Pros ✅

  • Visualizations can be linked to real-time data streams, allowing users to create dynamic dashboards
  • It supports complex, multi-layered visualizations and interactive elements such as zooming, filtering, and tooltips
  • It works well with popular libraries: pandas and NumPy

Cons ❌

  • Bokeh is less well-known and widely used than other Python libraries, such as Matplotlib or Seaborn, so less community support may be available
  • It’s also relatively new, so it may have fewer features as more established and well-tested libraries
  • Because of its browser-based design, there may be better choices for creating static plots or charts that will be included print or other non-interactive formats
  • To create more advanced visualizations, users need to know HTML and JavaScript, which may be a barrier for some

Installing Bokeh

You can install Bokeh using:

$ pip install bokeh
$ conda install bokeh

See it in action

We built a simple visualization using Bokeh and Datapane. See its documentation to get started.

PlotAPI

PlotAPI is software that lets you turn your data into engaging, beautiful, and interactive visualizations.

The power of PlotAPI can be accessed directly through the API if you’re a coder or using the friendly APP if you prefer not to code. 

PlotAPI is designed to be “Beautiful by Default” - a head-turning visualization is only a single click or line of code away.

PlotAPI examples
Examples from PlotAPI

Pros ✅

  • Beautiful and interactive takes on popular visualizations such as Chord, Sankey, and Heatmaps. Easy creation of Pie, Bar, and Line Chart Races. Innovative and unique visualizations such as the Pareto Front and Terminus visualizations
  • Multiple formats are supported, with PNG, PDF, SVG, MP4, and HTML export options. The ability to save locally or upload and share privately or publicly
  • Generate visualizations through the API from Python, Rust, and more with the REST API. Super-charge your notebooks with inline visualizations!

Cons ❌

  • PlotAPI visualizations are designed to be beautiful and interactive - this means they’re not ideal for print publications
  • It's a premium service and requires a subscription

See PlotAPI in action

We built a simple visualization using PlotAPI and Datapane. To start using PlotAPI yourself, see its documentation.

Folium

Folium is a mapping data visualization library that utilizes Leaflet.js in its design and is particularly useful for visualizing and analyzing data on a geographic scale.

Its easy-to-add markers, plugins, and customization options make it a great option for creating maps or visualizing geographic data.

Folium Examples
Examples from Folium

Pros ✅

  • Folium has several built-in tilesets from platforms like OpenStreetMaps, Stamen, and Mapbox, allowing users to easily customize maps
  • It has a variety of plugins that allow users to increase the functionality of maps
  • It's straightforward to use

Cons ❌

  • While Folium is easy to use for many tasks, it can be more complex to handle shapefiles, which often requires additional programming knowledge

Installing Folium

You can install Folium using:

$ pip install folium
$ conda install folium -c conda-forge

See it in action

We built a simple visualization using Folium and Datapane. To start using it yourself, see its documentation.

Plotly

Plotly is a powerful library that allows users to create various dynamic and interactive plots, charts, and graphics that are publication-quality.

As a result, it is widely used for handling financial, statistical, and scientific data and is particularly popular for its appealing visuals.

Plotly’s API functions are effective in local and browser modes, making it easy to use in various environments.

Plotly
Examples from Plotly

Pros ✅

  • Plotly has a wide range of chart and plot types: 40+ unique chart and plot types, including contour plots, dimension chars, and dendrograms.
  • Its graphics are publication-quality
  • It’s been around for a long time, so its relatively easy to find community discussions, issues, and guides on how to do something
  • It has good interactivity

Cons ❌

  • You'll find outdated documentation everywhere. Finding solutions or answers that work on the version you're on can be hard
  • Deeper customizations are tricky to pull off with Plotly and will mean searching through Plotly internals or finding some obscure forum thread from years ago for a hacky solution
  • Plotly supports many visualizations, which is great, but they all look a little basic. You're unlikely to describe any of them as "beautiful"

Installing Plotly

You can install Plotly using:

$ pip install plotly
$ conda install -c plotly plotly=5.11.0

See it in action

We built a simple visualization using Plotly and Datapane. To start using it yourself, see its documentation.

Matplotlib

Matplotlib is one of Python's most widely-used libraries for creating static and animated plots.

It's simple, flexible, and a great starting point for data visualization in Python, but it's limited for more advanced visualizations. 

You can't write a list of the "top" visualization libraries without including this workhorse. 

Matplotlib
Examples from Matplotlib

Pros ✅

  • One of its main strengths is its flexibility and customizability. It allows users to create a wide range of plots and customize almost every aspect of their appearance
  • Matplotlib is popular because it's simple. It has a straightforward API that is easy to learn and use, making it a good choice for beginners
  • It integrates well with other libraries like NumPy and pandas

Cons ❌

  • Matplotlib's visualizations can be difficult to explore and understand data
  • Whilst it is possible to make interactive visualizations with Matplotlib, they're not great quality compared to other libraries
  • It can also be slower than some other libraries for creating visualizations, especially for very large datasets

Installing Matplotlib

You can install Matplotlib using:

$ pip install matplotlib
$ conda install matplotlib

See it in action

We built a simple visualization using Matplotlib and Datapane. To start using it yourself, see its documentation.

Seaborn

Seaborn is a visualization library built on Matplotlib. It provides more attractive visualizations than its parent package. 

Seaborn is better for more advanced statistical plots, whilst Matplotlib has a lower learning curve.

Neither do interactive visualizations particularly well.

Seaborn Examples
Examples from Seaborn

Pros ✅

  • One of the main strengths of Seaborn is its default styling and color palettes, which make it easy to create visually appealing plots with minimal effort
  • It works well with Pandas DataFrames, which are a common way of storing and manipulating data in Python
  • It provides functions for plotting data directly from DataFrames, and for using DataFrame metadata to improve the style and layout of plots

Cons ❌

  • Whilst it is also possible to make interactive visualizations with Seaborn, they’re not great quality compared to other libraries

Installing Seaborn

You can install Seaborn using:

$ pip install seaborn
$ conda install seaborn

See it in action

We built a simple visualization using Seaborn and Datapane. To start using it yourself, see its documentation.

Final thoughts

When choosing a Python visualization library for your next project, which we assume is why you've got this far, remember that a lot of it depends on you!

Your use case, Python proficiency, and the capabilities you need in the report or app you create.

There are dozens of excellent python visualization libraries; all have different capabilities, syntax, flexibility, and interactivity.

We've named a few of the libraries we think are the best for 2023, but if you think there's one missing, get in touch!

Get great content updates from our team to your inbox.

Join 6,000 Data Scientist subscribers. GDPR compliant.