Advanced Matplotlib

 

Advanced Matplotlib: A Comprehensive Guide to Data Visualization






Welcome back to the second installment of our two-part series of Matplotlib. In part 1, we saw how we can make the basic plot and understand the characteristics of various plots. In this article, we delve into advanced topics of Matplotlib to unlock its true potential for better visualization and representation of the data. Now, Without a dew let me give a glimpse of what lies ahead.

Say, You are working with a dataset that has the age of a person, the software they are working on, and their salary. You want to visualize the Python developers' ages and salaries and then compare them with Java developers. By Now, you know you can do that by making two plots one in each cell of the notebook. But then, you have to move back and forth to compare, we better not talk about what if there are 4 things to compare!!

To Ease this issue, we have a feature called subplots, in the same plot there will be different subplots of each. You can create the subplots using plt.subplots(nrows=x,ncols=y) . By default nrows=1, and ncols=1. plt.subplots() returns two things one(fig) is to style the entire plot, and the other(axes) is to make subplots. Plot each subplot using axes[row, column], where row and column specify the location of the subplot in the grid. You can use the sharex or sharey parameters when you have common axes for the subplots. Let’s see a few examples to make it clear.

Post a Comment

0 Comments