mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-07 23:51:12 +08:00
Try to add xlim option
This commit is contained in:
parent
1fb369e26b
commit
7c0ab3ebdb
@ -33,6 +33,7 @@ module Uplot
|
|||||||
parsers = Hash.new { |h, k| h[k] = create_parser }
|
parsers = Hash.new { |h, k| h[k] = create_parser }
|
||||||
parsers['hist'] .on('--nbins VAL', Numeric) { |v| @params[:nbins] = v }
|
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['lineplot'] = parsers['line']
|
||||||
parsers['lineplots'] = parsers['lines']
|
parsers['lineplots'] = parsers['lines']
|
||||||
parsers['scatterplot'] = parsers['scatter']
|
parsers['scatterplot'] = parsers['scatter']
|
||||||
@ -108,6 +109,10 @@ module Uplot
|
|||||||
UnicodePlot.histogram(series, **@params.compact)
|
UnicodePlot.histogram(series, **@params.compact)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_lim(str)
|
||||||
|
str.split(/-|:|\.\./)[0..1].map(&:to_f)
|
||||||
|
end
|
||||||
|
|
||||||
def line(data, headers)
|
def line(data, headers)
|
||||||
if data.size == 1
|
if data.size == 1
|
||||||
@params[:name] ||= headers[0] if headers
|
@params[:name] ||= headers[0] if headers
|
||||||
|
Loading…
Reference in New Issue
Block a user