emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Paul Stansell <paulstansell@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: using gnuplot's "splot" and "every" commands on org-mode table data
Date: Mon, 13 May 2013 15:43:32 -0600	[thread overview]
Message-ID: <87ehdapncr.fsf@gmail.com> (raw)
In-Reply-To: <CAMJKaZx6OyPK=g5y8uSjJi=tfE8rYsaZotykT3gStAb0dwq-aQ@mail.gmail.com> (Paul Stansell's message of "Wed, 8 May 2013 16:48:49 +0100")

Paul Stansell <paulstansell@gmail.com> writes:

> Hi Eric,
>
> In your last example are you illustrating the case of a data file with
> missing data?

Yes.

> Replacing ""s with blank space in your example doesn't really break
> the plot, it's just that gnuplot interprets the first column of data
> as
>
> 1
> 2
> 3
> 16
>
> 6
> 7
> 4
> 9
>
> and the second as
>
> 2
> 4
> 8
>
>
> 16
> 8
> 4
> 2
>

I would consider this breaking the plot, in that gnuplot no longer lines
up the two columns of data.

>
> Gnuplot has a specific setting for handling missing values.  It's
> common in gnuplot to use '?' to signify a missing value (type "help
> missing" at the gnuplot prompt).  If, in your last example, you
> replace the missing values with '?' (without the quotes) and then type
> in gnuplot
>
>   set datafile missing "?"
>
> and then plot the data with
>
>   plot "data.txt" u 0:1, '' u 0:2
>
> you'll see that gnuplot handles it properly.  Putting '?' in the
> blanks cells of the org mode table in your last attachment and
> plotting from within org mode gives a temporary data file containing
> '"?"', which gnuplot also handles correctly as it must recognise "?"
> (with the quotes) as being a missing value.
>
> But org mode's behaviour of inserting "" in blank cells (instead of
> actual blanks) does break the use of "every" in gnuplot which is
> required by splot when plotting surfaces from data files (unless the
> data files are in "matrix" format).  Also, inserting "" breaks the use
> of gnuplot's "index" which expects two blank lines to separate data
> sets in a single file, but I've never used this facility.
>
> I noticed that org mode writes table values of 'nan' and 'NaN' without
> the double quotes, but, for example, 'MaM' is written with double
> quotes, (as ''"MaM"') in the temporary data file.
>

I didn't know that '?' was the standard gnuplot missing value.  In that
case I think the `org-babel-gnuplot-table-to-data' should be updated to
replace missing values with '?' by default.  If we find a common need to
specialize this value then we can add a gnuplot header argument which
can specify missing values for particular code blocks.

>
> Also, I think it's generally better to remove the double quotes from
> around all strings exported by org mode for plotting by gnuplot as
> they're generally not needed (exceptions are strings which contain
> spaces which can be quoted so they are treated as a single entity by
> gnuplot).  For example, there is a gnuplot demonstration script called
> datastrings.dem which plots data from a file called ctg-y2.dat.  This
> data file has unquoted month names in the first column that are
> plotted as labels on the x-axis.
>

I agree with your reasoning here.  This and the above should be fairly
straightforward changes to the `org-babel-gnuplot-table-to-data'
function.  If I find any free time I'll make these changes.  Although I
certainly wouldn't mind if someone else gets to them first.

Best regards (and thanks for the clear explanations),

>
> Paul

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  reply	other threads:[~2013-05-13 21:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 14:39 using gnuplot's "splot" and "every" commands on org-mode table data Paul Stansell
2013-05-03 16:09 ` Eric Schulte
2013-05-06 18:57   ` Achim Gratz
2013-05-09 12:54     ` Eric S Fraga
2013-05-09 20:23       ` Achim Gratz
2013-05-09 20:42         ` Eric S Fraga
2013-05-11 10:39           ` Achim Gratz
2013-05-11 12:20             ` Rick Frankel
2013-05-21 12:36             ` Eric S Fraga
2013-05-07 17:14   ` Paul Stansell
2013-05-07 18:25     ` Eric Schulte
2013-05-07 18:39       ` Paul Stansell
2013-05-08 12:46         ` Eric Schulte
2013-05-08 15:48           ` Paul Stansell
2013-05-13 21:43             ` Eric Schulte [this message]
2013-05-17 15:00               ` Eric Schulte
2013-05-17 20:18                 ` Paul Stansell
2013-05-17 20:39                   ` Eric Schulte
2013-05-17 21:33                     ` Paul Stansell
2013-08-30 17:16                       ` Paul Stansell
2013-08-30 19:13                         ` Achim Gratz
2013-05-07 18:19   ` Paul Stansell
2013-05-08 12:41     ` Eric Schulte
2013-05-08 16:00       ` Paul Stansell
2013-05-12 18:55       ` Achim Gratz
2013-05-13 21:38         ` Eric Schulte
2013-05-14  7:06           ` Achim Gratz
2014-03-25 18:42           ` Achim Gratz
2013-05-11 10:51   ` Achim Gratz
2013-09-23 14:54   ` Paul Stansell
2013-09-23 23:32     ` Eric Schulte
2013-09-24 12:05       ` Paul Stansell
2013-09-25 18:21         ` Eric Schulte
2013-09-25 20:01           ` Paul Stansell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehdapncr.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=paulstansell@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).