本文介绍了绘制 Windrose:使污染上升,浓度设置为颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试绘制风玫瑰图,绘制速度和方向,浓度决定颜色.不幸的是,matplotlib 只支持两个变量.可以制作一个很好的散点图,显示我想要的内容,但不确定如何将其合并,使其像附加的图像一样显示出来(Halliday 等人,2016 年).
Trying to plot a windrose diagram with speed and direction being plotted and the concentration determining the color. Unfortunately, matplotlib only supports two variables. Can make a nice scatter that shows what I want but not sure how to bin it so that it comes out like the image attached (Halliday et al 2016).
应该变成windrose的散点图.颜色标记的高浓度区域
Scatter plot that should be turned into windrose. Areas of high concentration marked by color
我想重新创建的纸上的图像
image from paper that I would like to recreate
推荐答案
显示的图可以使用 pcolormesh
创建.
The plots shown can be created using a pcolormesh
.
import matplotlib.pyplot as plt
import numpy as np
theta = np.linspace(0,2*np.pi)
r = np.linspace(2,15,16)
Theta, R = np.meshgrid(theta, r)
C = np.sinc(Theta-2)+(5-np.sqrt(R))+np.random.rand(len(r),len(theta))
C = np.ma.masked_less_equal(C,2)
fig, ax = plt.subplots(subplot_kw={"projection":"polar"})
ax.pcolormesh(Theta, R, C, vmin=2, vmax=5)
plt.show()
这篇关于绘制 Windrose:使污染上升,浓度设置为颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!