Python玫瑰图表

时间:2016-03-05 20:32:53

标签: python-2.7 numpy

我试图建立一个windrose图表。我找到了这个代码的链接: (http://youarealegend.blogspot.no/2008/09/windrose.html

我收到以下错误,指向numpy: C:\ Python27 \ lib \ site-packages \ numpy \ core \ fromnumeric.py:2768:RuntimeWarning:在rint中遇到无效值   返回(小数,输出)

有没有人遇到过这个?

这是代码:

from windrose import WindroseAxes
from matplotlib import pyplot as plt
import matplotlib.cm as cm
from numpy.random import random
from numpy import arange

#Create wind speed and direction variables
ws = random(500)*6
wd = random(500)*360

#A quick way to create new windrose axes...
def new_axes():
    fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w')
    rect = [0.1, 0.1, 0.8, 0.8]
    ax = WindroseAxes(fig, rect, axisbg='w')
    fig.add_axes(ax)
    return ax

#...and adjust the legend box
def set_legend(ax):
    l = ax.legend(borderaxespad=-0.10)
    plt.setp(l.get_texts(), fontsize=8)

#A stacked histogram with normed (displayed in percent) results :

ax = new_axes()
ax.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
set_legend(ax)

0 个答案:

没有答案