Quick Success Data Science
One plotting ring to rule them all!
Have you started using the new Seaborn Objects System for plotting with Python? You definitely should; it’s a wonderful thing.
Introduced in late 2022, the new system is based on the Grammar of Graphics paradigm that powers Tableau and R’s ggplot2. This makes it more flexible, modular, and intuitive. Plotting with Python has never been better.
In this Quick Success Data Science project, you’ll get a quick start tutorial on the basics of the new system. You’ll also get several useful cheat sheets compiled from the Seaborn Objects official docs.
We’ll use the following open-source libraries for this project: pandas, Matplotlib, and seaborn. You can find installation instructions in each of the previous hyperlinks. I recommend installing these in a virtual environment or, if you’re an Anaconda user, in a conda environment dedicated to this project.
The goal of Seaborn has always been to make Matplotlib — Python’s primary plotting library — both easier to use and nicer to look at. As part of this, Seaborn has relied on declarative plotting, where much of the plotting code is abstracted away.
The new system is designed to be even more intuitive and to rely less on difficult Matplotlib syntax. Plots are built incrementally, using interchangeable marker types. This reduces the number of things you need to remember while allowing for a logical, repeatable workflow.
Everything Starts with Plot()
The use of a modular approach means you don’t need to remember a dozen or more method names — like barplot() or scatterplot() — to build plots. Every plot is now initiated with a single Plot() class.
The Plot() class sets up the blank canvas for your graphic. Enter the following code to see an example (shown using JupyterLab):