Matplotlib style library not updating when adding / removing .mplstyle files
I'm trying to create my own matplotlib stylesheets, but Python doesn't detect them. Even worse, when I moved one of the five default stylesheets (ggplot.mplstyle), Python kept reporting that it was available.
I tried to reload the whole module, to no avail:
import matplotlib
reload(matplotlib)
from matplotlib import style as style
plt = matplotlib.pyplot
print plt.style.available
just returns
[u'dark_background', u'bmh', u'grayscale', u'ggplot', u'fivethirtyeight']
How can I force these styles to "update"?
Ps I'm not a Python expert.
source to share
Just in case someone came across this post, this issue was reported and resolved here:
https://github.com/matplotlib/matplotlib/issues/3601
Basically, the style library looks for files in a subdirectory of the matplotlib config directory. On linux / osx system it will be something like ~/.matplotlib/stylelib/<my-custom-style>.mplstyle
.
Also, as @tcaswell pointed out in the comments, loading is done during import, so style files added or edited after import won't work without being called plt.style.reload_library()
.
source to share