• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

python画风玫瑰图出现attributeerror:unknown property axisbg错误

# -- coding: utf-8 --import xlrd
import xlrd
import matplotlib as mpl
import matplotlib.cm as cm
from matplotlib import pyplot as plt
from windrose import WindroseAxes
from numpy.random import random
from datetime import datetime


mpl.rcParams['font.sans-serif'] = ['SimHei']  #指定默认字体
#画风向风速玫瑰图
ws = random(500) * 6
wd = random(500) * 360
def new_axes():   #定义函数
    fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w')
    rect = [0, 0, 1, 1]
    ax = WindroseAxes(fig, rect, axisbg='w')
    fig.add_axes(ax)
    return ax
#...and adjust the legend box
#标签图例
def set_legend(ax):
    l = ax.legend(shadow=False, bbox_to_anchor=[1, 0])
    plt.setp(l.get_texts(), fontsize=12)
#读取数据
#for sn in range(2):     #2个sheet中都有数据,一次绘制多个风玫瑰图
        #workspace=(r"……工作空间")
mybook=xlrd.open_workbook(r'fxfs.xlsx')#打开文件
mysheet=mybook.sheet_by_index(0)
rows=mysheet.nrows








ws=mysheet.col_values(5)   #风向
wd=mysheet.col_values(6)   #风速
ws.pop(0)
ws.pop(0)
wd.pop(0)
wd.pop(0)   


sl=[0,0.2,1.5,3.3,5.4,7.9]     #风速重分类间断点  
ax=new_axes()
#ax.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
ax.contourf(wd,ws,bins=sl,normed=True,cmap=cm.cool) #使用matplotlib内置colormap进行色彩分割
ax.set_title(mysheet.name,fontsize=15,loc='right')


set_legend(ax)
plt.show()




输出错误如图
060004eisi936t7k6nvv39.jpg

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

该方法已经被取消了,现在用facecolor = color来实现

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!