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

Look for user-specified styles in ~/.config/matplotlib/stylelib #2720

Merged
merged 4 commits into from Jan 13, 2014

Conversation

alimuldal
Copy link
Contributor

Hi all,
I just noticed that the styles module currently only looks for user-specified styles in ~/.matplotlib/stylelib. I think it ought to also look in ~/.config/matplotlib/stylelib/ for consistency with ~/.config/matplotlib/matplotlibrc and in order to comply with the latest XDG standard (c.f. #454).

@tacaswell
Copy link
Member

Can you please clean up the PEP8 violations? It looks like you left some trailing white space on one of the lines.

This changes looks reasonable to me, but I suspect that this should have a more correct handling of paths (does '~' work on windows?) like the way rcparams handles the same problem.

I see no reason not to merge this (once pep8 is fixed), but it is a stop-gap.

@alimuldal
Copy link
Contributor Author

'~' is handled by os.path.expanduser - on Windows this will use the HOME and USERPROFILE environment variables if set, or else it will use HOMEPATH and HOMEDRIVE. I don't see any reason why this wouldn't work, but I don't have a Windows machine handy to test it at the moment.

@@ -30,7 +30,8 @@
_here = os.path.abspath(os.path.dirname(__file__))
BASE_LIBRARY_PATH = os.path.join(_here, 'stylelib')
# Users may want multiple library paths, so store a list of paths.
USER_LIBRARY_PATHS = [os.path.join('~', '.matplotlib', 'stylelib')]
USER_LIBRARY_PATHS = [os.path.join('~', '.matplotlib', 'stylelib'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be better if it just used matplotlib._get_configdir() and then it can be configured in a consistent way. @tonysyu, did you have a motivation for not using that function in the first place, or was it just a case of it being well hidden?

mdboom added a commit that referenced this pull request Jan 13, 2014
Look for user-specified styles in ~/.config/matplotlib/stylelib
@mdboom mdboom merged commit 0722bc3 into matplotlib:master Jan 13, 2014
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

Successfully merging this pull request may close these issues.

None yet

4 participants