|
From: thowa <tho...@fo...> - 2010-08-03 11:23:14
|
Hi,
I'm pretty new to Matplotlib and I'm really impressed about the
possibilities !!!
GREAT WORK !!!
I have a figure with 3 subplots like this.
*-------* *------------------------------*
| | | |
| A | | |
| | | |
*-------* | |
| C |
*-------* | |
| | | |
| B | | |
| | | |
*-------* *------------------------------*
I want to have the text on the x-axes rotated, but only for subplot A and B
The text for subplot C should remain unrotated.
Is that is possible?
Best regards,
Thorsten
--
View this message in context: http://old.nabble.com/Rotated-text-for-selected-subplots-tp29334275p29334275.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: John H. <jd...@gm...> - 2010-08-03 12:42:31
|
On Tue, Aug 3, 2010 at 6:23 AM, thowa <tho...@fo...> wrote: > > Hi, > > I'm pretty new to Matplotlib and I'm really impressed about the > possibilities !!! > GREAT WORK !!! > > I have a figure with 3 subplots like this. > > *-------* *------------------------------* > | | | | > | A | | | > | | | | > *-------* | | > | C | > *-------* | | > | | | | > | B | | | > | | | | > *-------* *------------------------------* > > I want to have the text on the x-axes rotated, but only for subplot A and B > The text for subplot C should remain unrotated. All of the text commands "text", "xlabel", "ylabel", "title" take a rotation keyword argument, so you can pass that in and set the angle you want. With an existing text instance, you can call the set_rotation method. Here is a demo that shows some of the rotation modes http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html http://matplotlib.sourceforge.net/examples/pylab_examples/demo_text_rotation_mode.html JDH |
|
From: thowa <tho...@fo...> - 2010-08-04 11:27:37
|
John Hunter-4 wrote: > > On Tue, Aug 3, 2010 at 6:23 AM, thowa <tho...@fo...> wrote: >> >> Hi, >> >> I'm pretty new to Matplotlib and I'm really impressed about the >> possibilities !!! >> GREAT WORK !!! >> >> I have a figure with 3 subplots like this. >> >> *-------* *------------------------------* >> | | | | >> | A | | | >> | | | | >> *-------* | | >> | C | >> *-------* | | >> | | | | >> | B | | | >> | | | | >> *-------* *------------------------------* >> >> I want to have the text on the x-axes rotated, but only for subplot A and >> B >> The text for subplot C should remain unrotated. > > All of the text commands "text", "xlabel", "ylabel", "title" take a > rotation keyword argument, so you can pass that in and set the angle > you want. With an existing text instance, you can call the > set_rotation method. > > I'm afraid, I made myself not clear enough. I want to rotate the numbers on the axis (similar to what autofmt_xdate() is doing). As I understand, autofmt_xdate() is changing the rotation of the numbers for all sub-plots. But I want to do it only for selected subplots. Is that is possible? -- View this message in context: http://old.nabble.com/Rotated-text-for-selected-subplots-tp29334275p29343081.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: thowa <tho...@fo...> - 2010-08-04 12:44:01
|
thowa wrote:
>
>
>
> I'm afraid, I made myself not clear enough.
> I want to rotate the numbers on the axis (similar to what autofmt_xdate()
> is doing).
> As I understand, autofmt_xdate() is changing the rotation of the numbers
> for all sub-plots.
> But I want to do it only for selected subplots.
>
> Is that is possible?
>
I have realized, that it is possible.
e.g. by using
plot.set_xticklabels(bins, rotation=45)
Thanks a lot!
--
View this message in context: http://old.nabble.com/Rotated-text-for-selected-subplots-tp29334275p29344561.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: John H. <jd...@gm...> - 2010-08-04 12:56:39
|
On Wed, Aug 4, 2010 at 6:27 AM, thowa <tho...@fo...> wrote:
> I'm afraid, I made myself not clear enough.
> I want to rotate the numbers on the axis (similar to what autofmt_xdate() is
> doing).
> As I understand, autofmt_xdate() is changing the rotation of the numbers for
> all sub-plots.
> But I want to do it only for selected subplots.
>
> Is that is possible?
Yes, if ax is your subplot instance
for label in ax.get_xticklabels():
label.set_rotation(45)
label.set_horizontalalignment('right')
JDH
|