comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Changing the labels orientation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Changing the labels orientation [message #54202] Mon, 28 May 2007 11:53 Go to next message
jujo is currently offline  jujo
Messages: 8
Registered: May 2007
Junior Member
Hello,

I'm using plot command to plot some curves. I'm using XTICKNAME to
define my labels' names in the axis x.

My question is... Can I plot these labels in a vertical orientation??
I need to do that, because my label's names are too long.

Comments welcome,

Cheers!
Hervé
Re: Changing the labels orientation [message #54281 is a reply to message #54202] Tue, 29 May 2007 10:40 Go to previous message
jujo is currently offline  jujo
Messages: 8
Registered: May 2007
Junior Member
On 29 maio, 05:11, Tim <timrobis...@gmail.com> wrote:
> Hi there Hervé,
>
> Here's how you could do it in an almost general fashion:
>
> x = findgen(100)*1d19
> y = sqrt(x)
> charsize=2.0
> ; PLOT THE DATA, DON'T LABEL THE X AXIS AND RETURN THE XTICK VALUES...
> plot, x, y, XTICKFORMAT='(A1)', XTICK_GET=xticks, YMARGIN=[9,2], $
> CHARSIZE=charsize
> ; CONVERT THE XTICK VALUES TO NORMALIZED POSITION...
> xtickpos = !x.s[0] + !x.s[1]*xticks
> ; GET THE CHARACTER HEIGHT AND WIDTH IN NORMALIZED COORDINATES...
> y_ch_size = charsize * float(!d.y_ch_size) / !d.y_vsize
> x_ch_size = charsize * float(!d.x_ch_size) / !d.x_vsize
> ; PUT THE LABELS AT THE APPROPRIATE TICK POSITIONS...
> xyouts, xtickpos+0.5*x_ch_size, !y.window[0]-0.5*y_ch_size, /NORM,
> xticks, $
> ALIGN=1.0, ORIENTATION=90.0, CHARSIZE=charsize
>
> It sounds like in your case you already have the value of xticks and
> rather than retrieving xticks via XTICKS_GET, you'll probably be
> specifying the tick values immediately using XTICKS and XTICKV. You
> can change the ORIENTATION to 45 to save a little more room for the
> plot.
>
> Hope this helps! Best -Tim.


Thanks Tim, the code is fine!!
Best!
Re: Changing the labels orientation [message #54289 is a reply to message #54202] Tue, 29 May 2007 01:11 Go to previous message
Robi is currently offline  Robi
Messages: 9
Registered: October 2006
Junior Member
Hi there Hervé,

Here's how you could do it in an almost general fashion:

x = findgen(100)*1d19
y = sqrt(x)
charsize=2.0
; PLOT THE DATA, DON'T LABEL THE X AXIS AND RETURN THE XTICK VALUES...
plot, x, y, XTICKFORMAT='(A1)', XTICK_GET=xticks, YMARGIN=[9,2], $
CHARSIZE=charsize
; CONVERT THE XTICK VALUES TO NORMALIZED POSITION...
xtickpos = !x.s[0] + !x.s[1]*xticks
; GET THE CHARACTER HEIGHT AND WIDTH IN NORMALIZED COORDINATES...
y_ch_size = charsize * float(!d.y_ch_size) / !d.y_vsize
x_ch_size = charsize * float(!d.x_ch_size) / !d.x_vsize
; PUT THE LABELS AT THE APPROPRIATE TICK POSITIONS...
xyouts, xtickpos+0.5*x_ch_size, !y.window[0]-0.5*y_ch_size, /NORM,
xticks, $
ALIGN=1.0, ORIENTATION=90.0, CHARSIZE=charsize

It sounds like in your case you already have the value of xticks and
rather than retrieving xticks via XTICKS_GET, you'll probably be
specifying the tick values immediately using XTICKS and XTICKV. You
can change the ORIENTATION to 45 to save a little more room for the
plot.

Hope this helps! Best -Tim.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: displaying an image in simple geographic coordinates
Next Topic: Using .sav files outside of IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:58:04 PDT 2025

Total time taken to generate the page: 0.00498 seconds