# Drawing Simple Bar Charts (Stats Question)

• 11-10-2004
Davros
Drawing Simple Bar Charts (Stats Question)
Hi there,

I'm writing a small program to draw bar and pie charts. I have a question regarding weights (or frequencies) of values.

If I have the following data:

Code:

```VAL  FREQ 5      1 2      1 3      2* 4      1```
Typically, what do I plot for the bar of the third value?

Do I plot a single bar of height 6, or two bars of height 3?

If I were two plot two separate bars, what would I plot if the frequency was a fractional number?

Thanks
• 11-10-2004
Govtcheez
> Do I plot a single bar of height 6, or two bars of height 3?

I'd do 2 of height 3. Having one of height 6 doesn't make much sense

> If I were two plot two separate bars, what would I plot if the frequency was a fractional number?

I don't follow.
• 11-10-2004
Davros
>I don't follow

If the third value had a non-integer weight of 2.5, then I can't plot 2 and a half bars.

Or does my question simply not make sense because no one would ever enter a non-integer weight? In which case, should I simply round to the nearest integer and stop worrying?
• 11-10-2004
Govtcheez
That's kinda what I meant. Seems it'd be difficult to have a non-integer weight. Even if you did, you could change the proportions so it does.

IE

Code:

```VAL  FREQ 5      1 2      1 3      2.5 4      1```
Code:

```VAL  FREQ 5      2 2      2 3      5 4      2```
I hate stats, though, so I don't know if this would cause more problems than it solved. You could also put some sort of a note on that, but that's really up to you.
• 11-10-2004
Davros
>I hate stats

They certainly make you think.

I think I'll split non-unity weights into multiple bars, while rounding to the integer. Unless, of course, someone can suggest why plotting weighted values on the y-axis would be useful. At the moment, I agree that it doesn't seem to make any sense.

Thenks for replyling Govtcheez. That helped!