comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Newbie Q: Color plot of discrete points
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Newbie Q: Color plot of discrete points [message #9158] Wed, 11 June 1997 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Ole Bossing Christensen writes:

> I am a rather inexperienced IDL user and
> can't seem to find the proper
> routine for the following elementary task:
>
> I have a field defined on an irregular set of
> point (observed temperatures at land points in
> Europe, actually) (x,y,z). Eventually I
> will do an interpolation to a grid and plot
> that, but first I would like to plot circles
> at points (x,y) with a colour determined by z.
> How to do that?

Here is an example I took from my web page and
modified to draw circles at the random temperature
points. Then the random data is gridded and displayed
on top of the points as a contour plot. The TVCircle
routine is Wayne Landsman's. It can be obtained
at:

http://idlastro.gsfc.nasa.gov/ftp/pro/tv/tvcircle.pro

Sorry that the location is US, rather than Europe,
but you can fix that! :-)

Cheers,

David
------------------------------------------------------
PRO EXAMPLE

; Pick a seed, so you see what I see. Create random data.

seed = -1L
lat = RANDOMU(seed, 40) * (24./1.0) + 24
lon = RANDOMU(seed, 40) * 40.0/1.0 - 112
data = RANDOMU(seed, 40) * 1000

; Colors for plot.

Window, /Free, /Pixmap, XSize=10, YSize=10
WDelete, !D.Window
ncolors = !D.N_Colors
LoadCT, 13, NColors=ncolors-3
TVLCT, [255,100], [255,100], [0,100], ncolors-2
zcolors = BytScl(data, Top=ncolors-3)

; Set up the map projection of the Eastern US.

MAP_SET, 15, -87, 0, LIMIT=[24,-115,49,-67], $
/CONTINENTS, /USA, /MERCATOR, Con_Color=ncolors-1

; Plot the random data locations.

TVCircle, 0.5, lon, lat, zcolors, /Data, /Fill

; Grid the irregularly spaced data.

gridData= SPH_SCAT(lon, lat, data, $
BOUNDS=[-115., 24., -67., 49.], GS=[0.5,0.5], BOUT=bout)

; Calculate xlon and ylat vectors
; corresponding to gridded data.

s = SIZE(gridData)
xlon = FINDGEN(s(1))*((bout(2) - bout(0))/(s(1)-1)) + bout(0)
ylat = FINDGEN(s(2))*((bout(3) - bout(1))/(s(2)-1)) + bout(1)

; Put the contours on the map.

CONTOUR, gridData, xlon, ylat, /OVERPLOT, $
NLEVELS=14, C_COLOR=ncolors-2
END

------------------------------------------------------------ -------
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Persistent Object Graphics Not Persistent in Resizeable Windows
Next Topic: AVI in PV-Wave

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:20:57 PDT 2025

Total time taken to generate the page: 0.00529 seconds