def output(filename,**opts)
    term = opts.delete(:term) || opts.delete(:terminal)
    if term.nil? && /\.(\w+)$/ =~ filename
      term = $1
    end
    term = KNOWN_EXT[term] || term
    if term.nil?
      kernel_raise GnuplotError,"file extension is not given"
    end
    set :terminal, term, *opts
    set output:filename
    refresh
    unset :terminal
    unset :output
  end
def output(filename,**opts)
    term = opts.delete(:term) || opts.delete(:terminal)
    if term.nil? && /\.(\w+)$/ =~ filename
      term = $1
    end
    term = KNOWN_EXT[term] || term
    if term.nil?
      kernel_raise GnuplotError,"file extension is not given"
    end
    set :terminal, term, *opts
    set output:filename
    refresh
    unset :terminal
    unset :output
  end
output current plot to file with terminal setting from extension
 (not Gnuplot command)