Re: Rotating axis labels [message #56086] |
Thu, 04 October 2007 08:46 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Melanie writes:
> I am trying to format some plots to look nice for a presentation and I
> am having trouble with my tick labels on the x axis. Each label is a
> variable name and there are 20 of them, so just printing them under
> the axis makes them all run together and thus illegible. Is there
> some way after setting the xtickname to an array of variable names to
> then rotate each name so that it can sit at maybe a 45 degree angle or
> perpendicular to the axis?
What you will want to do is turn axis annotation off of
that axis and get the tick values. Something like this:
IDL> numticks = 5
IDL> Plot, dates, curve, XTickFormat='(A1)', XTick_Get=tickValues, $
XTicks=numticks
Then the labels will be attached with the XYOUTS command. You can use
the ![XY].Window system variables to find the end-points of the X and Y
axes in normalized coordinates. This information is critical for
positioning the labels correctly. Your code will look something
like this:
IDL> ypos = Replicate(!Y.Window[0] - 0.04, numticks+1)
IDL> xpos = !X.Window[0] + (!X.Window[1]) - !X.Window[0]) * $
FIndGen(numTicks+1)/numTicks
IDL> FOR j=0,numTicks DO XYOutS, xpos[j], ypos[j], $
Alignment=0.0, Orientation=-45, /Normal
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|