I am trying to use seaborn, because of its distplot function. But I prefer the default matplotlib settings. When I import seaborn, it changes automatically the appearance of my figure.
How can I use seaborn functions without changing the look of the plots?
Seaborn is indeed an add-on to matplotlib. Therefore, you need to understand how matplotlib handles plots even if using Seaborn. Matplotlib calls its canvas the figure. You can divide the figure into several sections called subplots, so you can put two visualizations side-by-side.
To switch to seaborn defaults, simply call the set_theme() function. (Note that in versions of seaborn prior to 0.8, set_theme() was called on import. On later versions, it must be explicitly invoked). Seaborn splits matplotlib parameters into two independent groups.
Seaborn is a high-level library. It provides simple codes to visualize complex statistical plots, which also happen to be aesthetically pleasing. But Seaborn was built on top of Matplotlib, meaning it can be further powered up with Matplotlib functionalities.
Seaborn is one of the world's most regarded Python libraries that is purpose-built to create beautiful-looking visualizations. It can be considered as an extension of another library called Matplotlib as it is built on top of that.
Version 0.8 (july 2017) changed this behaviour. From https://seaborn.pydata.org/whatsnew.html#v0-8-0-july-2017:
The default (seaborn) style is no longer applied when seaborn is imported. It is now necessary to explicitly call set() or one or more of set_style(), set_context(), and set_palette(). Correspondingly, the seaborn.apionly module has been deprecated.
For older versions, Import seaborn like this:
import seaborn.apionly as sns
and then you should be able to use sns.distplot
but maintain the default matplotlib styling + your personal rc configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With