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
|