Matplotlib不显示标签或数字 [英] Matplotlib does not show labels or numbers
问题描述
我在matplotlib中的绘图显示的字母/数字不超过一个.我确实需要使用 anaconda 文件夹中的 matplotlib,这就是我在开头包含 sys.path 的原因.(当我不包含前 2 行时,一切正常,因为我的计算机上有一个不同的 matplotlib.两者都是最新的.)有什么想法可以使它工作吗?我正在使用Ubuntu和Sublime Text.
My plots in matplotlib don't show more than one letter/digit. I do need to use matplotlib from the anaconda folder which is why I'm including sys.path at the beginning. (When I don't include the first 2 lines everything works fine since I have a different matplotlib on my computer. Both are up to date.) Any ideas what I can do to make it work? I'm using Ubuntu and Sublime Text.
这是我的简单代码:
import sys
sys.path.insert(0, "/home/mariusz/anaconda/lib/python2.7/site-packages")
import matplotlib.pyplot as plt
grade_fast = [1,7,3,5,6,7,10,11,12]
bumpy_fast = [0,2,3,5,6,7,10,11,12]
grade_slow = [0,2,3,5,6,7,10,11,12]
bumpy_slow = [0,2,3,5,6,7,10,11,12]
plt.scatter(bumpy_fast, grade_fast, label="f")
plt.scatter(grade_slow, bumpy_slow, label="slow")
plt.legend()
plt.xlabel("bumpiness")
plt.ylabel("g")
plt.show()
推荐答案
我重新安装了matplotlib,numpy,scikit-learn和scipy,它起作用了:)我不知道为什么.
I re-installed matplotlib, numpy, scikit-learn and scipy and it worked :) I don't know why though.
这篇关于Matplotlib不显示标签或数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!