【问题标题】:Gnuplot: Bar chart from a functionGnuplot:来自函数的条形图
【发布时间】:2013-01-05 18:19:55
【问题描述】:

与所有 Gnuplot 条形图示例中的近 99.9% 不同,我没有数据文件,但我想将函数可视化为条形图。

让我们以简单的函数 f(x) = x 为例

我想要一个条形字符,它为 0 到 20 之间的每个 x 值(步长 1)创建一个条形。

因此,我使用了以下代码,但它不会创建 20 个柱 - 它会创建更多(大约 100 个?)。

set xtic 1
set xrange [0:20]
set boxwidth 1
set style fill solid
f(x)=x
plot f(x) with boxes

如何让这个条形图正常工作?

【问题讨论】:

    标签: gnuplot bar-chart


    【解决方案1】:

    您需要set samples 命令。试试:

    set xtic 1
    set xrange [0:20]
    set boxwidth 1
    set style fill solid
    f(x)=x
    set samples 21
    plot f(x) with boxes
    

    【讨论】:

      猜你喜欢
      • 2023-03-11
      • 1970-01-01
      • 2019-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 2023-03-31
      相关资源
      最近更新 更多