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

Home » Public Forums » archive » Re: grid plots
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: grid plots [message #41986 is a reply to message #41969] Thu, 09 December 2004 07:33 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Martin writes:

>
> I have a problem with 2) in that I can't find any IDL routines that do
> this. Does anyone happen to know how to go about this at all? I'd be
> grateful for a any suggestions you might have.

Here is something I just knocked out, called ColorGrid.
It grids an irregular grid, each grid rectangle set
equal to the value of the grid at that location.

Cheers,

David

;*********************************************************** ************
PRO ColorGrid

; Create example data.
x = RandomU(-3L, 20) * 20
x = x[Sort(x)]
y = Indgen(20)
data = BytScl(Dist(20))

; Load colors
LoadCT, 5

; Decomposed color.
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=0, Get_Decomposed=theState

; Set up the coordinate system.
Plot, x, y, /NoData, XStyle=5, YStyle=5

; Draw polygons.
FOR j=0,N_Elements(x)-2 DO BEGIN
FOR k=0,N_Elements(y)-2 DO BEGIN
Polyfill, [x[j], x[j], x[j+1], x[j+1], x[j]], $
[y[k], y[k+1], y[k+1], y[k], y[k]], $
Color=data[j,k], /Data
ENDFOR
ENDFOR

; Redraw plot.
Plot, x, y, /NoData, /NoErase, XStyle=1, YStyle=1

; Draw grid.
FOR j=1,N_Elements(x)-1 DO $
PLOTS, [x[j], x[j]], [!Y.CRange[0], !Y.CRange[1]]
FOR j=1,N_Elements(y)-1 DO $
PLOTS, [!X.CRange[0], !X.CRange[1]], [y[j], y[j]]

; Clean-up.
IF (!D.Flags AND 256) NE 0 THEN $
Device, Decomposed=theState

END
;*********************************************************** ************

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: To PVM or not to PVM
Next Topic: Convolution of two equally sized arrays

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

Current Time: Wed Oct 08 19:56:32 PDT 2025

Total time taken to generate the page: 0.00396 seconds