On 09/10/2010 10:54 AM, Brian Larsen wrote: > Hello all, > > I feel like this is possible but I am having trouble figuring it out. > > I want to put extra labels on the ticks on the xaxis like in the upper > panel of the figure > http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif > > Following > http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html > doesn't seem to be the right thing. > > It seems that I can get the tick values from > ax= gca() > ax.get_xticks() > > and from here do the calculations on what the other labels should be > (interpolate the spacecraft position). > > but then how do a create another row of labels with the values that > compute? For some reason > ax.get_xmajorticklabels()[0].get_text() returns '' > > Thanks much, > > Brian
Brian, Tick labels can have multiple lines, so you don't need extra axes. If you don't mind setting the tick locations yourself, then you can do this: plot([1,2,3]) ax = gca() ax.set_xticks([0,1,2]) ax.set_xticklabels(['abc\nABC', 'def\nDEF\n123', 'qrz']) draw() # or show() if you are not in interactive mode If you need to have the ticks auto-generated using a Locator, then you can write a custom Formatter that does the calculations and generates the multi-line labels. Eric ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users