|
From: sfeam <sf...@us...> - 2017-07-21 16:05:24
|
The "plot with table" code in the development version has been revised.
FIX:
5.0 5.2 and 5.3 all fixed so that "set style data table" is handled properly.
Previously this caused the program to attempt both a plot and a table,
generally mangling both.
NEW:
5.2 and 5.3 modified so that string-valued expressions can be used.
Examples:
plot foo using 1:2:( strcol(3) ) with table
plot foo using 1:2:( $3<0 ? "Negative" : "Positive") with table
Note that this allows you to customize the format for numerical output
plot foo 1:( sprintf("%5.2f Units", $2) with table
NEW
5.3 only
create csv files
set table "outfile.csv" separator comma
plot foo using 1:2:3:4 with table
separator can be comma or tab or "<char>"
NEW
5.3 only (marked EXPERIMENTAL)
New optional input filter that selects data points for tabulation
plot foo using 1:2:3 with table {if <expression>}
Because the output columns from "with table" are arbitrary, it is not
possible to limit the output via xrange or yrange. Also inclusion of a
column that evaluates to not-a-number does not prevent the whole
line from being included in the tabular output. So the usual gnuplot
trick of saying "using ( test($1) : $1 : 1/0 ):2:3" does not work.
This new option provides essentially the same capabilities.
Restrict on numerical range:
plot foo using ("1-100"):1:2:3 with table if (0 < $1 && $1 < 100.)
Select a particular column value from the input
plot foo using 1:2:3 with table if (strcol(4) eq "Red")
The filter expression can use any functions that would be legal in
a using specifier ($1 column(1) stringcolumn(1) strcol(1) ...)
Please comment!
The implementation is trivial. It's basically just another using specifier
except that it isn't tied to any particular column or axis.
I'm less certain that using the keyword "if" is a good idea.
Originally I thought about "[input] filter" but "if" seemed an obvious
shorthand and also has an obvious meaning of its own.
The "if" keyword is only recognized after "with table".
I suppose that it could be extended to apply after normal plot styles
as well if we wanted to do so.
Ethan
|