Reputation: 732
I want to put an array of words in xlim( [ ] ) in place of a range of numbers. using normal python and matplotlib.
Like this:
ax.set_xlim(['week1', 'week2', 'week3', 'week4', 'week5', 'week6', 'week7', 'week8', 'week9', 'week10'])
What is the best way to achieve this?
Upvotes: 2
Views: 152
Reputation: 190
You want matplotlib.pyplot.xticks
. Something like:
# set the locations and labels of the xticks
plt.xticks( arange(10), ('week1', 'week2', 'week3', 'week4', 'week5', 'week6', 'week7', 'week8', 'week9', 'week10') )
Where instead of arange(10)
, you want an array of the x values of your data.
Upvotes: 4