matplotlib does not show plot()
我尝试运行plt.show(),但未显示任何图。 我已经尝试了很多来自stackoverflow的解决方案,包括将matplotlib后端设置为Qt4Agg,切换到其他后端(即TkAgg,Agg)并重新安装matplotlib程序包,但仍然不能解决问题。 我尝试过但不起作用的一些解决方案是:
尽管我调用pyplot.show(),但matplotlib不会显示我的绘图
Matplotlib.Pyplot不显示输出; 没错
为什么matplotlib不作图?
Matplotlib不显示标签或数字
以下是我尝试运行的代码:
1 2 3 4 5 | plt.scatter(pf["age"], pf["friend_count"]) plt.xlabel ="age" plt.ylabel ="friends count" plt.title ="Facebook Friends count by Age" plt.show() |
运行
我在Windows OS的Python 3中安装了Anaconda。 我的Mac笔记本电脑正在Bootcamp上运行。
标签必须使用括号,例如
1 2 3 4 5 6 | plt.figure(1) plt.scatter(pf["age"], pf["friend_count"]) plt.xlabel("age") plt.ylabel("friends count") plt.title("Facebook Friends count by Age") plt.show() |