Reputation: 21
My graph has Xticks Yticks , Xlabels , Ylabels .
My Code
firmwareList = self.firmware # Gets the list of all firmwares , this is a list
I need to put this firmware data under each bar .
Basically i need to put the build version below the X axis for each bar.
Example |
|
|
|
|
|
|____________________
0.0.1 0.0.2 0.0.3
I have already used Xticks, Xlabels .
How do i put the data on the x axis. its a list.
Upvotes: 2
Views: 697
Reputation: 284602
Maybe I'm misunderstanding things, but based on your comments to @ars, simply putting appending \n
and the firmware version to your xticklabels should do what you want... (I'm posting this as an answer so that I can include an example image) E.g.:
import matplotlib.pyplot as plt
plt.bar(range(3), [10,20,30], align='center')
plt.xticks(range(3), ['frogs\n1.0.0', 'turtles\n1.0.1', 'cheetas\n2.0.0'])
plt.show()
Is that what you wanted, or are you needing something more complex?
Upvotes: 2
Reputation: 123498
You should be able to do this with the second argument to xticks
function:
xticks(arange(3), ('firmware 1', 'firmware 2', 'firmware 3'))
Update: I think the following first example named "tick label like annotations" on the Matplotlib Transformations page of the SciPy cookbook covers the general method you're after.
Note that there was an API change, so line 4 should be:
blend = M.transforms.blended_transform_factory
Upvotes: 1