Gnuplot:函数的条形图 [英] Gnuplot: Bar chart from a function

查看:83
本文介绍了Gnuplot:函数的条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与所有Gnuplot条形图示例中的近99.9%相比,我没有数据文件,但是我想将其可视化为条形图.

In difference to nearly 99.9% of all Gnuplot bar chart examples I don't have a data file but a function I want to visualize as a bar chart.

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

Let us take for example take the simple function f(x) = x

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

I want a bar char that creates one bar for every value of x between 0 and 20 (step size 1).

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

Therefore I used the following code, but it does not create 20 bars - it creates a lot more (about 100?).

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

如何使此条形图正常工作?

How to make this bar chart work correctly?

推荐答案

您需要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

这篇关于Gnuplot:函数的条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆