plotpipe: --logx/y/xy implemented.

This commit is contained in:
Ole Tange 2020-11-26 20:27:15 +01:00
parent c345e1a816
commit 39f19757ae

View file

@ -9,7 +9,7 @@ plotpipe - Plot CSV data from a pipe
=head1 SYNOPSIS
I<datagenerator> | B<plotpipe> [-n] [-H] [-0] [-C str] [-h] [-V]
I<datagenerator> | B<plotpipe> [-n] [-H] [-0] [--logx] [--logy] [-C str] [-h] [-V]
=head1 DESCRIPTION
@ -48,6 +48,15 @@ B<--header>.
Show help.
=item B<--logx>
=item B<--logy>
=item B<--logxy>
Logarithmic X/Y/X&Y axis.
=item B<--nox>
=item B<-n>
@ -160,6 +169,9 @@ sub options_hash() {
"version|V" => \$opt::version,
"colsep|col-sep|C=s" => \$opt::colsep,
"help|h" => \$opt::help,
"logx" => \$opt::logx,
"logy" => \$opt::logy,
"logxy" => \$opt::logxy,
"null|0" => \$opt::null,
"nox|n" => \$opt::nox,
"header|H" => \$opt::header,
@ -291,7 +303,7 @@ sub find_sep(@) {
Getopt::Long::Configure("bundling","require_order");
my $retval = GetOptions(options_hash());
$Global::progname = "plotpipe";
$Global::version = 20201005;
$Global::version = 20201125;
if($opt::version) { version(); exit 0; }
if($opt::help) { help(); exit 0; }
if($opt::null) { $/ = "\0"; }
@ -363,9 +375,19 @@ for(my $col = 2; $col <= $ncols; $col++) {
push @plotscript, qq("$filename" using 1:$col with lines $legend,);
}
my @logscale;
if($opt::logx or $opt::logxy) {
push @logscale, "set logscale x 10;";
}
if($opt::logy or $opt::logxy) {
push @logscale, "set logscale y 10;";
}
# Make full Gnuplot script
my $plotscript=<<_EOS ;
set title "@title";
@logscale
set xtics rotate;
set autoscale;
set xlabel "$header[0]";