Fanning Software Consulting

Changing Text Orientation

QUESTION: Is there any way to change the text orientation of axis labels for IDL graphics plots? For example, I've just added an axis to the right hand side of a contour plot using the AXIS procedure, and labeled it using the YTitle keyword. But I want the text to read vertically downward and not upward from left to right as it currently does. That is, I want to rotate each character 90 degrees clockwise. Is this possible?

ANSWER: Yes, it is possible, but not with the YTitle keyword you are using now. You will have to place the title on the contour plot with the XYOutS command. You will rotate the text with the Orientation keyword. Here is an example of what the code might look like:

   position = [0.15, 0.15, 0.8, 0.9]
   Contour, Dist(41), XStyle=1, YStyle=9, $
     Position=position, XTickFormat='(A1)', $
     YTitle='This is the Normal Y Title'
   Axis, YAxis=1, YRange=[0,40]
   xloc = !X.Window[1] + 0.075
   yloc = (0.9 - 0.15) / 2.0 + 0.15
   XYOutS, xloc, yloc, 'This is the Reversed Y Title', Alignment=0.5, $
     Orientation=-90.0, /Normal

You can see the results in the figure below.

Contour plot with Y title reversed.

[Return to IDL Programming Tips]