Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using default matplotlib settings / stylesheets support #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stefraynaud opened this issue Apr 21, 2020 · 2 comments
Closed

Using default matplotlib settings / stylesheets support #143

stefraynaud opened this issue Apr 21, 2020 · 2 comments

Comments

@stefraynaud
Copy link
Contributor

https://github.com/lukelbd/proplot/blob/3f065778edce6e07b109e436b504238c7194f04f/proplot/rctools.py#L48

How about setting default configuration values to their matplotib value if it exists, at least for some of the settings?
In the example above, the default colormap is set to "fire" whereas I would like the default "viridis" from matplotlib instead.
This may apply to several other conflicting settings.

I agree that you want to make all proplot plots beautiful by default, but I'm not sure all default matplotlib settings must be changed.
A solution would be to check if a config value is set to "None" by the user, and in this case to use the matplotlib value if it exists.

@lukelbd
Copy link
Collaborator

lukelbd commented Apr 22, 2020

Yeah this is definitely one of ProPlot's pain points. As you have guessed, I was never sure how to address this because I did want proplot to override matplotlib's settings in order to make things "nice"... but checking for user overrides and user-enabled matplotlib stylesheets is a great idea. Just have to figure out how to inject proplot's default settings in-between the steps where (1) matplotlib loads its default settings and (2) matplotlib loads the user-specific matplotlib settings.

I'll add this in a future version.

@lukelbd lukelbd changed the title Why overridding all matplotlib defaults? Using default matplotlib settings / stylesheets support May 9, 2020
@lukelbd
Copy link
Collaborator

lukelbd commented May 9, 2020

@stefraynaud I finally added stylesheet control via c831910 and edc6f3c. New version will come out soon.

I can't really check for None for every setting in .proplotrc because None might be valid values for some rc settings. And the way proplot's rc_configurator is currently designed, this would be really difficult anyway, because even if you try to tell proplot not to overwrite an individual setting (e.g. xtick.label.size), proplot's defaults for the "meta" settings (e.g. small, the font size for "small" text labels) could end up overwriting it anyway. When #109 is merged there will be no "default" meta settings so I could theoretically implement this.

However if you want to use all of matplotlib's default settings instead of proplot's settings, you can add the following line to your proplotrc file.

style: default

Or use any other stylesheet, like

style: fivethirtyeight

I made it so that matplotlib stylesheets are always applied on top of matplotlib's default settings, rather than proplot's default settings. Also, proplot does not support changing proplot-specific settings like abc.loc in matplotlib stylesheets, but I'll be able to do so after I start subclassing RcParams directly when #109 is merged.

Note that in your case, if you just want to change the default colormap but keep other settings, you can do so manually with:

cmap: viridis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants