[Thread Prev][Thread Next][Index]

portraitNxN.jnl



Hello,

One task that I ofetn use Ferret for is to make a large number of plots on
one page - more than the maximum of six available using the
landscape3x2.jnl tool. It then takes a long time to set up the viewports
manually. To make things easier, I've written a short script which
automatically sets up any desired number of evenly-spaced viewports on one
page. I've called it portraitNxN.jnl. As I am not aware of such a tool
being generally available, I'm attaching a copy of it here in the hope
that some of you may find it useful. I welcome any bug reports or
improvements.

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 SCRIPT:------------------

\can mod verify
! portraitNxN.jnl
! Rodrigo Caballero 04/99
 
! Description: Set up an arbitrary number of evenly-spaced viewports
 
! Usage: GO portraitNxN #columns #rows [xmag] [ymag]
!  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)
 
! 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 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]%
query/ignore $2%<Use: GO portraitNxN #columns #rows [xmag] [ymag]%

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=`296/210` ! A4 paper        
!set win/as=`11/8.5` ! 8 1/2 x 11  paper (uncomment as suitable)

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

set mod/last verify



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement