Skip to content

Commit 7aa7b4d

Browse files
committed
matplotlibrc path search fix
1 parent be56634 commit 7aa7b4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ def get_cachedir():
586586
@_logged_cached('matplotlib data path: %s')
587587
def get_data_path():
588588
"""Return the path to Matplotlib data."""
589-
return str(Path(__file__).with_name("mpl-data"))
589+
return str(Path(__file__).parent.parent.parent.parent.parent /
590+
'share/matplotlib/mpl-data')
590591

591592

592593
def matplotlib_fname():
@@ -606,6 +607,7 @@ def matplotlib_fname():
606607
is not defined)
607608
- On other platforms,
608609
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
610+
- ``/etc/matplotlibrc``
609611
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
610612
exist.
611613
"""
@@ -624,6 +626,7 @@ def gen_candidates():
624626
yield matplotlibrc
625627
yield os.path.join(matplotlibrc, 'matplotlibrc')
626628
yield os.path.join(get_configdir(), 'matplotlibrc')
629+
yield '/etc/matplotlibrc'
627630
yield os.path.join(get_data_path(), 'matplotlibrc')
628631

629632
for fname in gen_candidates():

0 commit comments

Comments
 (0)