【问题标题】:Gnuplot simple bar chart (histogram) from x-y data (x is uneven)来自 x-y 数据的 Gnuplot 简单条形图(直方图)(x 不均匀)
【发布时间】:2019-02-13 02:45:43
【问题描述】:

我已经以这种格式合并了直方图数据:

BinCenter NumberOfOccurances
1 2
3 5
10 13
7 4

注意以下几点:

  1. 箱的间距不规则。
  2. 垃圾箱未排序(尽管我可以对其进行排序)。

我想让 gnuplot 用这些数据绘制一个条形图。

我想要以 BinCenter 为中心的垂直条,每个条的高度应该是第二列的值。

plot 'histo.txt' with boxes

确实给了我垂直条,但条的宽度似乎不均匀。

【问题讨论】:

  • 以及boxwidth,您可能还需要set yrange [0:] 才能看到第一个框。

标签: tuples gnuplot histogram frequency


【解决方案1】:

请参阅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.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-04
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多