LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bars not lining up correctly on Histogram.vi

Solved!
Go to solution

Hello everyone,

 

I am trying to get my bars via the Histogram.vi to line up with my X-axis. I have placed three elements in a 1D array of doubles. I have tried for the last three hours to get this right and it is driving me nuts!

 

Can someone help?

 

Thanks,

Eric

0 Kudos
Message 1 of 4
(2,881 Views)

If you would use the general histogram, you would have more flexibility. At least wire a larger value to the "intervals" input (currently 10).

0 Kudos
Message 2 of 4
(2,860 Views)
Solution
Accepted by topic author Eric1977

This is what the help file says:

 

The histogram is a frequency count of the number of times that a specified interval occurs in the input sequence. The width of the frequency bin is

delta_x = (max–min)/m

where m is the requested number of bins. The centers of each bin are set according to the following equation:

center[i] = min + delta_x/2 + i * delta_x.

 

With double numbers it gets difficult to solve, you need to offset the min value and adjust for the other X values to be centered. If you can live with it a (far from perfect) workaround is to use a large amount of bins (like 200). This way the bars will look centered even if not exactly.

 

Ben64

0 Kudos
Message 3 of 4
(2,854 Views)

ben -  I believe your "far from perfect" workaround will work for what I need. Thank you.

0 Kudos
Message 4 of 4
(2,808 Views)