【问题标题】:subplots in windrose diagramWindrose图中的子图
【发布时间】:2019-11-23 11:04:15
【问题描述】:

我是 python 的初学者。通过遵循this 示例,我尝试制作风玫瑰子图,例如:

但我以这种方式得到情节:

The code that I tried is: 
ws = np.random.random(500) * 6
wd = np.random.random(500) * 360

fig=plt.figure()
rect=[0,0.5,0.4,0.4] 
wa=WindroseAxes(fig, rect)
fig.add_axes(wa)
wa.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')

fig1=plt.figure()
rect1=[0, 0.1, 0.4, 0.4]
wa1=WindroseAxes(fig1, rect1)
fig1.add_axes(wa1)
wa1.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')

plt.show()

感谢任何帮助/建议。

【问题讨论】:

  • 所以你的问题是子图是垂直堆叠的而不是水平的?您需要更改您的 rect 坐标来解决此问题。
  • @BenT 正是我想要水平的子图。

标签: python matplotlib rose-diagram windrose


【解决方案1】:

要使您的子图保持水平,您需要在创建图形轴时切换数字。指定轴时rect = [lowerleft_x,lowerleft_y,width,height]

另请注意,执行此操作时不需要创建新图形。

ws = np.random.random(500) * 6
wd = np.random.random(500) * 360

fig=plt.figure()
rect=[0.5,0,0.4,0.4] 
wa=WindroseAxes(fig, rect)
fig.add_axes(wa)
wa.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')

rect1=[0.1, 0, 0.4, 0.4]
wa1=WindroseAxes(fig, rect1)
fig.add_axes(wa1)
wa1.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')

plt.show()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-31
    • 2018-08-31
    • 2019-03-22
    • 2016-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多