Gnuplot have special layout for placing multiple plots on single layout and GnuplotRB supports this feature as well.

In [1]:

```
require 'gnuplotrb'
include GnuplotRB
sinx = Plot.new('sin(x)', title: 'Sin')
exp = Plot.new('exp(x)', title: 'Exp')
log = Plot.new('log(x)', title: 'Log')
sphere = Splot.new(
['sin(u)*cos(v), sin(u)*sin(v), cos(u)', title: 'Sphere'],
parametric: true,
urange: 0..Math::PI,
vrange: 0..2*Math::PI,
title: 'sphere',
hidden3d: true,
isosamples: 30
)
nil
```

In [2]:

```
rows, cols = 2, 2
basic_four = Multiplot.new(sinx, exp, log, sphere, layout: [rows, cols])
```

Out[2]:

You can also set one title for the whole layout.

In [3]:

```
basic_four.title('Multiplot example')
```

Out[3]:

In [4]:

```
basic_two = Multiplot.new(sinx, sphere, layout: [1,2])
```

Out[4]: