haltakov.eth πŸ§±πŸ”¨ Profile picture
Making web3 accessible to everyone. VP of Engineering @FR0NTIER_X. Used to program self-driving cars. Side-project @0xbnomial.

Sep 14, 2021, 11 tweets

Most people seem to use matplotlib as a Python plotting library, but is it really the best choice? πŸ€”

We are going to compare 5 free and popular libraries:
β–ͺ️ Matplotlib
β–ͺ️ Seaborn
β–ͺ️ Plotly
β–ͺ️ Bokeh
β–ͺ️ Altair

Which one is the best? Find out below πŸ‘‡

In a survey I did the other day, matplotlib had the most users by a large margin. This was quite surprising to me since I don't really like it...



But let's first look at each library πŸ‘‡

Matplotlib πŸ“ˆ

Matplotlib is one of the most popular libraries out there.

βœ… Supports many types of plots
βœ… Lots of customization options

❌ Plots look ugly
❌ Limited interactivity
❌ Not very intuitive to use

Seaborn πŸ“ˆ

Seaborn is built on top of Matplotlib, so it inherits many of its features.

βœ… Supports many types of plots
βœ… Plots look very nice

❌ Limited interactivity
❌ Not very intuitive to use
❌ You need to use maplotlib for many configurations

Plotly πŸ“ˆ

Plotly is a popular library for interactive visualizations.

βœ… Plots look nice
βœ… Lots of customization options
βœ… Easy to use (especially plotly express)
βœ… Great interactivity (even by default)

❌ Could be slow for big amounts of data

Bokeh πŸ“ˆ

Another cool interactive plotting library.

βœ… Plots look nice
βœ… Lots of customization options
βœ… Good interactivity (but not as good as plotly)

❌ Missing plot types (especially 3D)

Altair πŸ“ˆ

A less popular, but very interesting library based on the Vega project.

βœ… Plots look nice
βœ… Lots of customization options
βœ… Good interactivity (but not as good as plotly)

❌ Slow
❌ Cumbersome to use
❌ Embeds all data in the visualization leading to huge files

The Winner πŸ₯‡

My personal favorite is plotly. I like it because it is very easy to use, offers great interactivity by default and the plots look nice.

Furthermore, plotly also offers a JavaScript version, so it can be practical if you need to show some data on the web.

Now it's your turn...

Which Python plotting library do you prefer? Why? Have you tried plotly? Feel free to try to convince me that there is a better library! πŸ˜„

If you want to learn plotly I find the official documentation quite good. They also have lots of examples you can build on.

Start here: plotly.com/python/creatin…

This is a valid strategy, however, sometimes you just want to do a quick plot to visualize your data.

I think it is very important to keep the friction of displaying data to a minimum. Otherwise you just won't do it sometimes - a missed opportunity.

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling