I have been trying to move the yticklabel without any success so far. No matter what the verticalaligment
and horizontalalignment
, the location of the yticklabels, in this instance 0.5, 1.0, 1.5 will always be the same.
I want to put it below the horizontal line. Changing the rlabel
will rotate the lables, i only want to transform them below the line.
import numpy
from windrose import WindroseAxes
import matplotlib.pyplot as plt
rose_angle = [25, 45, 45, 90, 125, 142, 165]
damage = [1, 1, 3, 1, 2, 1.3, 3]
ax = WindroseAxes.from_ax()
viridis = plt.get_cmap('viridis')
ax.bar(rose_angle, damage, normed=False, opening=0.8, edgecolor='white', nsector=36, cmap=viridis, bins=[1., 1.5, 2.01])
ax.set_xticklabels(['90$^0$', '', '0$^0$', '', '', '', '0$^0$', ''])
ax.set_theta_zero_location("N")
ax.set_rlabel_position(270) # get radial labels away from plotted line
ax.set_legend(labels = ['Tensile Dominant', 'Shear Dominant', 'Mixed Mode'], title="Failure Mode", bbox_to_anchor=(0.005 , 0.95), loc='center')
ax.set_yticks(numpy.arange(0.5, 2, step=0.5))
ax.set_yticklabels(numpy.arange(0.5, 2, step=0.5), verticalalignment='bottom', horizontalalignment='right')
plt.suptitle("Time Step")
plt.show()
The alignment of polar gridlabels being ignored is an issue in matplotlib 2.2.2. It has been fixed via https://github.com/matplotlib/matplotlib/pull/10792 and is hence available from matplotlib 2.2.3 on.