Skip to content
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

Document $MATPLOTLIBRC #5265

Closed
itoijala opened this issue Oct 17, 2015 · 8 comments
Closed

Document $MATPLOTLIBRC #5265

itoijala opened this issue Oct 17, 2015 · 8 comments

Comments

@itoijala
Copy link
Contributor

The documentation does not mention the very useful MATPLOTLIBRC environment variable.

The variable would be even more useful if the file did not have to be called matplotlibrc.

@jenshnielsen
Copy link
Member

Do you have any specific need for more than one rc file? In most cases I would recommend using the style module to customise your plot. See http://matplotlib.org/users/style_sheets.html

@itoijala
Copy link
Contributor Author

The idea is that when working on a publication with multiple people, the output should be the same for everyone. This requires the styles to be bundled with the scripts. A matplotlibrc in a user's home that is loaded would also cause problems. I think the easiest way to prevent that is to have our own rc file.

I guess setting MPLCONFIGDIR to a folder that has style files would also work, though it would require every script to set the style. Can a style file set the backend?

@jenshnielsen
Copy link
Member

If you care about the backend I would explicitly set it in the script. ```matplotlib.use('QT4Agg')` or whatever.

I guess setting MPLCONFIGDIR to a folder that has style files would also work, though it would require > every script to set the style.
I would personally consider that a significant advantage. Rather than relying on a hidden setup behind the scenes you are making the style used explicit in the script.

Also note that the rc file in the current directly should always overwrite the one in the homedir http://matplotlib.org/users/customizing.html this is of cause not enough if you have your plot scripts in multiple directories.

All of this does not mean that we should not document the env variable. That should be clearly be documented.

@itoijala
Copy link
Contributor Author

I use the pgf backend with a custom preamble and so the labels will not work without the rc file anyway. Therefore I like to keep the scripts as short as possible and remove the error of not setting the backend in one of them.

I also have multiple folders with scripts and want to use a single rc file.

I know that the rc file overrides the one in home. The problem is that without an rc file, for example if using a stylesheet instead, the one from home would be loaded.

I think there should be an option to put matplotlib into a reproducible mode where nothing is ever loaded from home. The question is where to put this option.
I would even go so far as to say that matplotlib should default to the fully reproducible mode, though that would not be backwards compatible and is probably an unpopular opinion.
It should be as easy as possible to publish the source to a publication that does the complete analysis and all the plots and builds the resulting document in a reproducible manner.

Anyway, the system is fine now as long as no one forgets to include an rc file that is found by matplotlib.

@tacaswell
Copy link
Member

Pretty sure this is documented on master

@itoijala
Copy link
Contributor Author

Doesn't look like it: https://github.com/matplotlib/matplotlib/blob/master/doc/users/customizing.rst#the-filematplotlibrc-file
At least that is the place I expected to find it.

@tacaswell
Copy link
Member

Huh, I could have sworn I remembered a PR about this going by, never mind then.

@itoijala
Copy link
Contributor Author

Would you be open to adding functionality to also specify the filename?
It could work like this: if $MATPLOTLIBRC is a file, use it, otherwise look for $MATPLOTLIBRC/matplotlibrc.
I find it strange that it works the way it does.
I could do a PR.

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

No branches or pull requests

3 participants