0

I have copied and put in my configurations in ~/.config/matplotlib/matplotlibrc . Then I checked in python which matplotlibrc it is using. It is still the default one.

>>> import matplotlib
>>> matplotlib.matplotlib_fname()
'/Users/home/Library/Python/3.10/lib/python/site-packages/matplotlib/mpl-data/matplotlibrc'

The configs I put in are not effective. From the documentation, the one in .config should take precedence.

I tried restarting the terminal, but nothing worked. If I put the matplotlibrc file in the working directory of Python, it successfully chooses the one in the directory. But it never uses the one in .config/. I read from this thread that I have to delete the .matplotlib dir. I tried but it is recreated as soon as I launch Python, and nothing is changed. What would be the problem?

I use a Macbook on MacOS 14.4.1.

1
  • 4
    According to the documentation you linked to it would be located at ~/.matplotlib/matplotlibrc for MacOS. To troubleshoot the location of your matplotlib/ configuration directory, use matplotlib.get_configdir() Commented Aug 17, 2024 at 4:40

1 Answer 1

1

Not sure if ukBaz has answered this question yet, but here is some troubleshooting.

1- Check that the configuration path is correct

2- Check for permissions, you can use this code in your terminal:

ls -l ~/.config/matplotlib/matplotlibrc

3- Check cache directory. You mentioned deleting the 'matplotlib' directory. Matplotlib sometimes caches configurations, and this can lead to issues if the cache is stale. Deleting this directory should force Matplotlib to recheck the configuration paths. Use this code to delete it:

rm -rf ~/.matplotlib

4- Check that the 'MPLCONFIGDIR' is not overriding the default config directory. You can see this if you use this code:

echo $MPLCONFIGDIR

5- Debug the config loading, you can check this is your python session bu using

import matplotlib as mpl
mpl.rc_file('~/.config/matplotlib/matplotlibrc')

This will load the config from spec file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.