我的代碼:Matplotlib - AttributeError錯誤:未知的屬性製造商
from matplotlib import pyplot as plt
years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
gdp = [300.2, 543.3, 1075.9, 286.5, 5979.6, 10289.7, 14958.3]
plt.plot(years, gdp, color= 'green', maker='o', linestyle= 'solid')
plt.title("Nominal GDP")
plt.ylabel("Billions of $")
plt.show()
我在Python 3.6.2運行這個程序,但我得到的所有類型的錯誤。下面是我得到的錯誤
Traceback (most recent call last):
File "C:\Python Programs\Python 3.4\test1.py", line 6, in plt.plot(years, gdp, color= 'green', maker='o', linestyle= 'solid')
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\pyplot.py", line 3317, in plot ret = ax.plot(*args, **kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib__init__.py", line 1898, in inner return func(ax, *args, **kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\axes_axes.py", line 1406, in plot for line in self._get_lines(*args, **kwargs):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\axes_base.py", line 407, in _grab_next_args for seg in self._plot_args(remaining, kwargs):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\axes_base.py", line 395, in _plot_args seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\axes_base.py", line 302, in _makeline seg = mlines.Line2D(x, y, **kw)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\lines.py", line 431, in init self.update(kwargs)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 885, in update for k, v in props.items()]
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 885, in for k, v in props.items()]
File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\artist.py", line 878, in _update_property raise AttributeError('Unknown property %s' % k)
AttributeError: Unknown property maker
有人可以幫忙嗎?
謝謝你這麼大的變化
maker
到。有效。不能相信我沒有看到:) – user7377353