emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Paul Stansell <paulstansell@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: using gnuplot's "splot" and "every" commands on org-mode table data
Date: Fri, 17 May 2013 21:18:14 +0100	[thread overview]
Message-ID: <CAMJKaZydBvavJs5NXPEsQOVpaZ6S+5CifgY+FCeDLyqSKfdBSg@mail.gmail.com> (raw)
In-Reply-To: <87mwrtk5xa.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

Hi Eric,

Thanks for your work on this.  I've tried your latest changes and I
think they're a big improvement.

I've attached another org-mode file for you to try.  It illustrates
the use of double blank lines in the first table (called block_data)
to inform gnuplot that there're two separate data sets in the single
data file.  The first code block (gnuplot_1) plots these two data sets
as red and green surfaces.  It's really nice that gnuplot can now be
used in this way from within org-mode.

One slight drawback, however, is that there still doesn't seem to be a
way to specify missing values in the org table in the way they're
frequently used by gnuplot.  An illustration of what I mean by this is
given in the table block_data_missing in the attached org file.
You'll see that I've inserted two '?' characters for missing z-values.
 If you execute the second and third code blocks (gnuplot_2 and
gnuplot_3) you'll see that neither give the desired result.

If the block_data_missing table were exported exactly as it is except
for the removal of the '|' characters and "set datafile missing '?'"
were specified in the gnuplot script this would enable gnuplot to plot
the red and green surfaces with the missing values.  To see this try
executing the last code block (gnuplot_4) which plots the data which
is first "cleaned" by the shell command you suggested in a previous
post.  This would also remove the need to have the :missing header
argument.

Kind regards,

Paul

[-- Attachment #2: gnuplot2.org --]
[-- Type: application/octet-stream, Size: 1690 bytes --]

#+Property: :results silent

#+name: block_data
| 1 | 1 |  2 |
| 1 | 2 |  5 |
| 1 | 3 | 10 |
|   |   |    |
| 2 | 1 |  5 |
| 2 | 2 |  8 |
| 2 | 3 | 13 |
|   |   |    |
| 3 | 1 | 10 |
| 3 | 2 | 12 |
| 3 | 3 | 18 |
|   |   |    |
|   |   |    |
| 1 | 1 | 12 |
| 1 | 2 | 15 |
| 1 | 3 | 20 |
|   |   |    |
| 2 | 1 | 15 |
| 2 | 2 | 18 |
| 2 | 3 | 23 |
|   |   |    |
| 3 | 1 | 20 |
| 3 | 2 | 23 |
| 3 | 3 | 28 |

#+name: gnuplot_1
#+begin_src gnuplot :var d=block_data
  set ticslevel 0 # This removes the non-zero offset in z.
  splot d index 0 u 1:2:3 w lp pt 6 ps 5, d index 1 u 1:2:3 w lp pt 6 ps 5
#+end_src

#+name: block_data_missing
| 1 | 1 |  2 |
| 1 | 2 |  5 |
| 1 | 3 | 10 |
|   |   |    |
| 2 | 1 |  5 |
| 2 | 2 | 10 |
| 2 | 3 | 13 |
|   |   |    |
| 3 | 1 | 10 |
| 3 | 2 |  ? |
| 3 | 3 | 18 |
|   |   |    |
|   |   |    |
| 1 | 1 | 12 |
| 1 | 2 | 15 |
| 1 | 3 | 20 |
|   |   |    |
| 2 | 1 | 15 |
| 2 | 2 | 18 |
| 2 | 3 | 23 |
|   |   |    |
| 3 | 1 |  ? |
| 3 | 2 | 23 |
| 3 | 3 | 28 |

#+name: gnuplot_2
#+begin_src gnuplot :var d=block_data_missing :missing "?"
  set ticslevel 0
  splot d index 0 u 1:2:3 w lp pt 6 ps 5, d index 1 u 1:2:3 w lp pt 6 ps 5
#+end_src

#+name: gnuplot_3
#+begin_src gnuplot :var d=block_data_missing
  set ticslevel 0
  splot d index 0 u 1:2:3 w lp pt 6 ps 5, d index 1 u 1:2:3 w lp pt 6 ps 5
#+end_src

#+name: clean
#+begin_src sh :var data=block_data_missing :results file :file /tmp/data.gnuplot
  echo "$data" > /tmp/data.gnuplot
#+end_src

#+name: gnuplot_4
#+begin_src gnuplot :var d=clean(block_data_missing)
  set ticslevel 0
  set datafile missing '?'
  splot d index 0 u 1:2:3 w lp pt 6 ps 5, d index 1 u 1:2:3 w lp pt 6 ps 5
#+end_src

  reply	other threads:[~2013-05-17 20:18 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
2013-05-17 15:00               ` Eric Schulte
2013-05-17 20:18                 ` Paul Stansell [this message]
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=CAMJKaZydBvavJs5NXPEsQOVpaZ6S+5CifgY+FCeDLyqSKfdBSg@mail.gmail.com \
    --to=paulstansell@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@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).