def to_specific_term(terminal, path = nil, **options)
      if path
        result = plot(term: [terminal, options], output: path)
      else
        path = Dir::Tmpname.make_tmpname(terminal, 0)
        plot(term: [terminal, options], output: path)
        result = File.binread(path)
        File.delete(path)
      end
      result
    end
def to_specific_term(terminal, path = nil, **options)
      if path
        result = plot(term: [terminal, options], output: path)
      else
        path = Dir::Tmpname.make_tmpname(terminal, 0)
        plot(term: [terminal, options], output: path)
        result = File.binread(path)
        File.delete(path)
      end
      result
    end
@private
 Output plot to specific terminal (possibly some file).
 Explicit use should be avoided. This method is called from #method_missing
 when it handles method names like #to_png(options).

 @param trminal [String] terminal name ('png', 'svg' etc)
 @param path [String] path to output file, if none given it will output to temp file
   and then read it and return binary contents of file
 @param options [Hash] used in #plot
 @example
   ## plot here may be Plot, Splot, Multiplot or any other plottable class
   plot.to_png('./result.png', size: [300, 500])
   contents = plot.to_svg(size: [100, 100])
   plot.to_dumb('./result.txt', size: [30, 15])