1

I know this is not a new issue, but everything I tried using the informations from the blogs I saw doesn't work for me. I tried to run this example for windrose:

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')

But I only get this Traceback:

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'

I don't understand the problem. What's wrong here?

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
elly
  • 166
  • 1
  • 2
  • 15
  • Possible duplicate of [TypeError: got multiple values for argument](http://stackoverflow.com/questions/21764770/typeerror-got-multiple-values-for-argument) – OneCricketeer Jan 13 '16 at 22:23
  • The description of the answer in that post makes it sound like you have a variable named `width` somewhere that is conflicting with the optional `width` argument in the `plt.bar()` method call – OneCricketeer Jan 13 '16 at 22:25

1 Answers1

0

Problem is solved! It's pretty simple if you look exactly what the code does. I made the mistake that I plotted the axis twice as you can see in the lines with ax.bar(...) and ax.contourf(...). By running python tried every time to plot these two axis and got the error of multiple values.

elly
  • 166
  • 1
  • 2
  • 15