get_xmajorticklabels() returns a list of matplotlib's "Text" objects,
not python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=get_xmajorticklabels#matplotlib.axes.Axes.get_xmajorticklabels

On the other hand, set_xticklabels() takes a list of python strings.

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=set_xticklabels#matplotlib.axes.Axes.set_xticklabels


Something like below will work.

plt.setp(plt.gca().get_xmajorticklabels(),
         size=6,rotation=30)


-JJ



On Mon, Jul 20, 2009 at 11:48 AM, John [H2O]<washa...@gmail.com> wrote:
>
> I am trying simply to shrink the font size and rotate xaxis labels:
>
> fig1 = plt.figure()
> ax1 = fig1.add_subplot(211)
> ax2 = fig1.add_subplot(212)
> ax1.plot_date(x,y,'r')
> ax1.set_xticklabels(plt.gca().get_xmajorticklabels(),
>                    size=6,rotation=30)
> ax2.plot_date(o_X['time'],o_X['CO'],'y')
> ax2.set_xticklabels(plt.gca().get_xmajorticklabels(),
>                     size=6,rotation=30)
>
> I end up with labels as:  ("Text(0,0"Text(0,0,"")")
>
> ????
> --
> View this message in context: 
> http://www.nabble.com/rotating-labels%2C-what-is-wrong-%21-tp24572302p24572302.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to