I draw several boxes on the same shape using matplotlib, following the example here:
http://matplotlib.org/examples/pylab_examples/subplots_demo.html
Everything works as expected, but I can't figure out how to change the label labels on the x axis. I have four rows of data that are being built, but the x-axis ticks are labeled “1, 2, 3, 4,” where I would like to assign text to these values.
My build code is as follows:
f, axarr = plt.subplots(2, sharex=True) axarr[0].boxplot(WS_Bias, whis = 100) #axarr[0].xticks(range(1, len(Labels)+1),Labels) axarr[0].axhspan(-0.5, 0.5, facecolor='c', alpha = 0.2) axarr[1].boxplot(WS_RMS, whis = 100) #axarr[1].xticks(range(1, len(Labels)+1),Labels) axarr[1].axhspan(0, 2, facecolor='c', alpha = 0.2) pl.show()
The recorded lines worked on changing labels when I was dealing with only one data set, but this command is not recognized by the methods that I use. Pyplot is imported as plt.
source share