Data Visualization 101: How to Choose a Python Plotting Library | by Sara A. Metwalli | Sep, 2020


“Visualizing knowledge can provide us a very fast resolution to issues. We can get readability or the solution to a easy drawback in no time.” — David McCandless

Visualizing knowledge is likely one of the crucial steps in any knowledge science challenge. It makes it more straightforward to to find patterns, stumble on anomalies, and be in contact your effects successfully.

The strategy of visualizing knowledge, on the other hand, will also be a bit difficult. Today, there are such a lot of plotting equipment and libraries that we will use to convey our knowledge to lifestyles via charts and hues. Some equipment are reasonably extravagant and costly.

So, how can one come to a decision what to use?

Well, this text will — with a bit of luck — let you resolution that query.

In this text, we will be able to duvet the highest 10 plotting libraries in Python; we will be able to undergo some utilization examples and the way to select certainly one of them on your subsequent visualization journey.


Before we get into that, let’s first communicate concerning the two varieties of plots we will generate.

When plotting any knowledge, we have now choices to make a choice from; we will both generate a static plot or a dynamic one.

Static plotting

Static plots include graphs showing consistent members of the family between two or extra variables. That is, as soon as the plot is created, it will possibly’t be modified by the consumer. In static plots, the customers can’t trade any facets of the plot.

Dynamic plotting

Dynamic plots — sometimes called interactive plots — are used when the developer/ clothier desires the customers to engage with the plot, converting some facets of it and getting extra aware of the information used to create it.

Okay, so you’ve gotten some knowledge that you need to visualize, however you don’t know the place to get started. Let me let you out. Whenever I get started a challenge and want to create some visualizations, I frequently ask myself four questions that lead me to the fitting selection.

Q1: What is my goal platform/media?

The very first thing you wish to have to come to a decision is which plot sort do you wish to have, static or dynamic? Usually, static plots are utilized in printouts, technical papers, or stories. In this situation, you wish to have to inform your target market one thing and now not to engage with the plot itself.

However, should you’re the use of the plot in a web-based educational, in a magnificence, or any internet utility, the place the customers can mess around with the information to comprehend it higher or to use it in other places, then you definately will have to create a dynamic plot.

Q2: Is my knowledge publically to be had?

This is a an important factor to imagine. If your knowledge is non-public and isn’t publically to be had, then you wish to have to use static plots. But, if the information is saved on public carrier that doesn’t require particular permission to get admission to, then a dynamic plot could also be a better choice.

Q3: What is my precedence?

Once I’ve made my resolution to use static vs. dynamic plotting. I ask myself, what’s the precedence of my visualization? Do I want it to be sophisticated with many layers? Answering this query is helping select the proper library to use.

This autumn: Do I want a particular more or less visualization?

Finally, I ask myself what sort of plotting do I want? Is it a easy chart? Bar, column, pie, or donut? Or do I want to plot one thing extra specialised comparable to a community or a map?

Suppose I want to visualize basic knowledge, then the use of any library that provides my desired chart sort. However, if I want to create a map or a community, that can prohibit my choices and assist me make the verdict sooner.

Python is likely one of the maximum used programming languages in knowledge science and lots of different packages. However, due to its reputation, Python has such a lot of knowledge visualization libraries to make a choice from. The vast number of choices is each a just right and a unhealthy factor.

Having many choices imply you’ll select the library the suits your goals solely, however it may be too complicated to new folks becoming a member of the sphere and to mavens deciding what to select.

Here, I can pass during the best 10 Python libraries in the market, how and when to use them. I divide the ones libraries into two classes, libraries used to plot static charts, and the ones used for dynamic graphs.

Let’s get visualizing…


We can’t speak about knowledge visualization in Python with out citing the primary and oldest Python visualization library of all of them, Matplotlib. Matplotlib is an opensource library that used to be created again in 2003 with a syntax shut to MATLAB. Since then, the library has received a lot of affection and toughen than continues to these days.

Many Python programs are constructed upon Matplotlib core. For instance, Seaborn and Pandas act as wrappers round Matplotlib, permitting the consumer to create graphs with fewer strains of code.

When to use Matplotlib?

  1. If you’re aware of MATLAB, the use of Matplotlib will glance acquainted and can make your transition more straightforward.
  2. If maximum of your knowledge is time-series, then the use of Matplotlib will make it a bit sophisticated to use and plot.
  3. Matplotlib is wey robust in coping with static 2D plots. However, it will get reasonably sophisticated if you need to plot three-D or interactive visualizations.
  4. Matplotlib is a very low-level library, because of this that one wishes to write extra code to get the visualization operating.
  5. Matplotlib used to be now not designed for knowledge exploration functions, so in case your primary objective is to do this, you could be the use of every other library.

Usage Example


Seaborn is likely one of the libraries construct upon Matplotlib. It acts as a wrapper to supply customers with a high-level selection to Matplotlib. You can create the similar visualization as Matplotlib however with a lot fewer strains of code.

Since Seaborn is constructed upon Matplotlib, it incorporates the similar charts sort as Matplotlib as well as to some cool charts comparable to Heatmaps and Violin charts. Seaborn will also be used to give Matplotlib charts extra visually interesting.

When to use Seaborn?

  1. I at all times counsel that should you’re the use of Matplolib, you will have to Seaborn with it to make your visualizations higher.
  2. If you’re beginning with Python and DS, Seaborn is a straightforward and simple library that you’ll use to create shocking charts with much less to no effort.
  3. Seaborn provides simple customization strategies to upload your contact to your graphics. It will give you whole regulate over the colour palette of the created graphs.
  4. Seaborn has many statistically-minded integrated plots that you’ll use simply, comparable to Facet plots and regression plots.

Usage Example


Back in 1993, a incredible e-book used to be printed. The Grammar of Graphics offered a layered rule information for designers and information scientists to create stunning, significant, and helpful knowledge visualizations.

If you used R prior to, Plotnine used to be constructed with an identical syntax and as an implementation of the other facets offered within the Grammar of Graphics e-book, and it’s in line with the preferred R library ggplot.

When to use Plotnine?

  1. The simplest reason why to use Plotnine is should you’re transitioning from R to Python and wish to create visualization with out a lot trouble.
  2. Plotnine permits the consumer to simply compose plots by explicitly mapping knowledge to the visible items forming the plot.
  3. Plotnine API permits you to create several types of charts simply and with few strains of code with out the desire to return to the documentation frequently.
  4. Plotting with Plotnine is robust because it makes customized plots simple to take into consideration and create.

Usage Example


NetworkX is a Python library that isn’t only for visualisation. It is as an alternative a package deal created to analyze, manipulate, and learn about the construction of complicated networks.

NetworkX is a kind of libraries which are field-specific or area-specific; this is, you’ll’t generate any charts the use of this library. For instance, you’ll’t create a bar or pie chart the use of NetworkX.

When to use NetworkX?

  1. If you’re coping with graphs or graph concept algorithms, the use of NetworkX will permit you to put in force and analyze those packages temporarily.
  2. If you’re making an attempt to learn about the connection between other knowledge issues.
  3. If you’re making an attempt to simulate and analyze the efficiency of whole networks.

Usage Example


Whenever you get started a new knowledge science challenge, you’ll want to carry out some knowledge exploration to perceive your knowledge higher. One very tense factor that frequently occurs is coming throughout lacking knowledge entries. As a knowledge scientist, lacking knowledge entries is likely one of the maximum difficult duties in all the challenge.

Well, Missingno is right here to the rescue. It permits the consumer to take a look at the dataset for lacking access by offering a visible abstract of the dataset. So, as an alternative of going via rows and rows of numbers, you’ll clear out and type the information in line with final touch and correlation between variables.

When to use Missingno?

  1. If you need to velocity and straightforwardness up your knowledge exploration section of any challenge.
  2. Displays a depend of values provide in line with column, Matrix, Heatmap, and Dendrogram.

Usage Example

Dataset used is here.


Plotly is a Javascript-based module to generate and manipulate interactive visualizations. With Plotly, you’ll create distinctive charts like dendrograms, three-D charts, and contour plots. Most of those charts sorts you can not generate via lots of the different libraries.

Moreover, Plotly has many integrated packages for system studying and information science, which makes it more straightforward to put in force and visualize usual algorithms comparable to ML regression and kNN classifications.

When to use Plotly?

  1. If you need to get started with growing interactive knowledge visualizations in Python, then Plotly is the best way to pass. It permits you to create customized charts with none trouble.
  2. You can create shocking animations in Plotly that is helping you be in contact your knowledge higher.
  3. If you need to create stunning maps, medical graphs, three-D charts, or monetary ones.
  4. Plotly permits you to create customized controls to your charts to give extra interactive functionalities.

Usage Example


Similar to Plotly, Bokeh is a Javascript-based package deal that permits you to create shocking interactive visualizations. Besides, an identical to Plotnine, Bokeh is an implementation of the foundations offered within the Grammar of Graphics.

Bokeh supplies 3 ranges of regulate to accommodate other consumer sorts. The very best point permits you to create usual charts, comparable to bar, pie, scatter, and so forth. The center point provides some point of specificity as Matplotlib and permits you to regulate the elemental development blocks of every chart. Finally, the bottom point will give you complete regulate of each component of the chart.

When to use Bokeh?

  1. Create great interactive visualizations.
  2. If you need to carry out knowledge transformations, comparable to including jitter to crowded plots.
  3. If you need to create stunning 2D graphics. However, if you need three-D graphics, pass with Plotly.

Usage Example


Gleam is a Python library this is impressed by the R Shiny library. It is constructed to permit Python builders to create interactive knowledge visualization for the internet.

Gleam places all of it in combination and creates a internet interface that shall we someone play along with your knowledge in real-time, making it more straightforward than ever to assist others perceive and interpret your knowledge.

When to use Gleam?

  1. If you need to create visualizations for the internet and don’t need to maintain JS, HTML, or CSS.
  2. If you need to give your customers real-time regulate over your knowledge.


Altair is a easy, user-friendly, and constant statistical visualization python library in line with Vega-Lite. Altair permits you to create significant, sublime, and helpful visualizations rapid with simply a few strains of code.

When to use Altier?

  1. If you need hassle-free interactive knowledge visualization.
  2. Apply transformations for your knowledge temporarily and successfully.
  3. If you need to create declarative statistical visualizations.
  4. Create stacked, layered, faceted, and repeated charts.

Usage Example


Folium is a stunning Python geovisualization library used for plotting maps. Folium makes use of the mapping skills of the Leaflet.js enabling interactive map visualizations.

Folium will give you the facility to zoom out and in for your maps, click on and drag them, and even upload markers on them.

When to use Folium?

  1. If you need to create interactive maps, Folium is your only option.

Usage Example

Data visualization is the best way a developer or a knowledge scientist be in contact their knowledge to a vast target market. Building higher, efficient knowledge visualization is a treasured ability that each knowledge scientist should paintings on creating.

Whenever you need to create some visualizations, right here’s a rule of thumb to practice, should you’re new to knowledge science and Python and best need to create static charts, pass with Seaborn. For community research, use NetworkX. If you need to create interactive visualization to provide, use Plotly, but when you need to use this visualization for the internet, then pass with Gleam. Finally, if you need to create interactive maps, Folium is your buddy.

In the tip, you’ll create compelling visualizations it doesn’t matter what library you select. And take note, complicated isn’t at all times the solution. Always pass with the library the supplies the options you need fro your visualizations.


Please enter your comment!
Please enter your name here