Re: Frustrated by 2 Data Plotting problems [message #76294 is a reply to message #76293] |
Thu, 26 May 2011 16:02   |
cgguido
Messages: 195 Registered: August 2005
|
Senior Member |
|
|
Given what I just saw on my screen (speedup by x10) without understanding it, I don't think I should NOT pollute the cgWorld! :-(
All I did (on a hunch...) is replace the line with
cgplot, /over ... (fast!)
for
cgplotS, ... (slowwww!)
I am guessing the advantage is that, "cgplotS" (whether I pass COLOR or SYMCOLOR) has to loop over every dot, but "cgplot, /over" does not?, not in the same way...?
I suppose I could further speed things up by replacing the looped WHERE with a histogram... still, I can now pretty plot 100k dots in 4s (with Z buffer, 6s with X) rather than 80-90s!
Here is the code as it stands now:
h2=sshist_2d(x,y, re=ri1, cost=co, outbin = bin)
xmin = min(X) & ymin = min(y)
h2size = size(h2, /dimen)
col = h2[ floor((x-xmin)/bin[0]) + floor((y-ymin)/bin[1])*h2size[0] ]
cgloadct, ctable
cgplot, x, y, /noda, back=cgcolor('black'), $
color=cgcolor('white'), chars=1.5, _extra = eee
col = bytscl(col)
cmin = min(fix(col), max = cmax)
for c=cmax, cmin, -1 do begin
w=where(col EQ c)
if w[0] ne -1 THEN $
cgplot, x[w], y[w], ps=16, syms=.1, col=c, /ov
endfor
|
|
|