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.

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Vladimir Haltakov

Vladimir Haltakov Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @haltakov

15 Sep
Did you ever want to learn how to read ROC curves? πŸ“ˆπŸ€”

This is something you will encounter a lot when analyzing the performance of machine learning models.

Let me help you understand them πŸ‘‡ Image
What does ROC mean?

ROC stands for Receiver Operating Characteristic but just forget about it. This is a military term from the 1940s and doesn't make much sense today.

Think about these curves as True Positive Rate vs. False Positive Rate plots.

Now, let's dive in πŸ‘‡
The ROC curve visualizes the trade-offs that a binary classifier makes between True Positives and False Positives.

This may sound too abstract for you so let's look at an example. After that, I encourage you to come back and read the previous sentence again!

Now the example πŸ‘‡
Read 19 tweets
9 Sep
I highly recommend listening to the latest eposide of @therobotbrains podcast with @ilyasut.

therobotbrains.ai/podcasts/episo…

Here are some insights I found particulalry interesting πŸ‘‡
"Neural networks are parallel computers"

That is why they are so powerful - you can train a generic computer to solve your problem. This is also the driver behind Software 2.0 - neural network are becoming more and more capable of solving all kinds of problems.
"Neural networks perform well on tasks that humans can perform very quickly"

Humans don't think much when listening, observing or performing simple tasks.

This means that a neural network can be trained to be good at it as well: NLP, computer vision and reinforcement learning.
Read 4 tweets
9 Sep
My setup for recording videos for my machine learning course πŸŽ₯

A lot of people asked about my setup the other day, so here a short thread on that. It's nothing fancy, but it does a good job πŸ€·β€β™‚οΈ

Details πŸ‘‡
Hardware βš™οΈ

β–ͺ️ MacBook Pro (2015 model) - screen sharing and recording
β–ͺ️ iPhone XS - using the back camera for video recording
β–ͺ️ Omnidiretional external mic - connected to the iPhone
β–ͺ️ Highly professional camera rig - books mostly about cooking and travel πŸ˜„

πŸ‘‡
Software πŸ’»

β–ͺ️ OBS Studio - recording of the screen and the camera image
β–ͺ️ EpocCam - use your iPhone as a web cam. You can connect your iPhone both over WiFi and cable.
β–ͺ️ Google Slides - for presentation
β–ͺ️ Jupyter notebooks and Google Colab - for experimenting with code

πŸ‘‡
Read 5 tweets
7 Sep
Let's talk about a common problem in ML - imbalanced data βš–οΈ

Imagine we want to detect all pixels belonging to a traffic light from a self-driving car's camera. We train a model with 99.88% performance. Pretty cool, right?

Actually, this model is useless ❌

Let me explain πŸ‘‡
The problem is the data is severely imbalanced - the ratio between traffic light pixels and background pixels is 800:1.

If we don't take any measures, our model will learn to classify each pixel as background giving us 99.88% accuracy. But it's useless!

What can we do? πŸ‘‡
Let me tell you about 3 ways of dealing with imbalanced data:

β–ͺ️ Choose the right evaluation metric
β–ͺ️ Undersampling your dataset
β–ͺ️ Oversampling your dataset
β–ͺ️ Adapting the loss

Let's dive in πŸ‘‡
Read 13 tweets
7 Sep
Goals for my ML course

β–ͺ️ For beginners
β–ͺ️ End-to-end
β–ͺ️ Practice instead of theory
β–ͺ️ Intuition instead of definition
β–ͺ️ Minimum math
β–ͺ️ Real-world dataset
β–ͺ️ Flexible example applications
β–ͺ️ Built with community feedback

Let's go through these points πŸ‘‡
For beginners

Only Python knowledge will be required to do the course. No previous machine learning experience needed.
End-to-end

We will cover the whole pipeline - from collecting and cleaning data to deploying a trained model.

We will also discuss some topics like ethics and bias and problem framing.
Read 9 tweets
6 Sep
How I format my Jupyter notebooks in VS Code πŸ“’

I like using VS Code when working with Jupyter notebooks. One pain point has always been automatic code formatting, but now I have a good solution.

You need:
β–ͺ️ VS Code 1.60 (August 2021)
β–ͺ️ YAPF formatter

Details πŸ‘‡
VS Code 1.60

The latest VS Code version from August 2021 contains many improvements for the native display of Jupyter notebooks (which came in July 2021). They now support the command Format Cell with which you can automatically format your code.

πŸ‘‡
Keyboard shortcuts

You can quickly do it with a keyboard shortcut.

β–ͺ️ Windows: Shift + Alt + F
β–ͺ️ Mac: Shift + Option + F
β–ͺ️ Linux: Ctrl + Shift + I

I had to remap Shift + Option + F on my Mac, because it seems to be a macOS shortcut for some strange character...
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(