hist_2d, contour [message #66577] |
Wed, 27 May 2009 02:25 |
Nicolas Aunai
Messages: 5 Registered: May 2009
|
Junior Member |
|
|
Hello !
I have a problem trying to contour the return value of HIST_2D.
my code is the following :
tstudy = 8.0
window,2,retain=2
bin = 0.05
; ec(*,0) is
; <Expression> FLOAT = Array[42511]
eci = MIN(ec(*,0)) + bin*indgen(1+(max(ec(*,0))-min(ec(*,0)))/bin,/long)
;eci is FLOAT = Array[131]
; ec(*,tstudy) is :
;<Expression> FLOAT = Array[42511]
ecf = MIN(ec(*,tstudy)) +
bin*indgen(1+(max(ec(*,tstudy))-min(ec(*,tstudy)))/bin,/long )
; ecf is FLOAT = Array[134]
distr = HIST_2D(ec(*,0),ec(*,tstudy), bin1=bin, bin2=bin)
;the returned array distr is :
; LONG = Array[132, 137]
; and of course, the dimensions of the three arrays are incompatible so
; the contour doesn't work...
distr(where(distr eq 0)) = 1.
nlevels = 100
lsteps = (max(alog10(distr))-min(alog10(distr)))/(nlevels -1)
ulevels = min(alog10(distr)) + lsteps*indgen(nlevels)
loadct,13,ncolors=nlevels,/silent
;lev = min(alog10(distr)) +
0.05*indgen(1+(max(alog10(distr))-min(alog10(distr)))/0.05,/ long)
contour, alog10(distr), eci, ecf, c_colors=indgen(nlevels,/long),
levels=ulevels(1:*), /fill, background=255, color=0,$
title="Total Energy",$
position=[0.1,0.1,0.8,0.9],xtitle='Initial',ytitle='Final (t =
'+strcompress(tstudy*0.005*500,/r)+')',xstyle=1,ystyle=1
Would someone have an idea of what's my mistake ?
Thx a lot
Cheers
Nico
|
|
|