Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python seaborn to reset back to the matplotlib

I'm using seaborn version o.4 and matplotlib version 1.42 I have a chart displays both line and marker through simple plot command eg.

plt.plot([1,5,3,8,4],'-bo');

Due to a potential bug (https://github.com/mwaskom/seaborn/issues/344), after import seaborn, same code shows line only without marker.

import seaborn as sb 
plt.plot([1,5,3,8,4],'-bo');

So my question is: after import seaborn, Is there a way to reset all the parameters back to original?

like image 684
user3287545 Avatar asked Nov 13 '14 00:11

user3287545


People also ask

How do I change from matplotlib to seaborn?

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.

Why is seaborn over matplotlib?

Seaborn is more comfortable in handling Pandas data frames. It uses basic sets of methods to provide beautiful graphics in python. Matplotlib works efficiently with data frames and arrays.It treats figures and axes as objects. It contains various stateful APIs for plotting.

How do I reset matplotlib rcParams?

Use matplotlib. style. use('default') or rcdefaults() to restore the default rcParams after changes.


2 Answers

Yes, call seaborn.reset_orig.

like image 96
mwaskom Avatar answered Oct 23 '22 17:10

mwaskom


None of these solutions worked for me (Python 3.x, Jupyter). What worked was matplotlib.rc_file_defaults()

See the documentation here: https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rc_file_defaults

like image 34
Marcelo Modesto Avatar answered Oct 23 '22 17:10

Marcelo Modesto