[Thread Prev][Thread Next][Index]

Re: mp_aspect problems



Hello All,
	Here is a script I wrote ages ago that I still fall back on
when laying out a page with an arbitrary number of panels of arbitrary
sizes.  For each panel call the (unix) script or spawn it within ferret
as in 
	yes? sp viewdef 8 10 5 2 1.5 6.5 1 1 v35
This would set up a panel (say the 3rd of 5 on a page) where the page is
8" wide by 10" high, the x and y axis lengths are 5" and 2", with the
lower left of the axes at (1.5",6.5") relative to the lower left of the
8x10 page and 1" in both x and y is a sufficient margin to accomodate
axis and other labels (important when close to the edges of the page).
	The script in this example creates "v35.jnl" so that a later call
	yes? go v35
makes that viewport or panel active.

As listed below the script is assumed to be named "viewdef" and to reside
in $home/bin.  Issuing the command
	unix> viewdef
or	yes? sp viewdef
without arguments brings up the beginning descriptive lines of the script.
(You will need a suitable alias in your .cshrc
	unix> alias viewdef ~/bin/viewdef
or to have the location of viewdef in your path.)
Hope someone finds it of use,
Mick Spillane.
The script follows:
========================================================================
#
# viewdef - script to produce a ferret viewport definition with
#           the ferret lines needed written to "name".jnl
#
# usage: viewdef px py ax ay ox oy fx fy name
#                                  ___________________________ 
# where px = page width            |<----------px----------->| ^
#       py = page height           |     ....................| |
#       ax = x-axis length         |     .  ferret margin   .| |
#       ay = y-axis length         |     .   ____________   .| |
#       ox = x-component of origin |     <fx>|  plot    | ^ .| |
#       oy = y-component of origin |     .   | region   | ay.| py
#       fx = ferret margin in x    |(ox,oy)->!__________| v .| |
#       fy = ferret margin in y    |     .             ^    .| | 
# all values in inches and         |     .             fy   .| |
#     name = name for viewport     |     ..............v.....| |
#                                  |       overall page      | |
# go name    will invoke viewport  |_________________________| v

# viewdef (or spawn viewdef in ferret) without arguments will
# display the usage and definition text above

#!/bin/csh -f
                       
if ( $#argv < 9 ) then 
   head -19 $home/bin/viewdef
else
   set jnl = $9:r.jnl

   echo $1 $2 $3 $4 $5 $6 $7 $8 $9  | awk '{           \
   origx = ($5-$7)/$1    ; origy = ($6-$8)/$2        ; \
   clipx = ($5+$3+$7)/$1 ; clipy = ($6+$4+$8)/$2     ; \
   str1  = "def view/size=1/orig=" ; str2 = "/clip=" ; \
   print "ppl size",$1,$2 ; print "ppl axlen",$3,$4  ; \
   print "ppl origin",$7,$8                          ; \
   print str1 origx","origy str2 clipx","clipy,$9    ; \
   print "set view",$9 }' >! $jnl
endif

# end of script


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement