#334 Print curve title in table output

closed-accepted
Ethan Merritt
None
5
2008-02-16
2007-04-25
Harald Harders
No

This patch includes the title of a curve or surface into the output file in a table output. For example,

set samples 2
set table 'tmp.dat'
plot sin(x) title 'this is a title',\ cos(x) title "multiline\ntitle",\ tan(x) notitle,\ x # auto title
unset table

results in:

# Curve 0 of 4, 2 points
# Curve title: `this is a title'
# x y type
-10 0.544021 i
10 -0.544021 i

# Curve 1 of 4, 2 points
# Curve title: `multiline
# title'
# x y type
-10 -0.839072 i
10 -0.839072 i

# Curve 2 of 4, 2 points
# x y type
-10 -0.648361 i
10 0.648361 i

# Curve 3 of 4, 2 points
# Curve title: `x'
# x y type
-10 -10 i
10 10 i

Discussion

1 2 > >> (Page 1 of 2)
  • Harald Harders
    Harald Harders
    2007-04-25

    Patch against cvs version as of 20070425

     
  • Ethan Merritt
    Ethan Merritt
    2007-04-25

    Logged In: YES
    user_id=235620
    Originator: NO

    I have no objection to this.
    But while you're looking at the table code, how about updating it to know about some of the newer plot types? For starters it would be nice to be able to dump tabular output from:
    {s}plot with labels
    {s}plot with vectors
    {s}plot with points pointsize variable

    With additional work it should be possible to handle histograms and extra columns with color information. But IMHO image and rgbimage are not worth the effort.

     
  • Harald Harders
    Harald Harders
    2007-04-25

    Logged In: YES
    user_id=207272
    Originator: YES

    Good idea. Unfortunately, I will not have the time to contribute much to this. What about starting with this small patch and extending the functionality step by step?

     
  • Petr Mikulik
    Petr Mikulik
    2007-04-26

    Logged In: YES
    user_id=31505
    Originator: NO

    I have found an older mail about a proposal of useful options for the table output.
    Here is the excerpt:

    The table terminal can be used to save gridded data into a file. Then it
    would be convenient to strip the comments and the last column with flags.
    Even though it is possible to parse the output file via an awk script, I
    think that the following built-in options could be useful:

    set term table [[no]com$ments] [space | tab | separator "xx"] [ [[no]u] [[no]i] [[no]o]
    [[no]flag]

    Current definition is:
    set term table comments space u i o flag

    (*) nocomments - don't write comments to the output file
    (*) tab - separate columns by \t instead of single space
    (*) i, o, u - write data points which are in, out, undef
    (*) noi, noo, nou - don't write data points which are in, out, undef
    (*) [no]flag - [don't] write the last column with the u,i,o flag

     
  • Ethan Merritt
    Ethan Merritt
    2007-04-28

    • assigned_to: nobody --> sfeam
    • status: open --> open-accepted
     
  • Ethan Merritt
    Ethan Merritt
    2007-04-28

    Logged In: YES
    user_id=235620
    Originator: NO

    First cut at a more capable tabular output system is now in CVS.

    I like the idea of providing an option for csv output format, and will work on adding that. I think to do this properly will require more than just changing the separator character.

    Why would you need or want to strip out the comments? If the presence of comments is messing up the input, let's fix the input parser. It is supposed to ignore comments.

    Conversely, why would you ever need the i/o/u flags? They will be re-calculated on input if you read the data in again, and will change with the axis limits and scaling. Do the transient flag values written into the table by the current code have any use at all?

     
  • Petr Mikulik
    Petr Mikulik
    2007-05-02

    Logged In: YES
    user_id=31505
    Originator: NO

    > Why would you need or want to strip out the comments? If the presence of
    > comments is messing up the input, let's fix the input parser. It is
    > supposed to ignore comments.

    I want to read the file into Octave/Matlab by the "load" command. The "i" column makes troubles in Matlab, and the comment "#" lines are stop-points in Matlab.

    > Conversely, why would you ever need the i/o/u flags? They will be
    > re-calculated on input if you read the data in again, and will change with
    > the axis limits and scaling. Do the transient flag values written into the
    > table by the current code have any use at all?

    I guess someone put this information there is mainly for "debugging" purposes.
    I don't remember I needed it.
    So, in order to keep backwards compatibility, I would like an option to disable them all.

    Another need for the table output: option to put double-blank lines instead of single-ones.
    This would avoid the awk processing step in FAQ 3.13 and 3.14 (after the table output of contours).

     
  • Ethan Merritt
    Ethan Merritt
    2007-05-05

    Logged In: YES
    user_id=235620
    Originator: NO

    > the comment "#" lines are stop-points in Matlab.

    I would consider that either a bug in Matlab, or a reason to add an option to change the comment character. I don't see it as a reason not to put comments in gnuplot data files.

    > Another need for the table output: option to put double-blank lines instead of single-ones.

    Yes, that sounds like a real need. But I don't understand well how one would know when/where to insert the extra line. Is it a well defined set of cases?

     
  • Petr Mikulik
    Petr Mikulik
    2007-05-10

    Logged In: YES
    user_id=31505
    Originator: NO

    >> the comment "#" lines are stop-points in Matlab.
    >I would consider that either a bug in Matlab,

    Matlab accepts only numbers for reading matrices by its "load" command.

    >> Another need for the table output: option to put double-blank
    >> lines instead of single-ones.
    > Yes, that sounds like a real need. But I don't understand well
    > how one would know when/where to insert the extra line.

    The double line should be separating all data scans (i.e., there won't be a mix of single and double blanks, but only double blanks).

     
  • Harald Harders
    Harald Harders
    2008-02-16

    Logged In: YES
    user_id=207272
    Originator: YES

    Isnt't this patch to be closed since the core functionality of this patch is included in Gnuplot? The open question regarding Matlab is another thing to be discussed separately.

     
1 2 > >> (Page 1 of 2)