英文:
How can I display plots in PyCharm?
问题
我在PyCharm中出现了可视化图表的问题,但尚未找到解决方案。有人知道如何在PyCharm中查看图表吗?
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df['Score'].value_counts().sort_index().plot(
kind='bar',
title='Count of Reviews by Stars',
figsize=(10, 5)
)
英文:
I have a problem visualizing plots in pycharm, and I haven't found a solution yet.
Does anyone know how to view plots in PyCharm?
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df['Score'].value_counts().sort_index().plot(
kind='bar',
title='Count of Reviews by Stars',
figsize=(10, 5)
)
答案1
得分: 1
你可以在你的脚本末尾添加plt.show()
吗?
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df['Score'].value_counts().sort_index().plot(kind='bar', title='Count of Reviews by Stars',
figsize=(10, 5))
plt.show()
英文:
Can you add plt.show()
at the end of your script?
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df['Score'].value_counts().sort_index().plot(kind='bar', title='Count of Reviews by Stars',
figsize=(10, 5))
plt.show()
答案2
得分: 0
尝试将以下内容放在你的脚本顶部:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
英文:
Try putting this at the top of your script:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论