diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index 2112b4c..6732b05 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -32,7 +32,8 @@ module Uplot main_parser = create_parser parsers = Hash.new { |h, k| h[k] = create_parser } parsers['hist'] .on('--nbins VAL', Numeric) { |v| @params[:nbins] = v } - parsers['histogram'] = parsers['hist'] + parsers['histogram'] = parsers['hist'] + parsers['line'] .on('-x', '--xlim VAL', String) { |v| @params[:xlim] = get_lim(v) } parsers['lineplot'] = parsers['line'] parsers['lineplots'] = parsers['lines'] parsers['scatterplot'] = parsers['scatter'] @@ -108,6 +109,10 @@ module Uplot UnicodePlot.histogram(series, **@params.compact) end + def get_lim(str) + str.split(/-|:|\.\./)[0..1].map(&:to_f) + end + def line(data, headers) if data.size == 1 @params[:name] ||= headers[0] if headers