Search code examples
gnuplot

In gnuplot, how do you change the number of points when plotting a function


I'm using gnuplot to plot a cosine function over a lot of periods

However, the output is very scribbly, because gnuplot uses a low number of points to plot a function. Is there any way to adjust this to include more points?

Output that shows a blocky cosine-function due to low sampling

This is my very minimal code:

set xrange [0:50]
plot cos(x) with linespoints

I tried googling for the answer but I could not find any way to set the number of points when plotting a function. Is there any way to adjust this to include more points, apart from generating my own data table in excel or similar?


Solution

  • Well, I can't believe that you haven't found anything searching the web. This is really a RT*M question: (check help samples).

    For example:

    set samples 500