label x-axis with strings, instead of numbers, in matplotlib
January 31st, 2012 by Lawrence David
let’s say you’ve made a bar plot and you want to label the bars by strings (e.g. ‘A’, ‘B’) instead of the default number range. to do with a list of labels named ‘bar_l’:
import pylab as pl
pl.xticks(np.arange(len(bar_l)),bar_l,rotation=45)