In [1]:
require 'gnuplotrb'
include GnuplotRB
cartesian = Plot.new(
['x*sin(x)', with: 'lines', lt: { rgb: 'blue', lw: 3 }],
xrange: -10..10,
title: 'Math function example',
ylabel: 'x',
xlabel: 'x*sin(x)'
)
Out[1]:
In [2]:
Plot.new(
['abs(sin(3*t))', with: 'filledcurves', lt: { rgb: 'red' }],
title: 'Plot in polar example',
polar: true,
samples: 500
)
Out[2]:
In [3]:
Plot.new(
['1.5*cos(t) - cos(30*t), 1.5*sin(t) - sin(30*t)', title: 'Parametric curve', lw: 2],
title: 'Parametric plot example',
parametric: true,
samples: 1000,
xrange: -3..3,
yrange: -3..3
)
Out[3]: