Menu

#694 Add options to set table command

Version 5
closed-out-of-date
nobody
None
5
2023-02-13
2014-06-20
No

The attached patch adds two options to the set table command.
The first option 'clip' removes the last text column with the point type and only writes the points into the table that fall inside the active range.
The second option 'symerr' replaces the error bands ("y ylow yhigh") with a single value ("y yerr") specifying the errorbar, e.g. "10 9.5 10.5" becomes "10 0.5".
Both options are useful when the set table command is used together with a more advanced plot command (e.g. smooth freq) and the resulting table is used afterwards to fit a function to this data.

1 Attachments

Discussion

  • Karl Ratzsch

    Karl Ratzsch - 2014-06-24

    With the new plot style "table", you can already define arbitrary columns to be written to the file, without the "i"/"o" mark.

    set table;set samp 10
    plot "+" using 1:(sin($1)):(0.1):(sin($1)*0.2) with table
    

    What is missing is an option to selectively suppress points that are invalid (NaN) and/or outside the current yrange.

     

    Last edit: Karl Ratzsch 2014-06-24
  • Karl Ratzsch

    Karl Ratzsch - 2014-12-11

    This could be done by adding an option "suppress" to "with table". It would then evaluate an additional "using" entry. E.g.

    plot dataf using 1:(f($1)):($2==NaN ? NaN : $1==0 ? -1 : 1) with table suppress
    

    If the third column evaluates to NaN (or zero?), the line would not be printed at all, one prints it.

    Additionally, minus one could cause an empty line to be printed instead, minus 2 for two empy lines.

     
  • Ethan Merritt

    Ethan Merritt - 2017-07-18

    Patch attached that is under consideration for 5.3 and 5.2
    It fixes a couple of real problems so I will probably apply it soon.
    However it also adds a new option to filter the data points written into a table that seems like it would address your request. It is marked EXPERIMENTAL in the documentation and may change a bit before the feature is added.
    Documentation section here:

    gnuplot> help plot with table
    
     To avoid any style-dependent processing of the input data being tabulated
     (smoothing, errorbar expansion, secondary range checking, etc), or to increase
     the number of columns that can be tabulated, use the keyword "table" instead of
     a normal plot style.  In this case the output does not contain an extra, last,
     column of flags `i`, `o`, `u` indicated inrange/outrange/undefined.
     The destination for output must first be specified with `set table <where>`.
     For example
    
          set table $DATABLOCK1
          plot <file> using 1:2:3:4:($5+$6):(func($7)):8:9:10 with table
    
     Because there is no actual plot style in this case the columns have no 
     correspondence to specific axes.  Therefore xrange, yrange, etc are ignored.
     [EXPERIMENTAL]
     To select only a subset of the data points for tabulation you can provide an
     input filter condition (`if <expression>`) at the end of the command.
     Note that the input filter may reference data columns that are not part of
     the output.
    
          plot <file> using 1:2:($4+$5) with table if (strcol(3) eq "Red")
          plot <file> using 1:2:($4+$5) with table if (10. < $1 && $1 < 100.)
          plot <file> using 1:2:($4+$5) with table if (filter($6,$7) != 0)
    
     

    Last edit: Ethan Merritt 2017-07-19
    • Ethan Merritt

      Ethan Merritt - 2017-07-21

      All of this is now in 5.3

      The "with table" code in 5.2 has been updated to fix bugs and to handle strings but I did not add the input filter code. Let's give that a trial in 5.3 so that people can point out all the better ways to do it that I didn't think of :-)

      For completeness, here is a patch adding the current state of "with table if <expression>" to 5.2

       
  • Ethan Merritt

    Ethan Merritt - 2023-02-13
    • status: open --> closed-out-of-date
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.