0
votes

I have binned histogram data in this format:

BinCenter NumberOfOccurances
1 2
3 5
10 13
7 4

Notice the following:

  1. Bins are not regularly spaced.
  2. Bins are not sorted (though I could sort them).

I want gnuplot to plot a bar chart with this data.

I want vertical bars centered around BinCenter and the height of each bar should be the second-column value.

plot 'histo.txt' with boxes

does give me vertical bars, but the bars seem to be uneven in width.

1
as well as boxwidth you probably also need set yrange [0:] to see the first box. - meuh

1 Answers

1
votes

See the documentation for set boxwidth, which starts

The `set boxwidth` command is used to set the default width of boxes in the
 `boxes`, `boxerrorbars`, `boxplot`, `candlesticks` and `histograms` styles.

 Syntax:
       set boxwidth {<width>} {absolute|relative}
       show boxwidth

 By default, adjacent boxes are extended in width until they touch each other.
 A different default width may be specified using the `set boxwidth` command.
 `Relative` widths are interpreted as being a fraction of this default width.

 An explicit value for the boxwidth is interpreted as being a number of units
 along the current x axis (`absolute`) unless the modifier `relative` is given.