Skip to content

Commit e2eda7d

Browse files
committed
matplotlibrc path search fix
1 parent c23ccdd commit e2eda7d

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
@@ -540,7 +540,8 @@ def get_cachedir():
540540
@_logged_cached('matplotlib data path: %s')
541541
def get_data_path():
542542
"""Return the path to Matplotlib data."""
543-
return str(Path(__file__).with_name("mpl-data"))
543+
return str(Path(__file__).parent.parent.parent.parent.parent /
544+
'share/matplotlib/mpl-data')
544545

545546

546547
def matplotlib_fname():
@@ -560,6 +561,7 @@ def matplotlib_fname():
560561
is not defined)
561562
- On other platforms,
562563
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
564+
- ``/etc/matplotlibrc``
563565
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
564566
exist.
565567
"""
@@ -578,6 +580,7 @@ def gen_candidates():
578580
yield matplotlibrc
579581
yield os.path.join(matplotlibrc, 'matplotlibrc')
580582
yield os.path.join(get_configdir(), 'matplotlibrc')
583+
yield '/etc/matplotlibrc'
581584
yield os.path.join(get_data_path(), 'matplotlibrc')
582585

583586
for fname in gen_candidates():

0 commit comments

Comments
 (0)