How to Set Up rcParams in Matplotlib

A simple guide to setting default plotting parameters in matplotlib’s rcParam

Matt Crooks
7 min readSep 28, 2022

--

Matplotlib gets a lot of stick I think it’s unfair. I’ll admit that if you just run plt.plot() then you’ll get something quite ugly but it is, in my view, the best plotting package in python and a largely unavoidable one.

Alternatives

Ok, so you don’t like matplotlib and are considering something else. Here’s my (brief) take on the popular alternatives.

Seaborn is a popular alternative plotting package that has loads of great additional plot types and will produce slightly better plots out the box. pandas can be used to plot data directly and can handle time series quite nicely, so again is popular among data scientists. However, both seaborn and pandas are matplotlib under the hood and if you want to change their default appearance then you need to know matplotlib. Please don’t get me started on Plotly…

The single greatest thing about matplotlib is the ability to set default plot appearance at the start of a notebook and it apply to all your matplotlib figures — some of these properties also apply to seaborn and pandas plots! There is nothing even remotely similar in Plotly in which every plot must be created from scratch. Although to be fair…

--

--