Gnuplot простая гистограмма (гистограмма) по данным x-y (x неровный) - PullRequest
0 голосов
/ 07 сентября 2018

Я скопировал данные гистограммы в этом формате:

BinCenter NumberOfOccurances
1 2
3 5
10 13
7 4

Обратите внимание на следующее:

  1. Контейнеры не располагаются регулярно.
  2. Бункеры не отсортированы (хотя я мог бы их отсортировать).

Я хочу, чтобы gnuplot построил гистограмму с этими данными.

Я хочу, чтобы вертикальные столбцы центрировались вокруг BinCenter, а высота каждого столбца должна быть равна значению второго столбца.

plot 'histo.txt' with boxes

дает мне вертикальные полосы, но полосы кажутся неравномерными по ширине.

1 Ответ

0 голосов
/ 07 сентября 2018

См. Документацию для set boxwidth, которая начинается

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.
...