Skip to content

Commit c4da0f4

Browse files
committed
allow $MATPLOTLIBRC to specify the file directly
1 parent ad8a732 commit c4da0f4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/users/customizing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ locations, in the following order:
5656
1. :file:`matplotlibrc` in the current working directory, usually used for
5757
specific customizations that you do not want to apply elsewhere.
5858

59-
2. :file:`$MATPLOTLIBRC/matplotlibrc`.
59+
2. :file:`$MATPLOTLIBRC` if it is a file, else :file:`$MATPLOTLIBRC/matplotlibrc`.
6060

6161
3. It next looks in a user-specific place, depending on your platform:
6262

lib/matplotlib/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ def matplotlib_fname():
755755
756756
- `$PWD/matplotlibrc`
757757
758+
- `$MATPLOTLIBRC` if it is a file
759+
758760
- `$MATPLOTLIBRC/matplotlibrc`
759761
760762
- `$MPLCONFIGDIR/matplotlibrc`
@@ -787,6 +789,8 @@ def matplotlib_fname():
787789
if 'MATPLOTLIBRC' in os.environ:
788790
path = os.environ['MATPLOTLIBRC']
789791
if os.path.exists(path):
792+
if os.path.isfile(path):
793+
return path
790794
fname = os.path.join(path, 'matplotlibrc')
791795
if os.path.exists(fname):
792796
return fname

0 commit comments

Comments
 (0)