Yesterday’s post on 8 alternatives to traditional plots was appreciated by many of you.
To recap, I shared various alternatives to Scatter plots, bar plots, line plots, box plots, and heatmaps to improve your data visualization.
Today, let’s continue that discussion, and I’ll share something really cool about matplotlib.
Let’s begin!
Customize Matplotlib plots
I have been using matplotlib for many years now.
Based on that experience, I believe that one of the best yet underrated potentials of matplotlib is the amount of customizability it offers.
But being unaware of that, most matplotlib users use it as a naive plotting utility with almost zero customization.
And as the default plots never appear “appealing”, they resort to other libraries, Plotly, for instance, to create elegant plots.
Yet, I believe that in 90-95% of cases, you would NEVER need to look beyond matplotlib.
It can do much more than what most users think.
For instance, consider the two plots below:
Yes! Both plots were created using matplotlib.
But some custom formatting makes the second plot much more elegant, informative, appealing, and easy to follow.
The title and subtitle significantly aid the story.
Also, the footnote offers extra important information, which is nowhere to be seen in the basic plot.
Lastly, the bold bar immediately draws the viewer’s attention and conveys the purchase category’s importance.
Thus, in my opinion, the overwhelming potential for customization makes matplotlib far more capable than what most users think.
Conclusion
One of the things I always ensure towards being a good storyteller in my data science projects is that my plot must demand minimal effort from the viewer.
Thus, I never shy away from putting in that extra effort.
This has been especially true for professional environments.
At times, it is also good to ensure that our visualizations convey the right story, even if they are viewed in our absence.
The below plot is a classic example of that.
In this entire post, I never discussed what that plot is about — somewhat indicating my absence.
Yet, by staring at this plot for a few seconds, you can quickly figure out what I intended to highlight here, can’t you?
You can download the code notebook for this post here: Matplotlib Notebook.
👉 Over to you: What are some other underrated gems of matplotlib that most users aren’t aware of?
1 Referral: Unlock 450+ practice questions on NumPy, Pandas, and SQL.
2 Referrals: Get access to advanced Python OOP deep dive.
3 Referrals: Get access to the PySpark deep dive for big-data mastery.
Get your unique referral link:
Extended piece #1
What happens under the hood when we do .cuda()?
It’s SO EASY to accelerate model training with GPUs today. All it takes is just a simple .cuda()
call.
Yet, GPUs are among the biggest black-box aspects, despite being so deeply rooted in deep learning.
If you are always curious about underlying details, I have written an article about CUDA programming: Implementing Parallelized CUDA Programs From Scratch Using CUDA Programming.
We cover the end-to-end details of CUDA and do a hands-on demo on CUDA programming by implementing parallelized implementations of various operations we typically perform in deep learning.
The article is beginner-friendly, so if you have never written a CUDA program before, that’s okay.
Extended piece #2
Many ML engineers quickly pivot to building a different model when they don’t get satisfying results with one kind of model.
They do not fully exploit the possibilities of existing models and continue to move towards complex ones.
But after building so many ML models, I have learned various techniques that uncover nuances and optimizations we could apply to significantly enhance model performance without necessarily increasing the model complexity.
Read about 11 Powerful Techniques To Supercharge Your ML Models here.
The article provides the clear motivation behind their usage, as well as the corresponding code, so that you can start using them right away.
Let me help you more…
Every week, I publish in-depth ML deep dives. The topics align with the practical skills that typical ML/DS roles demand.
Join below to unlock all full articles:
Here are some of the top articles:
[FREE] A Beginner-friendly Introduction to Kolmogorov Arnold Networks (KANs).
Understanding LoRA-derived Techniques for Optimal LLM Fine-tuning
8 Fatal (Yet Non-obvious) Pitfalls and Cautionary Measures in Data Science.
5 Must-Know Ways to Test ML Models in Production (Implementation Included).
Don’t Stop at Pandas and Sklearn! Get Started with Spark DataFrames and Big Data ML using PySpark.
Join below to unlock all full articles:
SPONSOR US
Get your product in front of more than 76,000 data scientists and other tech professionals.
Our newsletter puts your products and services directly in front of an audience that matters — thousands of leaders, senior data scientists, machine learning engineers, data analysts, etc., who have influence over significant tech decisions and big purchases.
To ensure your product reaches this influential audience, reserve your space here or reply to this email.