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

Home » Public Forums » archive » Rotating tick labels in DG
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
Rotating tick labels in DG [message #22162] Wed, 18 October 2000 00:00 Go to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Hey there,

This may be an oft asked question but is there any way to rotate tick labels in direct
graphics? I looked at the online help for all the various [xyz]tick... keywords, but
nowhere was rotation mentioned (that I could see at least). I saw that the capability is
available in OG which is not an option here (I just want to make a "quick" plot).

thanks for any info,

paulv

--
Paul van Delst Ph: (301) 763-8000 x7274
CIMSS @ NOAA/NCEP Fax: (301) 763-8545
Rm.202, 5200 Auth Rd. Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746
Re: Rotating tick labels [message #22544 is a reply to message #22162] Wed, 15 November 2000 00:00 Go to previous message
TomC is currently offline  TomC
Messages: 2
Registered: November 2000
Junior Member
I would have preferred EASY, of course... but, I'll take anything that
works. Thanks, that did do the trick. I was doing something similar, but I
wasn't 'shrinking' the plot area on the page, so that when I tried to create
the labels using XYOUTS, I must have been outside the 'writable' area.
Thanks, David, I appreciate the fast help.

TomC
"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.147c86e1a2107933989c82@news.frii.com...
> TomC (tom_syn58@hotmail.com) writes:
>
>> I am using IDL 5.4 to create PostScript files of plain old X-Y plots.
Some
>> of the plots have usernames as the x-axis tick labels. When there are
lots
>> of users, or long names and lots of users, the labels overwrite each
other,
>> creating an un-readable mess. Is there an easy way to have the tick
labels
>> created at an angle? Thanks in advance.
>
> I have a short section in my book about how this can be done.
> I was going to take it out of the 2nd Edition because I was
> trying to save pages and I thought "who would ever need to
> know how to do this?". But at the last minute I left it in.
> You never know. :-)
>
> Anyway, if you mean by "easy" some kind of keyword switch,
> then the answer is "no". But is is not too hard either.
>
> Suppose you are going to have 5 tick intervals, labeled
> with 6 tick labels on the X axis:
>
> numticks = 5
> labels = ['One', 'Two', 'Three', 'Four', 'Five', 'Six']
>
> Draw the plot, leaving some room for the rotated labels:
>
> Plot, findgen(11), XTickFormat='(A1)', XStyle=1, $
> XTicks=numticks, Position=[0.1, 0.2, 0.85, 0.95]
>
> Calculate positions for the labels:
>
> ypos = Replicate(!Y.Window[0] - 0.04, numticks+1)
> xpos = !X.Window[0] + (!X.Window[1] - !X.Window[0]) * $
> Findgen(numticks + 1) / numticks
>
> Position the labels:
>
> FOR j=0, numticks DO XYOutS, xpos[j], ypos[j], $
> labels[j], Alignment=0.0, Orientation=-45, /Normal
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: davidf@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
Re: Rotating tick labels [message #22546 is a reply to message #22162] Wed, 15 November 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
TomC (tom_syn58@hotmail.com) writes:

> I am using IDL 5.4 to create PostScript files of plain old X-Y plots. Some
> of the plots have usernames as the x-axis tick labels. When there are lots
> of users, or long names and lots of users, the labels overwrite each other,
> creating an un-readable mess. Is there an easy way to have the tick labels
> created at an angle? Thanks in advance.

I have a short section in my book about how this can be done.
I was going to take it out of the 2nd Edition because I was
trying to save pages and I thought "who would ever need to
know how to do this?". But at the last minute I left it in.
You never know. :-)

Anyway, if you mean by "easy" some kind of keyword switch,
then the answer is "no". But is is not too hard either.

Suppose you are going to have 5 tick intervals, labeled
with 6 tick labels on the X axis:

numticks = 5
labels = ['One', 'Two', 'Three', 'Four', 'Five', 'Six']

Draw the plot, leaving some room for the rotated labels:

Plot, findgen(11), XTickFormat='(A1)', XStyle=1, $
XTicks=numticks, Position=[0.1, 0.2, 0.85, 0.95]

Calculate positions for the labels:

ypos = Replicate(!Y.Window[0] - 0.04, numticks+1)
xpos = !X.Window[0] + (!X.Window[1] - !X.Window[0]) * $
Findgen(numticks + 1) / numticks

Position the labels:

FOR j=0, numticks DO XYOutS, xpos[j], ypos[j], $
labels[j], Alignment=0.0, Orientation=-45, /Normal

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL Programming Techniques, 1st edition on ebay
Next Topic: Julian Day Numbers

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

Current Time: Wed Oct 08 13:49:09 PDT 2025

Total time taken to generate the page: 0.00709 seconds