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

Home » Public Forums » archive » Re: density color schemes in IDL8 scatterplots
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: density color schemes in IDL8 scatterplots [message #80767 is a reply to message #80766] Wed, 11 July 2012 08:58 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 07/11/12 10:22, patrickdgriffiths@gmail.com wrote:
> Hi,
>
> does anyone know if there is any way to use density color schemes for scatterplots using the new IDL8 PLOT functions?
> As this is a standard in ENVI scatterplot visualization, I would be surprised if it was not possible using IDL8
> graphics. I could not find anything so far, however... Thanks,

I will assume you mean a density map, or pdf, when you say "density color scheme". If not, ignore the following.

I recently had to do just this.

After creating a graphics window, referenced in a structure as gData.wref, and my own RGB colour table, referenced in an
array called "rgb_table", this is how I display the image:

; Compute the 2-D histogram for x-y scatterplot data
qc_nbc_hist_2d = HIST_2D(x, y, BIN1=x_binsize, BIN2=y_binsize, $
MIN1=x_min, MAX1=x_max, $
MIN2=y_min, MAX2=y_max)

; Determine the x- and y-axis vectors
hist_info = SIZE(qc_nbc_hist_2d, /STRUCTURE)
n_x = hist_info.DIMENSIONS[0]
n_y = hist_info.DIMENSIONS[1]
x_locations = x_min + FINDGEN(n_x)*x_binsize
y_locations = y_min + FINDGEN(n_y)*y_binsize


; Display the axes for the 2-D histogram image
pi = PLOT( [x_locations[0], x_locations[n_x-1]], [y_locations[0], y_locations[n_y-1]], $
/NODATA, $
TITLE='insert title here', $
XTITLE='insert xtitle here', $
YTITLE='insert ytitle here', $
CURRENT=gData.wref )


; Determine scaling factors for image
result = pi.CONVERTCOORD( pi.xrange, pi.yrange, /DATA, /TO_DEVICE )
dx=result[0,1]-result[0,0]
dy=result[1,1]-result[1,0]


; Display scaled image
im = IMAGE( CONGRID(qc_nbc_hist_2d, dx, dy, /CENTER), $
LINDGEN(dx), $
LINDGEN(dy), $
AXIS_STYLE=0, $
RGB_TABLE=rgb_table, $
CURRENT=gData.wref )


; Ensure the axes are visible over image
pi.Order, /BRING_TO_FRONT

Here's an example of the output:
http://ftp.emc.ncep.noaa.gov/jcsda/CRTM/amsua-ch1.png
The left-most plots are the regular scatterplots. The rightmost plots are the corresponding 2-D density map.

I do think this is a rather obtuse way of displaying an image with useful, numbered axes and I was going to post to this
newsgroup on how to do this in a "better" way. Well, a more intuitive way at least.

I think the image should be "axis-aware" so the user doesn't have to dick around with the whole CONVERTCOORD thing. And
it may be that there is a way to do that.... but I sure as hell couldn't find out how from the IDL documentation.

cheers,

paulv
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: include COI on wavelet plots using toolkit
Next Topic: Re: Google Static Maps in IDL

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

Current Time: Fri Oct 10 14:49:45 PDT 2025

Total time taken to generate the page: 1.75651 seconds