When the data for a plot with "smooth frequency" contains at least one value twice, then a table output contains one additional invalid last line.
This comes in while rendering the data monotonic, same happens for smoothing options unique, cumulative and cnormal. The problem is in the function cp_implode() in interpol.c:1311. The invalid point is created to separate data blocks and -sets.
A partial fix would be to not do this for the last block/set, but that condition is not known beforehand. If all points in a set are already unique, a blank line appears after it in the output, which is of course desireable.
set table plot '-' using 1:(1) smooth freq 1 2 1 1 6 2 2 4 e unset table
gives
# Curve 0 of 1, 9 points # Curve title: "'-' using 1:(1)" # x y type 1 1 i 2 1 i 1 2 i 6 1 i 6 1 u 2 2 i 4 1 i 2 1 u
Karl Ratzsch
2013-08-14
Diff:
--- old +++ new @@ -13,9 +13,9 @@ gives === -# Curve 0 of 1, 3 points -# Curve title: "'-' using 1:(1)" -# x y type +\# Curve 0 of 1, 3 points +\# Curve title: "'-' using 1:(1)" +\# x y type 1 2 i 6 1 i 6 1 u
Karl Ratzsch
2014-03-23
My description was very strange, and this should have been filed as a bug report.
P.S. Still the same in 4.6.5 (windows -rc2 build), so it seems unrelated to that bug with an invalid value after a blank line in the data file
Karl Ratzsch
2014-03-23
Karl Ratzsch
2015-04-21
Diff:
--- old +++ new @@ -1,23 +1,38 @@ When the data for a plot with "smooth frequency" contains at least one value twice, then a table output contains one additional invalid last line. -=== -set table -plot '-' using 1:(1) smooth freq -1 -1 -6 -e -unset table -=== +This comes in while rendering the data monotonic, same happens for smoothing options unique, cumulative and cnormal. The problem is in the function cp_implode() in interpol.c:1311. The invalid point is created to separate data blocks and -sets. + +A partial fix would be to not do this for the last block/set, but that condition is not known beforehand. If all points in a set are already unique, a blank line appears after it in the output, which is of course desireable. + + set table + plot '-' using 1:(1) smooth freq + 1 + 2 + + 1 + 1 + 6 + + 2 + 2 + 4 + e + unset table + gives -=== -\# Curve 0 of 1, 3 points -\# Curve title: "'-' using 1:(1)" -\# x y type - 1 2 i - 6 1 i - 6 1 u -=== + # Curve 0 of 1, 9 points + # Curve title: "'-' using 1:(1)" + # x y type + 1 1 i + 2 1 i + 1 2 i + 6 1 i + 6 1 u + 2 2 i + 4 1 i + 2 1 u + +