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

Home » Public Forums » archive » Re: Altered device coordinates after first call
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
Re: Altered device coordinates after first call [message #50831] Mon, 16 October 2006 12:25
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Juan Arrieta writes:

> Wow Dave, thanks a lot.
> Your suggestions (as expected) worked like a charm. I really
> appreciate them.

That's why I get paid the big bucks on this newsgroup. :-)
>
> It is much better, as you suggest, to first set up the plots, and them
> draw the frames and margins.
>
> Another situation is still freaking me out: after I run the code, the
> SECOND time the direct graphics appear yellow! (the first ones are
> white). I have nothing against that color, but I did not request it!
> This happens to me all the time, when I change the device and set it
> back. My device is "X".
>
> I will look into the yellow problem, but the code now works as
> expected.

If you are actually using a NASA logo, rather than what
you showed us here, I would guess that some colors get loaded
to show that image. A simple fix would just be to load a
color table first (this should probably be done *anyway*
if colors are important to you, and when are they NOT?):

LoadCT, 0, /Silent

> Many thanks, I owe you a beer (after all your suggestions, maybe I
> should get a keg :)

When I find a real job, we call ALL celebrate! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Altered device coordinates after first call [message #50832 is a reply to message #50831] Mon, 16 October 2006 12:10 Go to previous message
Juan Arrieta is currently offline  Juan Arrieta
Messages: 6
Registered: February 2006
Junior Member
Wow Dave, thanks a lot.
Your suggestions (as expected) worked like a charm. I really
appreciate them.

It is much better, as you suggest, to first set up the plots, and them
draw the frames and margins.

The NASA logo and others are created outside of the margin (the
screen) because I'm not interested in viewing them on the screen, but
when you create the PS output, they do appear as "footnotes" in the
paper. This is important when creating a printed report, where I do
want the NASA logo to appear, and my name. I should also add a "thanks
to Dave Fanning" in that section :)

Another situation is still freaking me out: after I run the code, the
SECOND time the direct graphics appear yellow! (the first ones are
white). I have nothing against that color, but I did not request it!
This happens to me all the time, when I change the device and set it
back. My device is "X".

I will look into the yellow problem, but the code now works as
expected.

Many thanks, I owe you a beer (after all your suggestions, maybe I
should get a keg :)

/ Juan Arrieta

David Fanning wrote:
> David Fanning writes:
>
>> FOR J = 0,5 DO PLOT, FINDGEN(10), noerase=(j EQ 0)
>
> WHOOPS! That NOERASE was an experiment and wasn't suppose
> to be there. Sorry. The line should read:
>
> FOR J = 0,5 DO PLOT, FINDGEN(10)
>
> Note that this code produces decent PostScript output,
> except that your NASA logo and title are inside of
> your avowed 5% margin.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Altered device coordinates after first call [message #50836 is a reply to message #50832] Mon, 16 October 2006 09:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> FOR J = 0,5 DO PLOT, FINDGEN(10), noerase=(j EQ 0)

WHOOPS! That NOERASE was an experiment and wasn't suppose
to be there. Sorry. The line should read:

FOR J = 0,5 DO PLOT, FINDGEN(10)

Note that this code produces decent PostScript output,
except that your NASA logo and title are inside of
your avowed 5% margin.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Altered device coordinates after first call [message #50837 is a reply to message #50836] Mon, 16 October 2006 09:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Humm. Well, there is a LOT going wrong in this code. :-)

This gets you closer to where you want to be, although you
are still drawing the logo off the page! :-)

Cheers,

David

;*********************************************************** **
PRO TSTDIAGRAM
; EXAMPLE FOR TESTING THE OUTPUT IN A LETTER-SIZE DEVICE (8.5X11)

; SET THE DEVICE (8.5X11IN PAPER (LANDSCAPE), WITH ONE INCH MARGINS)
thisDevice = !D.NAME
;SET_PLOT,'PS'
;DEVICE,/INCHES,FILENAME='TST.ps',XSIZE=9.0,YSIZE=
6.5,/LANDSCAPE,XOFFSET=1.0,YOFFSET=10.0


;;; THE REST OF THE CODE IS WHERE I WOULD BE ADDING MY PLOTS

!Y.OMARGIN = [3.5,3.5]
!P.MULTI=[0,3,2]
FOR J = 0,5 DO PLOT, FINDGEN(10), noerase=(j EQ 0)

; EDGE COORDINATES
X0 = 0.0
X1 = 1.0
Y0 = 0.0
Y1 = 1.0

; BOX
PLOTS,[0,0],[0,1], /NORMAL
PLOTS,[0,1],[1,1], /NORMAL
PLOTS,[1,1],[1,0], /NORMAL
PLOTS,[1,0],[0,0], /NORMAL
; HEADER AND FOOTER
PLOTS,[0,1],[0.95,0.95], /NORMAL
PLOTS,[0,1],[0.05,0.05], /NORMAL
; HEADER AND FOOTER BINS
PLOTS,[0.25,0.25],[1.0,0.95], /NORMAL ; SECOND HEADER BIN
PLOTS,[0.50,0.50],[1.0,0.95], /NORMAL ; THIRD HEADER BIN
PLOTS,[0.75,0.75],[1.0,0.95], /NORMAL ; FOURTH HEADER BIN
PLOTS,[0.25,0.25],[0.0,0.05], /NORMAL ; SECOND FOOTER BIN
PLOTS,[0.50,0.50],[0.0,0.05], /NORMAL ; THIRD FOOTER BIN
PLOTS,[0.75,0.75],[0.0,0.05], /NORMAL ; FOURTH FOOTER BIN


; NASA LOGO AND "PREPARED BY" STRING
NASA = '!10nasa!N!X'
XYOUTS,0,-0.05,NASA,SIZE=2, /NORMAL
XYOUTS,1,-0.05,'Prepared by J. J. Arrieta-Camacho',ALIGN=1.0, /NORMAL

; TITLE
XYOUTS,0.5,1.025,'December 18, 2018',ALIGN=0.5,SIZE=2.5, /NORMAL

; EARTH, MOON, AND OTHER SYMBOLS
EARTH = '!20S!N!X'
MOON = '!20V!N!X'
EQUINOX = '!20x!N!X'
DELTA = '!4D!N!X'
RAAN = '!4X!N!X'
TRAN = '!4x!N!X'

; DIRECTION OF MANEUVER (EARTH-MOON OR MOON-EARTH) PLACED IN THE FIRST
; HEADER BIN
STR = 'Maneuver: '+EARTH+' - '+MOON
XYOUTS,(0.25-0.0)/2.0,0.965,STR,ALIGN=0.5,CHARSIZE=1.5, /NORMAL

; TYPE OF MANEUVER
STR = 'Ballistic (TLI)'
XYOUTS,0.25+(0.5-0.25)/2.0,0.965,STR,ALIGN=0.5,CHARSIZE=1.5, /NORMAL

; RADIUS OF EARTH PARKING ORBIT
STR = '!SH!D'+EARTH+'!N'+'='+'200 km'
XYOUTS,0.50+(0.75-0.50)/2.0,0.965,STR,ALIGN=0.5,CHARSIZE=1.5 , /NORMAL

; RADIUS OF MOON TARGET ORBIT (PERIAPSIS)
STR = '!SH!D'+MOON+'!N'+'='+'200 km'
XYOUTS,0.75+(1.05-0.75)/2.0,0.965,STR,ALIGN=0.5,CHARSIZE=1.5 , /NORMAL



; COORDINATE SYSTEM
STR = 'TEME J2000'
XYOUTS,0.0+(0.25-0.00)/2.0,0.015,STR,ALIGN=0.5,CHARSIZE=1.5, /NORMAL

; RIGHT ASCENSION OF THE ASCENDING NODE (TRANSFER ORBIT)
STR = RAAN + '=' + '237.45 deg'
XYOUTS,0.25+(0.50-0.25)/2.0,0.015,STR,ALIGN=0.5,CHARSIZE=1.5 , /NORMAL

; TRANSFER TIME
STR = 'TLC '+'='+'72.012 h'
XYOUTS,0.50+(0.75-0.50)/2.0,0.015,STR,ALIGN=0.5,CHARSIZE=1.5 , /NORMAL

; DELTA-V
STR = DELTA+'V'+'='+'3.4526 km/s'
XYOUTS,0.75+(1.00-0.75)/2.0,0.015,STR,ALIGN=0.5,CHARSIZE=1.5 , /NORMAL



;DEVICE,/CLOSE
SET_PLOT,thisDevice
!P.MULTI=0
END
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Altered device coordinates after first call [message #50838 is a reply to message #50837] Mon, 16 October 2006 09:36 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Juan Arrieta writes:

> Please have a look at my code, the data is of course fictitious, but
> the general idea is to produce a nice looking letter-size output. If
> you want to see the PS, uncomment the corresponding lines. The code as
> it is will produce a direct graphics plot.

Humm. Well, there is a LOT going wrong in this code. :-)

The main thing is that you are drawing graphics in DATA
coordinates, but you haven't established a DATA coordinate
system in the code. So it's using the *last* one that did
get established, which could be anything at all. That's
why you can't reproduce anything.

It looks to me like you want to draw graphics in a NORMAL
(normalized) coordinate system. If so, you will need to set
a NORMAL keyword on all your PLOTS and XYOUTS commands.

I would also draw the plots *first*, then put all the
annotation on the plots. It is the NOERASE keyword on
your PLOT commands that I think is really screwing you
up here. I see why you want to do it, since all your
annotation disappears when the first plot is drawn, but
it plays absolute havoc with your data coordinate system.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Altered device coordinates after first call [message #50839 is a reply to message #50838] Mon, 16 October 2006 09:24 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Juan Arrieta writes:

> Please have a look at my code, the data is of course fictitious, but
> the general idea is to produce a nice looking letter-size output. If
> you want to see the PS, uncomment the corresponding lines. The code as
> it is will produce a direct graphics plot.

In the example code, you have a NOERASE on the PLOT command.
Do you have this keyword on the real plots in your original code?
If so, I would remove it and see if things go better for you. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IImage Command Line
Next Topic: Re: IDL's built-in function DILATE and ERODE doesn't work as described in help

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

Current Time: Fri Oct 10 00:28:59 PDT 2025

Total time taken to generate the page: 1.83996 seconds