mirror of
https://github.com/red-data-tools/YouPlot.git
synced 2025-05-06 15:11:12 +08:00
Rename plot_type -> command
This commit is contained in:
parent
d6b6ae963d
commit
9e2f169e6c
@ -32,19 +32,19 @@ module Uplot
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :params, :plot_type
|
attr_accessor :params, :command
|
||||||
attr_reader :raw_inputs, :data, :fmt
|
attr_reader :raw_inputs, :data, :fmt
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@params = Params.new
|
@params = Params.new
|
||||||
|
|
||||||
@plot_type = nil
|
@command = nil
|
||||||
@headers = nil
|
@headers = nil
|
||||||
@delimiter = "\t"
|
@delimiter = "\t"
|
||||||
@transpose = false
|
@transpose = false
|
||||||
@output = false
|
@output = false
|
||||||
@count = false
|
@count = false
|
||||||
@fmt = 'xyy'
|
@fmt = 'xyy'
|
||||||
|
|
||||||
@raw_inputs = []
|
@raw_inputs = []
|
||||||
@debug = false
|
@debug = false
|
||||||
@ -216,17 +216,17 @@ module Uplot
|
|||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@plot_type = argv.shift&.to_sym
|
@command = argv.shift&.to_sym
|
||||||
|
|
||||||
unless parsers.has_key?(plot_type)
|
unless parsers.has_key?(command)
|
||||||
if plot_type.nil?
|
if command.nil?
|
||||||
warn main_parser.help
|
warn main_parser.help
|
||||||
else
|
else
|
||||||
warn "uplot: unrecognized command '#{plot_type}'"
|
warn "uplot: unrecognized command '#{command}'"
|
||||||
end
|
end
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
parser = parsers[plot_type]
|
parser = parsers[command]
|
||||||
|
|
||||||
begin
|
begin
|
||||||
parser.parse!(argv) unless argv.empty?
|
parser.parse!(argv) unless argv.empty?
|
||||||
@ -248,7 +248,7 @@ module Uplot
|
|||||||
@raw_inputs << input
|
@raw_inputs << input
|
||||||
@data = Preprocessing.input(input, @delimiter, @headers, @transpose)
|
@data = Preprocessing.input(input, @delimiter, @headers, @transpose)
|
||||||
pp @data if @debug
|
pp @data if @debug
|
||||||
case plot_type
|
case command
|
||||||
when :bar, :barplot
|
when :bar, :barplot
|
||||||
Plot.barplot(data, params, @count)
|
Plot.barplot(data, params, @count)
|
||||||
when :count, :c
|
when :count, :c
|
||||||
@ -266,7 +266,7 @@ module Uplot
|
|||||||
when :box, :boxplot
|
when :box, :boxplot
|
||||||
Plot.boxplot(data, params)
|
Plot.boxplot(data, params)
|
||||||
else
|
else
|
||||||
raise "unrecognized plot_type: #{plot_type}"
|
raise "unrecognized plot_type: #{command}"
|
||||||
end.render($stderr)
|
end.render($stderr)
|
||||||
|
|
||||||
print input if @output
|
print input if @output
|
||||||
|
Loading…
Reference in New Issue
Block a user