[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Rotating tick labels
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.
"David Fanning" <email@example.com> wrote in message
> TomC (firstname.lastname@example.org) writes:
> > I am using IDL 5.4 to create PostScript files of plain old X-Y plots.
> > of the plots have usernames as the x-axis tick labels. When there are
> > of users, or long names and lots of users, the labels overwrite each
> > creating an un-readable mess. Is there an easy way to have the tick
> > 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.04, numticks+1)
> xpos = !X.Window + (!X.Window - !X.Window) * $
> 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
> David Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438 E-Mail: email@example.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155