Matplotlib-Fehler beheben: OSError: 'xkcd' not found in the style library
Problem:
Beim Versuch, den matplotlib xkcd-Style zu aktivieren mit
xkcd_style_error.py
plt.style.use("xkcd")siehst du die folgende Fehlermeldung:
xkcd_error.txt
OSError: 'xkcd' not found in the style library and input is not a valid URL or path; see `style.available` for list of available stylesLösung
Du kannst xkcd-Style-Plots nicht durch Ausführen von plt.style.use("xkcd") aktivieren. Verwende stattdessen with plt.xkcd():
xkcd_style_fix.py
with plt.xkcd():
# TODO dein Plotting-Code kommt hier rein!
# plt.plot(x, y) # BeispielCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow