Method: GnuplotRB::Multiplot#add_plots

Defined in:
lib/gnuplotrb/multiplot.rb

#add_plots(*plots) ⇒ Multiplot Also known as: add_plot, <<, add

Create new Multiplot with given plots added before plot at given position. (by default it adds plot at the front).

Examples:

mp = Multiplot.new(Plot.new('sin(x)'), Plot.new('cos(x)'), layout: [2,1])
enlarged_mp = mp.add_plots(Plot.new('exp(x)')).layout([3,1])
# mp IS NOT affected

Parameters:

  • position (Integer)

    position of plot which you need to replace (by default first plot is replace)

  • plots (Sequence of Plot or Splot)

    plots you want to add

Returns:



150
151
152
153
# File 'lib/gnuplotrb/multiplot.rb', line 150

def add_plots(*plots)
  plots.unshift(0) unless plots[0].is_a?(Numeric)
  self.class.new(@plots.insert(*plots), @options)
end