pandas Seaborn 情节没有出现
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33620940/
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
Seaborn Plot doesn't show up
提问by Shelley Hoover
I am creating a bar chart with seaborn, and it's not generating any sort of error, but nothing happens either.
我正在用 seaborn 创建一个条形图,它没有产生任何错误,但也没有任何反应。
This is the code I have:
这是我的代码:
import pandas
import numpy
import matplotlib.pyplot as plt
import seaborn
data = pandas.read_csv('fy15crime.csv', low_memory = False)
seaborn.countplot(x="primary_type", data=data)
plt.xlabel('crime')
plt.ylabel('amount')
seaborn.plt.show()
I added "seaborn.plt.show() in an effort to have it show up, but it isn't working still.
我添加了“seaborn.plt.show() 以使其显示出来,但它仍然无法正常工作。
回答by Joe T. Boka
You should place this line somewhere in the top cell
in Jupyter to enable inline plotting:
您应该将此行放在cell
Jupyter顶部的某个位置以启用内联绘图:
%matplotlib inline
回答by Leb
It's simply plt.show()
you were close. No need for seaborn
只是plt.show()
你很接近。不需要seaborn