1

I'm creating a wind graph and used a polar plot with a single bar for the wind rose. Now I would like this bar to show the wind speed by changing its color acccordingly and have a color gradient in the plot legend (with matching speed values). Can this be done by the heatmap/imshow plots from matplotlib or do I need to modify the color myself using a function?

# Polar plot: wind rose
theta = np.linspace(0,360,17)
labels = ['N', 'NNO','NO', 'ONO', 'O', 'OZO', 'ZO', 'ZZO', 'Z', 'ZZW', 
'ZW', 'WZW', 'W', 'WNW', 'NW', 'NNW']

ax = plt.subplot(projection='polar')
ax.bar((2*np.pi*wDir['Value'])/360, 1, width=0.2, color='r' ,alpha=1)
# set theta axis
ax.set_theta_zero_location('N')
ax.set_theta_direction(-1)
ax.set_thetagrids(theta, labels=labels)
# set radii axis
ax.set_ylim(0,1)
ax.get_yaxis().set_ticklabels([])
ax.set_title('Wind direction', pad=20)
plt.show()
SReub
  • 11
  • 2

0 Answers0