emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Michael Gilbert <mcg@gilbert.org>
Cc: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: gnuplot question - "Specify an entire line to be inserted in the Gnuplot script."
Date: Fri, 29 Jul 2011 13:52:45 -0600	[thread overview]
Message-ID: <87tya4j242.fsf@gmail.com> (raw)
In-Reply-To: <105B4AC5-3799-4715-8F1E-5D3F6A1F4450@gilbert.org> (Michael Gilbert's message of "Fri, 29 Jul 2011 12:29:12 -0700")

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

Hi Michael,

I would recommending using a gnuplot code block rather than a plot line,
and passing your data to the code block using a variable.  Code blocks
give you much more direct access to gnuplot, which I find generally
makes gnuplot learning/debugging much easier.

see http://orgmode.org/manual/Working-With-Source-Code.html

add something like this to your config
(org-babel-do-load-languages
   'org-babel-load-languages
   '((gnuplot . t)))

then try something like the following

Best -- Eric


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: simple-gnuplot-tests.org --]
[-- Type: text/x-org, Size: 1091 bytes --]

** simple gnuplot tests
#+results: some-more-gnuplot
| 1 |  1 |
| 2 |  4 |
| 3 |  9 |
| 4 | 16 |
| 5 | 25 |
| 6 | 36 |
| 7 | 49 |
| 8 | 64 |
#+TBLFM: $2=$1*$1

#+begin_src gnuplot :var data=some-more-gnuplot
  plot "$data"
#+end_src

#+results:

Plotting data points from a table could look like this:
#+tblname: basic-plot
|   x |         y1 |         y2 |
|-----+------------+------------|
| 0.1 |      0.425 |      0.375 |
| 0.2 |     0.3125 |     0.3375 |
| 0.3 | 0.24999993 | 0.28333338 |
| 0.4 |      0.275 |    0.28125 |
| 0.5 |       0.26 |       0.27 |
| 0.6 | 0.25833338 | 0.24999993 |
| 0.7 | 0.24642845 | 0.23928553 |
| 0.8 |    0.23125 |     0.2375 |
| 0.9 | 0.23333323 |  0.2333332 |
|   1 |     0.2225 |       0.22 |

#+begin_src gnuplot :var data=basic-plot :exports code :file basic-plot.png
set title "Putting it All Together"

set xlabel "X"
set xrange [0:1]
set xtics 0,0.1,1

set ylabel "Y"
set yrange [0.2:0.5]
set ytics 0.2,0.05,0.5

plot data u 1:2 w p lw 2 title 'x vs. y1', \
     data u 1:3 w lp lw 1 title 'x vx. y2'
#+end_src

#+results:
[[file:basic-plot.png]]

[-- Attachment #3: Type: text/plain, Size: 649 bytes --]


Michael Gilbert <mcg@gilbert.org> writes:

> Hi —
>
> There is a single line in the OM manual (currently on p32) which reads:
>
> 	line		Specify an entire line to be inserted in the Gnuplot script.
>
> I am trying to insert a couple of horizontal reference lines in a
> simple plot. I have the plot working, but I need an example of this to
> help me along. The Gnuplot manual is a monster all its own and I'm not
> even sure the format is exactly the same. At any rate, I'm a little
> stuck. Any advice?
>
> — Michael
>
> Nonprofit News
> http://nonprofitnews.org
>
>
>

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

  reply	other threads:[~2011-07-29 19:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 19:29 gnuplot question - "Specify an entire line to be inserted in the Gnuplot script." Michael Gilbert
2011-07-29 19:52 ` Eric Schulte [this message]
2011-07-29 22:48   ` Michael C Gilbert
2011-07-29 22:52     ` Eric Schulte
2011-07-29 23:06       ` Michael C Gilbert
2011-07-29 23:41     ` Nick Dokos

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=87tya4j242.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mcg@gilbert.org \
    /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).