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

Home » Public Forums » archive » Re: Multiple Plots in PostScript
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: Multiple Plots in PostScript [message #67141 is a reply to message #67139] Mon, 06 July 2009 14:34 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
David Fanning wrote:

> Eventually, I discovered that I had to set !Y.OMargin before
> *every page* of PostScript output, or it would not take effect.
>
> I have *no* idea why this would be the case. I'm only
> reporting what I have observed this morning. :-)

For stuff like this where I do it over and over and over again, I stick all the bits in an
object along with the !p, !x, and !y sysvars. My philosophy has become one of: "If in
doubt save, and then restore, EVERYTHING" :o)

The only reason I mention this here is that I was similarly surprised when the following
worked (for both onscreen and PS output):

I've gotten into the habit of doing the following when I do p.multi plots with objects,

PRO myobj__Define
void = { myobj, $
...other obj data....
; The following components are PRIVATE to the class
; ...Variables for plotting
xsysvar : PTR_NEW(), $ ; X-axis system variable
ysysvar : PTR_NEW(), $ ; Y-axis system variable
psysvar : PTR_NEW() } ; Plotting system variable
END

and then have myobj::save_plotvars and myobj::restore_plotvars methods to save and/or
restore them in the myobj::plot and myobj::oplot methods. E.g. in the Plot method for a
particular object I'm working on now I do:

; Set plotting parameters
self->Get_Property, n_Bands=n_Bands, Channel=Channel
!P.MULTI = [0,n_Bands,1]
!X.OMARGIN = [6,0]

; Begin band response plots
FOR i = 0L, n_Bands-1L DO BEGIN
self->Get_Property, $
i, $
Frequency = f, $
Response = r
PLOT, f, r, $
TITLE='Ch.'+STRTRIM(Channel,2)+', band #'+STRTRIM(i+1,2), $
XTITLE='Frequency', $
XMARGIN=[2,3], $
XRANGE=xrange,/XSTYLE, $
CHARSIZE=charsize, $
_EXTRA = Extra
self->Save_PlotVars, i ; <--- SAVE AFTER PLOTTING
ENDFOR


and then if I want to overplot a different instance's data (with congruent dimensions of
course, I check for that) I just do the following in my oplot method:

; Loop over bands
FOR i = 0L, n_Bands-1L DO BEGIN
osrf->Get_Property, $
i, $
Frequency = f, $
Response = r
; Plot it
self->Restore_PlotVars, i ; <--- RESTORE BEFORE PLOTTING
OPLOT, f, r, _EXTRA = Extra
ENDFOR


Not terribly scalable, I admit, but it works and no need for using OG that may log me out
of my computer...... :o)

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Multiple Plots in PostScript
Next Topic: Lag and A_Correlate/C_Correlate

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

Current Time: Sat Oct 11 22:18:51 PDT 2025

Total time taken to generate the page: 0.40254 seconds