[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSYM=10 problem



Laurent Chardon wrote:
> 
> Is there a good reason why the first bin plotted by the plot/PSYM=10
> combination is half the size of all the others? Can I get around this
> behaviour? I want all the bins to be of equal size.

I've had this problem too, and worked around it by duplicating
the first and last elements of the data, and by adding the end
points to the bin centers.

If data is your histogram data, and binBounds is an array
of the histogram bin boundaries:

sizeData=N_Elements(data)
plotData=[data(0),data,data(sizeData-1)]  ;duplicate first and last

sizeBinBounds=N_Elements(binBounds)
binCenters(i)=FltArr(sizebinBounds-1)
FOR i=0,sizeBinBounds-2 DO binCenters(i)=binBounds(i)+binBounds(i+1))/2.

;add highest and lowest bin boundaries to the bin center array
binLabels=[binBounds(0),binCenters,binBounds(sizeBinBounds-1)]

Plot,binLabels,plotData,PSym=10

I'll trust the maxim that the best way to find out that one's method
is needlessly complicated is to post it to comp.lang.idl-pvwave.

-Steve Cox