Skip to content

Commit e47d30f

Browse files
committedDec 17, 2024
matplotlibrc path search fix
1 parent 8d64f03 commit e47d30f

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
@@ -590,7 +590,8 @@ def get_cachedir():
590590
@_logged_cached('matplotlib data path: %s')
591591
def get_data_path():
592592
"""Return the path to Matplotlib data."""
593-
return str(Path(__file__).with_name("mpl-data"))
593+
return str(Path(__file__).parent.parent.parent.parent.parent /
594+
'share/matplotlib/mpl-data')
594595

595596

596597
def matplotlib_fname():
@@ -610,6 +611,7 @@ def matplotlib_fname():
610611
is not defined)
611612
- On other platforms,
612613
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
614+
- ``/etc/matplotlibrc``
613615
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
614616
exist.
615617
"""
@@ -628,6 +630,7 @@ def gen_candidates():
628630
yield matplotlibrc
629631
yield os.path.join(matplotlibrc, 'matplotlibrc')
630632
yield os.path.join(get_configdir(), 'matplotlibrc')
633+
yield '/etc/matplotlibrc'
631634
yield os.path.join(get_data_path(), 'matplotlibrc')
632635

633636
for fname in gen_candidates():

0 commit comments

Comments
 (0)
Please sign in to comment.