pandas 绘制数据框熊猫不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25008795/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
plot dataframe pandas not working
提问by Vinay Joseph
I am using pandas to plot a graph. The following is my function
我正在使用Pandas来绘制图表。以下是我的功能
count_subset.plot(kind='barh', stacked=True)
The response I get is
我得到的回应是
<matplotlib.axes.AxesSubplot at 0x111fc4ad0>
I can't see the graph anywhere. Am I missing some library ?
我在任何地方都看不到图表。我错过了一些图书馆吗?
回答by joris
You have to 'show' the plot using matplotlib's show:
您必须使用 matplotlib 的“显示”情节show:
import matplotlib.pyplot as plt
... #plotting code
plt.show()
Another way is, if you use IPython, to activate the matplotlib magic to have it interactively (no need to call show then):
另一种方法是,如果您使用 IPython,则激活 matplotlib 魔法以交互方式使用它(然后无需调用 show):
%matplotlib

