【发布时间】:2016-06-07 15:52:34
【问题描述】:
我在 64 位 Windows 10 桌面上使用 Windows 7。我正在尝试根据给定的代码绘制图表:
import matplotlib.pyplot as plt
from collections import Counter
def make_chart_simple_line_chart(plt):
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3]
# create a line chart, years on x-axis, gdp on y-axis
plt.plot(years, gdp, color='green', marker='o', linestyle='solid')
# add a title
plt.title("Nominal GDP")
# add a label to the y-axis
plt.ylabel("Billions of $")
plt.show()
我查看了其他问题,但似乎找不到答案,除非我看错了地方。我检查了后端,它是“Qt4Agg”,我认为它应该是正确的后端,但它仍然没有显示。我没有收到任何错误,只是没有显示情节。我对 Python 很陌生,所以这对我有很大帮助。谢谢!
【问题讨论】:
标签: python python-2.7 matplotlib plot anaconda