comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Question on plotting a histogram with original values
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Question on plotting a histogram with original values [message #8132 is a reply to message #8129] Thu, 06 February 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
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
-----------------------------------------------------------
[Message index]
 
Read Message
Read Message
Previous Topic: changing colors on a Mac
Next Topic: IDL 5.0 news at RSI website

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 19:01:21 PDT 2025

Total time taken to generate the page: 1.11987 seconds