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

Home » Public Forums » archive » Re: How to rotate a 2-D plot and fit in the same view area ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to rotate a 2-D plot and fit in the same view area ? [message #7131 is a reply to message #7130] Sat, 28 September 1996 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
OK, Gary, *now* I see what you want to do. You were almost there. You write:

> The example given by David will not rotate the labels for x and y axises.
> I think to solve the problem need to use T3D. However I did some tests and
> cannot figure out how to set keywords ROT and TRANS to get the correct plot
> and position for the plot. Please use the following example as the base for
> testing on different conditions.
>
> x=[0,1]
> y=[0,2]
> T3D, /RESET, ROT=[0,0,-90], TRANS=[-1.0, 0.0, 0.0]
> PLOT, x, y, /T3D
>
> T3D, /RESET, ROT=[0,0,-90], TRANS=[-1.3, 0.0, 0.0]
> PLOT, x, y, /T3D, POSITION=[0.5,0.5,0.8,0.8]
>

The second PLOT command above will work. In fact it *does*
work. (Although I had to add a NOCLIP keyword to see the plot.
The result, I think, of round-off considerations on some machines.)
But what you are missing is that the POSITION keyword applies
to the position of the plot in the XY plane. So this plot goes
exactly where you tell it to go.

The problem, of course, is that you didn't want it at the right
position in the XY plane (which you just successfully rotated).
You wanted in the same position in your display window (which
you *didn't* rotate!).

To compensate for the fact that you rotated the XY plane but
not the display window, you have to perform a transformation
of the position coordinates as well. The example program
below does that successfully.

But just one question. *WHY* do you want to do this!? :-)

************************************************
PRO EXAMPLE

; Set up position in display window.

position = [0.5, 0.5, 0.8, 0.8]

; Normal plot.

WINDOW, 0, TITLE='NORMAL PLOT'
x=[0,1]
y=[0,2]
PLOT, x, y, POSITION=position

; Rotate the plot 90 degrees.

WINDOW, 1, TITLE='ROTATED PLOT'
T3D, /RESET, ROT=[0,0,-90], TRANS=[-1.0, 0.0, 0.0]

; Transform the position coordinates to account for NO rotation
; in the display window

temp = position(0)
position(0) = 1.0 - position(2)
position(2) = temp

; Draw the plot at same position in DISPLAY window.

PLOT, x, y, POSITION=position, /T3D, /NOCLIP
END
************************************************

Thanks for the challenging problem!

Yours,

David

--
David Fanning, Ph.D.
Phone: 970-221-0438
Fax: 970-221-4728
E-Mail: davidf@fortnet.org
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: idl can not read TIFF image
Next Topic: Re: Plot Widget under IDL

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

Current Time: Wed Dec 03 08:30:17 PST 2025

Total time taken to generate the page: 0.02535 seconds