jupyter notebook shows error message for matplotlib Bad key “text.kerning_factor”

╄→尐↘猪︶ㄣ 提交于 2020-12-05 05:26:40

问题


import pandas as pd 
import numpy as np
import matplotlib.pyplot as plt

Bad key "text.kerning_factor" on line 4 in /home/samyak/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle. You probably need to get an updated matplotlibrc file from https://github.com/matplotlib/matplotlib/blob/v3.1.3/matplotlibrc.template or from the matplotlib source distribution


回答1:


It seems to be the case that one of style config files is for matplotlib 3.1 despite that 3.2 is installed.

  1. Go to /home/samyak/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/

  2. open _classic_test_patch.mplstyle and comment out the line of text.kerning_factor:6

It worked for me.




回答2:


I encountered the same issue today (using version 3.2.1).

My solution: Reinstall matplotlib :)




回答3:


I had the same problem and I solved it by upgrading Matplotlib using the code:

conda upgrade matplotlib

or

pip install --upgrade matplotlib



回答4:


I also encountered the same problem. Reinstalling matplotlib didn't work for me. I downgraded matplotlib to version 2 using:

conda install matplotlib=2

It worked. Hope this helps.



来源:https://stackoverflow.com/questions/61171307/jupyter-notebook-shows-error-message-for-matplotlib-bad-key-text-kerning-factor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!