[Thread Prev][Thread Next][Index]

Re: 2d-Plot with symbols

Hi all,
Here is another method, similar to what Hein does, but using the polymark.jnl
script to draw a whole group of points at once. (see  yes? go/help polymark for
details of the script.)  This method doesn't let you make each symbol a different
size according to the value of the field,which Hein's method would let you do if
you like.  But it's a little simpler.

Because the POLYGON/LINE command does not have the range of colors that
the POLYGON/FILL command does, unfilled shapes cannot represent the same
range of values that filled ones do.  But perhaps using POLY/LINE/FILL for positive
and POLY/FILL without the line for negative values would be a way to distinguish positive
and negative differences.  I plot the whole field first, so that the color key represents
all the data, then overlay just the positive values with the /LEV qualifier to use the same
colors for the values of the variable, and qualifiers  /LINE/FILL to outline the polygons.

   cancel region
   use etopo120
   palette light_centered
   set window/aspect=`60/80`:axis
   go basemap x=40:120 y=-20:40
   ! Create lists of x and y points at all of the grid coordinates,
   ! and also the function value in the region we want.
   let lon = xsequence(x[gx=rose,x=40:120,y=-20:40] + 0*y[gy=rose,x=40:120,y=-20:40])
   let lat = xsequence(0*x[gx=rose,x=40:120,y=-20:40] + y[gy=rose,x=40:120,y=-20:40])
   let elev = xsequence(rose[x=40:120,y=-20:40])
   ! Make a mask to distinguish locations of positive values
   let mask = if elev ge 0 then 1
   ! First draw all the points with a color key representing the whole range
   go polymark poly/over/key/nolab lon, lat, elev, circle, 0.8
   ! Overlay just the positive values, with /LINE/FILL to outline
   ! these polygons, and /LEV to keep same color levels
   go polymark poly/over/lev/line/fill/nokey/nolab mask*lon, mask*lat, elev, circle, 0.8

Hein Zelle wrote:
Nicolas Schneider wrote:

I have 2-dimensional (x-y) data of temperature differences. I would now 
like to draw a 2D-plot with symbols instead of filled grid boxes 
(SHADE). That means that instead of a filled grid box, I would like to 
draw a symbol reflecting the value in that grid box. Positive 
temperature differences should be drawn with filled circles with the 
size depending on the magnitude of the temperature difference. 
Contrastingly, negative temperature differences should be drawn with 
open circles, again depending on the magnitude of the difference.

Is this possible with ferret? Where should I look for? Under SHADE 
commands or PLOT commands?

The following does approximately what you want. It's not very pretty,
I plot the data twice to distinguish between open and closed
polygons. I find it really looks better if you only use filled
polygons and let the color distinguish between negative and positive,
but that's up to you. Look for the POLYGON command in the ferret
manual for further options and explanation. Producing a circle instead
of a diamond is left as an excercise for the reader :-)

Hope that helps,
     Hein Zelle

use etopo120
set region/x=40:120 /y=-20:40
set window/aspect=`60/80`:axis
palette light_centered
go basemap

let xdiamond = tsequence({-1,0,1,0})
let ydiamond = tsequence({-0,1,0,-1})
let size1 = if (rose gt 0) then 0.5+abs(rose/10000) else 0
let size2 = if (rose lt 0) then 0.5+abs(rose/10000) else 0

repeat /i=10:50:2 (repeat /j=26:66:2 (polygon /key /nolab /fill /levels=(-8000,8000,1000) /overlay x[g=rose]+xdiamond*size2, y[g=rose]+ydiamond*size2, rose ; ppl shaset reset))

repeat /i=10:50:2 (repeat /j=26:66:2 (polygon /key /nolab /line /levels=(-8000,8000,1000) /overlay x[g=rose]+xdiamond*size1, y[g=rose]+ydiamond*size1, rose ; ppl shaset reset))

    Hein Zelle
    Dept. of Oceographic Research
    KNMI, The Netherlands
    work:        zelle@knmi.nl     http://www.knmi.nl/~zelle
    private:     hein@icce.rug.nl  http://www.icce.rug.nl/~hein
    Phone:       +31 (0)30 2206704

Zie ook/see also: http://www.knmi.nl/maildisclaimer.html 

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement