>
> data = cgDemoData(14)
> Help, data
> ; The data will be in three columns, lon, lat, data.
> cgLoadCT, 33
> cgPlot, data[0,*], data[1,*], /YNoZero, /NoData
> cgPlotS, data[0,*], data[1,*], PSym=16, SymSize=2.0, $
> SymColor=BytScl(data[2,*])
>
So say you wanted to colour the points based on a 2D histogram of the data, so that when the overplotting fills a part of the plot, at least colour gives you an indication that there is a higher density of dots... (see http://tinyurl.com/3kv9kdm and sorry for the partial thread hijack!) Would you go about it in a similar way or is there a faster way?
Here's what I came up with, using sshist_2d.pro (http://tinyurl.com/3on7bzx) that automagically finds bin size:
h2=sshist_2d(x,y, re=ri1, cost=co)
col=x*0
nn=n_elements(h2)
for b=0L, nn-1 do begin &$
w=histobin(ri1,b) &$
if w[0] ne -1 then col[w]=h2[b] &$
endfor
cgloadct, 33
set_plot, 'z'
device, z_buff=0, set_res=[!D.X_SIZE,!D.Y_SIZE]
cgplot, x, y, /noda, back=cgcolor('black'), $
color=cgcolor('white'), chars=1.5
cgplots, x, y, ps=16, syms=.1, symcol=bytscl(col)
a=tvrd(/tr)
set_plot, 'x'
tv, a, /tr
|