Plotnine compared with Seaborn and its manipulation with matplotlib

We have covered seaborn object interface (https://datavizs.com/posts/python/seaborn_object_interface_24_08_06/) and how we can control properties like color, style, width etc. We also came across a situation where legend was messed up when we came across more complicated situations. We also tried to overcome some of those limitations using matplotlib. It was easy to manipulate seaborn plot with matplotlib because seaborn is built on top of matplotlib and the fig and ax are more natively accessible....

August 14, 2024 · 4 min · 813 words · Maddy

Fine control properties in Seaborn object interface

Seaborn has long been a go-to tool for statistical plotting in Python. While it may not be as powerful as R’s ggplot2, it’s widely used due to the lack of better alternatives. However, this is changing with the rise of excellent packages like plotnine. One of the biggest drawbacks of Seaborn, in my opinion, has been its inconsistent syntax, which contrasts with the predictable and intuitive syntax of ggplot2 and plotnine, both based on the grammar of graphics....

August 6, 2024 · 3 min · 587 words · Maddy

Pandas Plot a good balance between flaxibility and ease of use

There are various excellent tools for plotting in both Python and R. Arguably, for most statistical plots, ggplot2 is the best. I have tried plotnine and seaborn in Python. While both are excellent packages, neither comes close to R’s ggplot2 in terms of ease of use, documentation, and resources. ggplot2, based on the grammar of graphics concept, has a well-structured and consistent framework, a large community, and an excellent extension ecosystem that enhances its usability....

July 31, 2024 · 4 min · 722 words · Maddy

Use subplot mosaic to fine control subplots in matplotlib

We can always create matplotlib subplots by using subplots in matplotlib. Below is an example to create a subplot of 3 rows and 2 colums. import numpy as np import pandas as pd import matplotlib.pyplot as plt fig, ax = plt.subplots(3,2,layout='tight') However there are times when we need fine control of subplots. This is when subplot_mosaic comes in to play. We can create any possible layout using mosaic. Below are some of the examples....

July 23, 2024 · 2 min · 228 words · Maddy