Skip to content

Commit b85e909

Browse files
committed
matplotlibrc path search fix
1 parent 3ac0aea commit b85e909

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ def get_cachedir():
589589
@_logged_cached('matplotlib data path: %s')
590590
def get_data_path():
591591
"""Return the path to Matplotlib data."""
592-
return str(Path(__file__).with_name("mpl-data"))
592+
return str(Path(__file__).parent.parent.parent.parent.parent /
593+
'share/matplotlib/mpl-data')
593594

594595

595596
def matplotlib_fname():
@@ -609,6 +610,7 @@ def matplotlib_fname():
609610
is not defined)
610611
- On other platforms,
611612
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
613+
- ``/etc/matplotlibrc``
612614
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
613615
exist.
614616
"""
@@ -627,6 +629,7 @@ def gen_candidates():
627629
yield matplotlibrc
628630
yield os.path.join(matplotlibrc, 'matplotlibrc')
629631
yield os.path.join(get_configdir(), 'matplotlibrc')
632+
yield '/etc/matplotlibrc'
630633
yield os.path.join(get_data_path(), 'matplotlibrc')
631634

632635
for fname in gen_candidates():

0 commit comments

Comments
 (0)