scatter plot w/ colors

From: Alessandra Giannini <alesall_at_nyahnyahspammersnyahnyah>
Date: Thu, 15 Jan 2009 14:51:46 -0500

Hi everyone,

I am trying to figure out how to plot a scatterplot of THREE variables
in the following way:
the first variable runs along the x-axis, the second along the y-axis
and the third adds variation in color to the points.

To give you a prototypical example, here is a plot of average
temperature/precipitation colored by elevation in stations around the
central Mediterranean, computed in the IRI Data Library:
<http://iridl.ldeo.columbia.edu/expert/SOURCES/.NOAA/.NCDC/.GCPS/.MONTHLY/.STATION/lon/%280%29%2820%29masknotrange/SELECT/lat/%2835%29%2845%29masknotrange/SELECT/mean/temp%5BT%5Daverage/1/index/.prcp%5BT%5Daverage/3/index/.elev/fig://XOVY/1/def/scattercolor/:fig/
>

In NCL I tried this way a while back - start with the scatterplot of 2
variables:

plot = gsn_csm_xy(wks,x,y,res)

and then add color:

pres = True
pres_at_gsMarkerIndex = (/ 16 /)
pres_at_gsMarkerSizeF = (/ 0.01 /)
do j=0,dimsizes(z)-1
         pres_at_gsMarkerColor=GetFillColor(sorted_z,cmap,z(j))
         gsn_polymarker(wks,plota,x,y,pres)
end do

where cmap is defined from an array or RGB values, stored in an
external file:
cmap = RGBtoCmap("csimple.txt")

that typically looks like this:

255 255 255
0 0 0
   0 0 128
   0 0 205
30 144 255
0 191 255
127 255 212
255 255 255
255 255 0
255 215 0
...

My problem is in defining a color scale automatically, in the sense
that I would like to be able to just pick out a color map regardless
of the number of points in the scatter - one of the classic color
scales defined in ncl would do, like BlueRed.

Can I do that? And if so, how?
Your help is much appreciated.

thanks, alessandra

-- 
Alessandra Giannini
IRI for Climate and Society - The Earth Institute at Columbia University
P.O. Box 1000, Palisades NY 10964-8000
phone/fax: +1 845 680-4473/4864 - email: alesall_at_iri.columbia.edu

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 15 2009 - 12:51:46 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 16 2009 - 14:05:56 MST