Add grid to parser

This commit is contained in:
kojix2 2021-01-19 19:04:08 +09:00
parent b2f2c16c59
commit c9513e463f

View File

@ -171,6 +171,12 @@ module YouPlot
end
end
def sub_parser_add_grid
sub_parser.on_head('--[no-]grid', TrueClass, 'draws grid-lines at the origin') do |v|
params.grid = v
end
end
def create_sub_parser
@sub_parser = create_default_parser
sub_parser.banner = \
@ -191,59 +197,61 @@ module YouPlot
when :barplot, :bar
sub_parser_add_symbol
sub_parser_add_xscale
sub_parser.on_head('--fmt STR', String, 'xy : header is like x, y...', 'yx : header is like y, x...') do |v|
@options[:fmt] = v
end
sub_parser_add_xscale
when :count, :c
sub_parser_add_symbol
sub_parser_add_xscale
when :histogram, :hist
sub_parser.on_head('-n', '--nbins INT', Numeric, 'approximate number of bins') do |v|
params.nbins = v
end
sub_parser_add_symbol
sub_parser.on_head('--closed STR', String, 'side of the intervals to be closed [left]') do |v|
params.closed = v
end
sub_parser_add_symbol
sub_parser.on_head('-n', '--nbins INT', Numeric, 'approximate number of bins') do |v|
params.nbins = v
end
when :lineplot, :line
sub_parser_add_canvas
sub_parser_add_xlim
sub_parser_add_grid
sub_parser.on_head('--fmt STR', String, 'xy : header is like x, y...', 'yx : header is like y, x...') do |v|
@options[:fmt] = v
end
sub_parser_add_xlim
when :lineplots, :lines
sub_parser_add_canvas
sub_parser_add_xlim
sub_parser_add_ylim
sub_parser_add_grid
sub_parser.on_head('--fmt STR', String, 'xyxy : header is like x1, y1, x2, y2, x3, y3...',
'xyy : header is like x, y1, y2, y2, y3...') do |v|
@options[:fmt] = v
end
sub_parser_add_ylim
sub_parser_add_xlim
when :scatter, :s
sub_parser_add_canvas
sub_parser_add_xlim
sub_parser_add_ylim
sub_parser_add_grid
sub_parser.on_head('--fmt STR', String, 'xyxy : header is like x1, y1, x2, y2, x3, y3...',
'xyy : header is like x, y1, y2, y2, y3...') do |v|
@options[:fmt] = v
end
sub_parser_add_ylim
sub_parser_add_xlim
when :density, :d
sub_parser.on_head('--grid', TrueClass) do |v|
params.grid = v
end
sub_parser_add_xlim
sub_parser_add_ylim
sub_parser_add_canvas
sub_parser_add_grid
sub_parser.on('--fmt STR', String, 'xyxy : header is like x1, y1, x2, y2, x3, y3...',
'xyy : header is like x, y1, y2, y2, y3...') do |v|
@options[:fmt] = v
end
sub_parser_add_ylim
sub_parser_add_xlim
when :boxplot, :box
sub_parser_add_xlim