1
我知道這不是一個新問題,但是我嘗試使用我看到的博客中的信息並不適合我。我試圖運行WINDROSE這個例子:windrose:__init __()爲關鍵字參數獲得了多個值
from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
import numpy as np
import imp
ws = np.random.random(500) * 6
wd = np.random.random(500) * 360
ax = WindroseAxes.from_ax()
ax.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
ax.set_legend()
ax = WindroseAxes.from_ax()
ax.contourf(wd, ws, bins=np.arange(0, 8, 1), cmap=cm.hot)
ax.set_legend()
ax.bar(wd, ws, normed=True, nsector=16)
table = ax._info['table']
wd_freq = np.sum(table, axis=0)
direction = ax._info['dir']
wd_freq = np.sum(table, axis=0)
plt.bar(np.arange(16), wd_freq, align='center')
但我只得到這個回溯:
Traceback (most recent call last):
File "/home/user/Documents/the_windrose.py", line 31, in <module>
plt.bar(np.arange(16), wd_freq, align='center')
File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 2643, in bar
**kwargs)
File "/home/user/.local/lib/python2.7/site-packages/windrose/windrose.py", line 390, in bar
**kwargs)
TypeError: __init__() got multiple values for keyword argument 'width'
我不明白的問題。這裏有什麼問題?
的可能的複製[類型錯誤:有多個值參數(http://stackoverflow.com/questions/21764770/typeerror-got-multiple-values-for-argument) –
的答案在該職位使描述聽起來就像你在'plt.bar()'方法調用中有一個名爲'width'的變量與可選的'width'參數衝突 –