Is there a way to plot a color wheel instead of a color bar? I tried with this post Plot a (polar) color wheel based on a colormap using Python/Matplotlib , by doing
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
f = plt.figure(figsize=(10, 8))
ax = f.add_subplot(111)
display_axes = f.add_axes([0.7, 0.75, 0.15, 0.15],
projection='polar')
# This is a nasty hack - using the hidden field to multiply the values
# such that 1 become 2*pi this field is supposed to take values 1 or -1
# only!!
display_axes._direction = 2 * np.pi
norm = matplotlib.colors.Normalize(0.0, 2 * np.pi)
# Plot the colorbar onto the polar axis note - use orientation
# horizontal so that the gradient goes around the wheel rather than
# centre out
quant_steps = 2056
cb = matplotlib.colorbar.ColorbarBase(display_axes,
cmap=matplotlib.cm.get_cmap('hsv',
quant_steps),
norm=norm,
orientation='horizontal',
)
# aesthetics - get rid of border and axis labels
cb.outline.set_visible(False)
xL = [r'$0$', r'$\frac{\pi}{2}$', r'$\pi$', r'$\frac{3\pi}{2}$']
cb.set_ticks([0, np.pi / 2, np.pi, 3 * np.pi * 0.5])
cb.set_ticklabels(xL)
cb.ax.tick_params(labelsize=22, zorder=10)
# display_axes.set_axis_off()
display_axes.set_rlim([-1, 1])
cb.ax.tick_params(axis='both', which='major', pad=30)
However, I cannot make the labels to move further away from the wheel. I think it's because of the display_axes._direction
hack in the code. I was thinking if there was a better way of achieving this.