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

Home » Public Forums » archive » cgHistoplot -- input histogram results?
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: cgHistoplot -- input histogram results? [message #86336 is a reply to message #86326] Mon, 28 October 2013 09:17 Go to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
I have to do this before - basically, I fake the original data set, based on inputs from the original histogram. Basically, I replicate the middle of each bin to match the histogram value (to stay away from the razor's edge):

binSize = 5.0
minVal = 0.0
h=HISTOGRAM(data, BIN=binSize, MIN=minVal) ;original histogram

nData = TOTAL(h)
nHisto = N_ELEMENTS(h)

middleBins = FINDGEN(nHisto)*binSize/2+minVal

fakeData = FLTARR(nData)

FOR i=0, nHisto-1 DO BEGIN
IF h[i] EQ 0 THEN CONTINUE
IF i EQ 0 THEN startInd = 0 ELSE startInd = TOTAL(h[0:i-1])
stopInd = TOTAL(h[0:i])-1

fakeData[ startInd : stopInd ] = REPLICATE(middleBins[i], h[i])

ENDFOR

(There's plenty room for improvement in this code....not enough coffee yet :-) )

You could then throw fakeData at cgHistoplot. I've only had to do this a couple of times - so, the time penalty for duplicating the histogram calculation wasn't important (enough). I suppose as long as the data isn't too finely binned, it would work fine....
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using Y_SCROLL_SIZE and COLUMN=8 on Mac widgets
Next Topic: Overplot cgplots in graphics window

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

Current Time: Sat Oct 11 10:42:44 PDT 2025

Total time taken to generate the page: 0.96230 seconds