简体   繁体   English

windrose:__init __()获得了多个关键字参数值

[英]windrose: __init__() got multiple values for keyword argument

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: 我尝试为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:

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? 怎么了

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(...) . 我犯了一个错误,即用ax.bar(...)ax.contourf(...) ax.bar(...)看到了两次绘制轴的错误。 By running python tried every time to plot these two axis and got the error of multiple values. 通过运行python每次尝试绘制这两个轴并得到多个值的错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 __init__() 为关键字参数“列”获得了多个值 - __init__() got multiple values for keyword argument 'columns' TypeError:__ init __()得到关键字参数&#39;customer&#39;的多个值 - TypeError: __init__() got multiple values for keyword argument 'customer' TypeError:__init __()为关键字参数“ choices”获得了多个值 - TypeError: __init__() got multiple values for keyword argument 'choices' TypeError:“ __ init __()为关键字参数&#39;name&#39;获得了多个值” - TypeError: “__init__() got multiple values for keyword argument 'name'” __init __()为关键字参数“ bar”获得了多个值 - __init__() got multiple values for keyword argument 'bar' __init __()为关键字参数&#39;input_formats&#39;获得了多个值 - __init__() got multiple values for keyword argument 'input_formats' __init__() 为参数“crescator”获得了多个值 - __init__() got multiple values for argument 'crescator' __init__() 为参数“填充”获得了多个值 - __init__() got multiple values for argument 'padding' / __init __()的Django Rest Framework TypeError为关键字参数&#39;read_only&#39;获取了多个值 - Django Rest Framework TypeError at / __init__() got multiple values for keyword argument 'read_only' 在Scrapy中使用规则和请求会引发异常TypeError:__init __()为关键字参数&#39;callback&#39;获得了多个值 - Using Rules and Requests in Scrapy throws exception TypeError: __init__() got multiple values for keyword argument 'callback'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM