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

Home » Public Forums » archive » Re: How to do multiple plots w/out space between 'em
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: How to do multiple plots w/out space between 'em [message #4305] Tue, 23 May 1995 00:00
paul is currently offline  paul
Messages: 22
Registered: June 1991
Junior Member
In article <3pr38e$p5u@hecate.umd.edu>, bleau@UMDSP.UMD.EDU (Lawrence Bleau) writes:
|> Hi. I'm posting this on behalf of one of my users. We are running IDL v3.0.0
|> on a VAX running OpenVMS 5.5-2.
|>
|> ---- start included file ----
|> how do I produce this sort of plot with IDL?
|>
|>
|> |------+------+------+------+------+------+------+------+--- | <- same x-axis
|> | |
|> | |
|> y1| |
|> | |
|> |------+------+------+------+------+------+------+------+--- | <- same x-axis
|> | |
|> y2| |
|> | |
|> | |
|> |------+------+------+------+------+------+------+------+--- | <- same x-axis
|> | |
|> y3| |
|> | |
|> |------+------+------+------+------+------+------+------+--- | <- same x-axis
|>
|> x-axis
|> ...


Here's how:

function ymulti,p,np=np,ymargin=ymargin,space=space
;+
; routine: ymulti
;
; purpose: set up margins for vertically stacked multi frame plot
;
; input:
;
; p named variable, contains stuff you don't need to know
; the contents of p are changed after each call
;
; Keyword input
;
; np number of frames in plot, set on first call only (see examples)
;
; ymargin 2 element vector specifying overall margin setting
; below (0) and above (1) multiframe plot
; if ymargin is not set the top and bot margin is taken
; from !y.margin. This keyword is ignored when NP not set
;
; space the separation distance between frames of a multiframe
; plot in units of the character height. This keyword is
; ignored when NP not set. Default is no space between plots
;
;
; SIDE EFFECTS: changes the value of !p.multi(4) to enforce column major
; ordering of plots. To reinsate the default row major
; ordering, set !p.multi=0 or !p.multi(4)=0
;
; EXAMPLE: create a three frame plot
;
; y1=smooth(randomu(iseed,200),3)
; y2=smooth(y1,11)
; y3=smooth(randomu(iseed,200),11)
; y4=smooth(y3,3)
;
; !p.multi=[0,1,3]
; plot,y1,xchars=.001, chars=2, ymargin=ymulti(p,np=3,ymargin=[5,3],space=1)
; plot,y2,xchars=.001, chars=2, ymargin=ymulti(p)
; plot,y3, chars=2, ymargin=ymulti(p)
;
;; Note the use of XCHARSIZE to disable x-axis labeling for first two plots.
;; Now try a four frame plot with no space between frames
;
; !p.multi=[0,1,4]
; plot,y1, xchars=.001, chars=2, ymargin=ymulti(p,np=4)
; plot,y2, xchars=.001, chars=2, ymargin=ymulti(p)
; plot,y3, xchars=.001, chars=2, ymargin=ymulti(p)
; plot,y4, chars=2, ymargin=ymulti(p)
;
;; Now try a multi-column plot
;
; !p.multi=[0,2,4]
;
; plot,y1,xchars=.001, chars=2, title='top left',ymar=ymulti(p,np=2)
; plot,y2, chars=2, ymargin=ymulti(p)
;
; plot,y3,xchars=.001, chars=2, title='bottom left',ymar=ymulti(p,np=2)
; plot,y4, chars=2, ymargin=ymulti(p)
;
; plot,y1*y1,xchars=.001, chars=2, title='top right',ymar=ymulti(p,np=2)
; plot,y2*y2, chars=2, ymargin=ymulti(p)
;
; plot,y3^2,xchars=.001, chars=2, title='bottom right',ymar=ymulti(p,np=2)
; plot,y4^2, chars=2, ymargin=ymulti(p)
;
;
; AUTHOR Paul Ricchiazzi mar94
; Institute for Computational Earth System Science
; Univerity of California, Santa Barbara
;-
;=========================================================== ============
;
; p =[ymargin(0),ymargin(1),margin_increment, space]
;
; let b(i)=bottom margin of plot i
; let t(i)=top margin of plot i
;
;
; a multiplot frame plot will have uniform spacing between plots when
;
;
; t(0)=top_margin
; b(np-1)=bot_margin
;
; t(i) + b(i-1) = space
; t(i) + b(i) = ((np-1)*space+top_margin+bot_margin)/np = ds
;
; which can be solved by substitution,
;
; b(0)=ds-t(0)
;
; t(i)=space-b(i-1) & b(i)=ds-t(i) i=1,np-1
;
;
;=========================================================== ============

if keyword_set(ymargin) eq 0 then ymargin=!y.margin

if keyword_set(np) then begin
if keyword_set(space) eq 0 then space=0
!p.multi(4)=1
ds=float((np-1)*space+total(ymargin))/np
top=ymargin(1)
bot=ds-top
p=[bot,top,ds,space]
endif else begin
p(1)=p(3)-p(0)
p(0)=p(2)-p(1)
endelse

return,p(0:1)

end





--

____________________________________________________________ _______________
Paul Ricchiazzi email: paul@icess.ucsb.edu
Institute for Cumputational Earth System Science
University of California, Santa Barbara


If I have seen farther than | If I have not seen as far as
others, it is by standing on | others, it is because giants
the shoulders of giants. | were standing on my shoulders.
|
Isaac Newton | Hal Abelson

____________________________________________________________ _______________
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Wavelet procedures
Next Topic: Re: Johns Hopkins IDL usr library

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

Current Time: Wed Oct 08 19:33:53 PDT 2025

Total time taken to generate the page: 0.00470 seconds