def plot(term = nil, multiplot_part: false, **options)
      fail ArgumentError, 'Empty plots are not supported!' if @datasets.empty?
      inner_opts = if multiplot_part
                     @options.merge(options).reject { |key, _| [:term, :output].include?(key) }
                   else
                     @options.merge(options)
                   end
      terminal = term || (inner_opts[:output] ? Terminal.new : own_terminal)
      ds_string = @datasets.map { |dataset| dataset.to_s(terminal) }.join(' , ')
      full_command = @cmd + ds_string
      terminal.set(inner_opts).stream_puts(full_command).unset(inner_opts.keys)
      if inner_opts[:output]
        # guaranteed wait for plotting to finish
        terminal.close unless term
        # not guaranteed wait for plotting to finish
        # work bad with terminals like svg and html
        sleep 0.01 until File.size?(inner_opts[:output])
      end
      self
    end
def plot(term = nil, multiplot_part: false, **options)
      fail ArgumentError, 'Empty plots are not supported!' if @datasets.empty?
      inner_opts = if multiplot_part
                     @options.merge(options).reject { |key, _| [:term, :output].include?(key) }
                   else
                     @options.merge(options)
                   end
      terminal = term || (inner_opts[:output] ? Terminal.new : own_terminal)
      ds_string = @datasets.map { |dataset| dataset.to_s(terminal) }.join(' , ')
      full_command = @cmd + ds_string
      terminal.set(inner_opts).stream_puts(full_command).unset(inner_opts.keys)
      if inner_opts[:output]
        # guaranteed wait for plotting to finish
        terminal.close unless term
        # not guaranteed wait for plotting to finish
        # work bad with terminals like svg and html
        sleep 0.01 until File.size?(inner_opts[:output])
      end
      self
    end
@param *datasets [Sequence of Dataset or Array] either instances of Dataset class or
   "[data, **dataset_options]"" arrays
 @param options [Hash] see Plot top level doc for options examples

 Output plot to term (if given) or to this plot's own terminal.

 @param term [Terminal] Terminal object to plot to
 @param :multiplot_part [Boolean] true if this plot is part of a multiplot. For inner use!
 @param options [Hash] see options in Plot top level doc.
   Options passed here have priority over already existing.
 @return [Plot] self