Reputation: 42575
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.
Let us take for example take the simple function f(x) = x
I want a bar char that creates one bar for every value of x between 0 and 20 (step size 1).
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?
Upvotes: 2
Views: 529
Reputation: 15910
You want the set samples
command. Try:
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
Upvotes: 4