David van Kuijk <kuijk@mpi.nl> writes:
> When I use the histogram-function I find it very annoying that I can't see
> which range of data has been put in which bin. Has anybody written a
> function which returns these values, or the mean values for each bin?
>
> To give an example:
> PRO testHisto
>
> testAr = [-44,0,-42,-58,-48,-25,-26,-1,-46,-36,-16,-55,-6,-81,10,-31, -38,$
>
-34,-49,-80,2,-40,-65,-3,10,-31,-85,-34,-27,-14,-41,-73,-67, 3,-51,$
> -6,0,-107,-7,-36,-33,-59,-2,-99,-22]
> testHisto = histogram(testAr, BINSIZE = 10)
> plot, testHisto, PSYM = 10
> END
>
> This program will plot a nice histogram, but the values on the x-axis just
> show the rank number of the bins, and the information on the ranges of the
> original data is lost.
Try this modification to your program, David.
PRO testHisto
testAr = [-44,0,-42,-58,-48,-25,-26,-1,-46,-36,-16,-55,-6,-81,10,-31, -38,$
-34,-49,-80,2,-40,-65,-3,10,-31,-85,-34,-27,-14,-41,-73,-67, 3,-51,$
-6,0,-107,-7,-36,-33,-59,-2,-99,-22]
testHisto = histogram(testAr, BINSIZE = 10)
s = SIZE(testHisto)
maxData = MAX(testAr, MIN=minData)
x = FINDGEN(s(1)) * ((maxData - minData)/(s(1)-1)) + minData
plot, x, testHisto, PSYM = 10, XSTYLE=1
END
Cheers!
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
|