[Thread Prev][Thread Next][Index]

update on portraitNxN



Hello,

Recently I sent out a script (portraitNxN.jnl) for setting up many
viewports automatically. I've realised there's a problem with it: because
it uses the REPEAT function, it alters the region setting and can cause
problems when making plots. Sorry about that. I've changed the script so
that it now leaves the status of Ferret unaltered on exiting. I've also
added a fith input parameter, which is teh aspect ratio of the window (the
default is still European A4 or American Letter). 

regards,
Rodrigo

---

Rodrigo Caballero Augi 
DCESS, Juliane Maries Vej 30, DK-2100 Copenhagen O, Denmark.
tel: +45 35320564 | fax: +45 35365357 | home: +45 35836487
rca@gfy.ku.dk | http://rodrigo.gfy.ku.dk

----------------- HERE IS THE NEW VERSION -------------------------
\can mod verify
! portraitNxN.jnl
! 11/04/99
 
! Description: Set up an arbitrary number of evenly-spaced viewports
 
! Usage: GO portraitNxN #columns #rows [xmag] [ymag] [aspect]
!  where:
!  #columns: number of viewports accross page
!  #rows: number of viewports down page
!  xmag: horizontal magnification of viewports (as percentage; default=0)
!  ymag: vertical magnification of viewports (as percentage; default=0)
!  aspect: aspect ratio of page (default A4/Letter paper)
 
! Example:
!  GO portraitNxN 5 8 40 50
!  will set up 40 viewports (5 accross, 8 down) magnified by 
!  40% horizontally and 50% vertically. The viewports are named
!  using consecutive numbers starting with "1" for upper-left to
!  "40" for lower-right.

! Notes:  
! - The viewports are named using consecutive numbers. This is useful 
!   for making a series of consecutive plots; for instance:  
!   repeat/l=1:40 (set viewport `l`; shade field) 
!   will plot 40 consecutive snapshots of variable "field", one in each 
!   viewport.  
! - The script is set up to fill by default a European A4 page; 
!   American users should uncoment the relevant line below.

! check that parameters are OK 
query/ignore $1%<Use: GO portraitNxN #columns #rows [xmag] [ymag] [aspect]%
query/ignore $2%<Use: GO portraitNxN #columns #rows [xmag] [ymag] [aspect]%

let/quiet width=`(1+$3"0"/100)/$1`  
let/quiet height=`(1+$4"0"/100)/$2`

define axis/x=`width/2`:`1-width/2`/npoint=$1 xview
define axis/y=`height/2`:`1-height/2`/npoint=$2 yview
define grid/x=xview/y=yview gview
let/quiet xv=x[g=gview]
let/quiet yv=y[g=gview]
let/quiet x1=xv-width/2  
let/quiet y1=yv-height/2 
let/quiet x2=xv+width/2  
let/quiet y2=yv+height/2 
let/quiet xx1=if x1 ge 0 then x1 else 0
let/quiet yy1=if y1 ge 0 then y1 else 0
let/quiet xx2=if x2 le 1 then x2 else 1
let/quiet yy2=if y2 le 1 then y2 else 1  

ppl/reset
set win/as=$5"`296/210`" ! European A4 paper        
!set win/as=$5"`11/8.5`" ! American Letter  paper (uncomment as suitable)

define reg previous
can reg

repeat/j=$2:1:-1 (repeat/i=1:$1 define view/xlim=`xx1`,`xx2`/ylim=`yy1`,`yy2` `i+($2-j)*$1`)

set reg previous
set mod/last verify



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement