mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-09-18 01:29:37 +08:00
Fix xlim and ylim
This commit is contained in:
@@ -90,6 +90,7 @@ module YouPlot
|
||||
params.name ||= headers[1]
|
||||
params.xlabel ||= headers[0]
|
||||
end
|
||||
params.xlim ||= series[0].flatten.minmax # why need?
|
||||
params.ylim ||= series[1..-1].flatten.minmax # why need?
|
||||
plot = UnicodePlot.public_send(method1, series[0], series[1], **params.to_hc)
|
||||
2.upto(series.size - 1) do |i|
|
||||
@@ -103,13 +104,14 @@ module YouPlot
|
||||
series = data.series
|
||||
method2 = get_method2(method1)
|
||||
series.map! { |s| s.map(&:to_f) }
|
||||
series = series.each_slice(2).to_a
|
||||
series2 = series.each_slice(2).to_a
|
||||
series = nil
|
||||
params.name ||= headers[0] if headers
|
||||
params.xlim = series.map(&:first).flatten.minmax # why need?
|
||||
params.ylim = series.map(&:last).flatten.minmax # why need?
|
||||
params.xlim ||= series2.map(&:first).flatten.minmax # why need?
|
||||
params.ylim ||= series2.map(&:last).flatten.minmax # why need?
|
||||
x1, y1 = series.shift
|
||||
plot = UnicodePlot.public_send(method1, x1, y1, **params.to_hc)
|
||||
series.each_with_index do |(xi, yi), i|
|
||||
series2.each_with_index do |(xi, yi), i|
|
||||
UnicodePlot.public_send(method2, plot, xi, yi, name: headers&.[]((i + 1) * 2))
|
||||
end
|
||||
plot
|
||||
|
Reference in New Issue
Block a user