David Fanning wrote:
> Nicolas Aunai writes:
>
>> I have a problem trying to contour the return value of HIST_2D.
>> my code is the following :
>
> I think the first thing I would try would be setting
> the MIN and MAX keywords in HIST_2D. My experience with
> IDL is that when you let it decide what to do, unexpected
> results are the rule. :-)
>
> Cheers,
>
> David
OH !
the following code does what I want :
tstudy = 8.0
!p.multi = [0,1,1,0]
window,2,retain=2
bin = 0.05
eci = MIN(ec(*,0)) + bin*lindgen(1+(max(ec(*,0))-min(ec(*,0)))/bin)
ecf = MIN(ec(*,tstudy)) +
bin*lindgen(1+(max(ec(*,tstudy))-min(ec(*,tstudy)))/bin)
;distr = HIST_2D(ec(*,0) , ec(*,tstudy), bin1=bin, bin2=bin)
distr = HIST_2D(ec(*,0) , ec(*,tstudy), bin1=bin, bin2=bin,
min1=min(ec(*,0)), max1=max(ec(*,0)), min2=min(ec(*,tstudy)), $
max2=max(ec(*,tstudy)))
just like you said I have just set the min1,min2,max1,max2 values... to
what I thought were the DEFAULT values (this is what the help says...)
I get :
IDL> help,eci,ecf,distr
ECI FLOAT = Array[132]
ECF FLOAT = Array[135]
DISTR LONG = Array[132, 135]
while the previous code :
IDL> tstudy = 8.0
IDL> !p.multi = [0,1,1,0]
IDL> window,2,retain=2
IDL>
IDL> bin = 0.05
IDL> eci = MIN(ec(*,0)) + bin*lindgen(1+(max(ec(*,0))-min(ec(*,0)))/bin)
IDL> ecf = MIN(ec(*,tstudy)) +
bin*lindgen(1+(max(ec(*,tstudy))-min(ec(*,tstudy)))/bin)
IDL> distr = HIST_2D(ec(*,0) , ec(*,tstudy), bin1=bin, bin2=bin)
gives :
ECI FLOAT = Array[132]
ECF FLOAT = Array[135]
DISTR LONG = Array[132, 137]
so the help is wrong ? :-)
last question :
should I do :
eci = MIN(ec(*,0)) + bin*lindgen(ceil((max(ec(*,0))-min(ec(*,0)))/bin))
or
eci = MIN(ec(*,0)) + bin*lindgen(1+(max(ec(*,0))-min(ec(*,0)))/bin)
??
thx a lot for your help
|