From: "Eric Schulte" <schulte.eric@gmail.com>
To: Suvayu Ali <fatkasuvayu+linux@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: gnuplot with errorbars in org-mode
Date: Sun, 25 Jul 2010 08:48:21 -0600 [thread overview]
Message-ID: <87pqyb1utm.fsf@gmail.com> (raw)
In-Reply-To: <4C4BBCFD.1010406@gmail.com> (Suvayu Ali's message of "Sat, 24 Jul 2010 21:26:37 -0700")
Hi,
I think you're on the right path using Org-babel, here is an altered
version of your gnuplot code block which should work.
#+srcname: plot-data-w-err
#+begin_src gnuplot :var data=data-table :file example.png
set title 'My plot'
plot "$data" using 1:2:3:4:5:6 with xyerrorlines title 'Ordinate (Y)'
#+end_src
This assumes that you have named your table with a line like
#+tblname: data-table
Notice that the example above uses two "header arguments", the ":var"
header argument specifies that the data from data-table should be saved
into the variable named "data", and the :file header argument specifies
that gnuplot should save the resulting graph to a file named
"exmaple.png" and that a link to that graph should be inserted on
evaluation of the code block. Please see the quick-guide and the manual
for more information on code block syntax and header arguments.
Best -- Eric
Quick Guide:Babel
http://orgmode.org/guide/Working-With-Source-Code.html#Working-With-Source-Code
Manual:Babel
http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Hi everyone,
>
> I am a new org-mode user and this is my first post to the mailing
> list. Lately I have been using org-mode to manage the data for a study
> I'm doing for my research project. I primarily use the spreadsheet
> features to do all the calculations and then use gnuplot to plot the
> final result. For all the basic plotting it works great, but I am
> having trouble when I want error bars in my plot.
>
> To demonstrate my point here is a small example.
>
>> #+PLOT: title:"My plot" ind:1 deps:(2) type:2d with:xyerrorlines
>> | Abscissa (X) | Ordinate (Y) | X low edge | X high edge | Y low edge | Y high edge |
>> |--------------+--------------+------------+-------------+------------+-------------|
>> | 60 | 1.1140741 | 0020 | 0100 | 1.1699508 | 1.0680423 |
>> | 150 | 1.1187818 | 0100 | 0200 | 1.1593492 | 1.0855438 |
>> | 350 | 1.1193459 | 0200 | 0500 | 1.1331885 | 1.1086636 |
>> | 600 | 1.1029173 | 0500 | 0700 | 1.0940769 | 1.1121185 |
>> | 850 | 1.0841388 | 0700 | 1000 | 1.0676310 | 1.1000886 |
>> | 1250 | 1.0358938 | 1000 | 1500 | 1.0127586 | 1.0586916 |
>> | 2000 | 0.89370079 | 1500 | 2500 | 0.88014981 | 0.925 |
>
> This gives me an error like this,
>
>> gnuplot> plot '/tmp/org-plot30213YHV' using 1:2 with xyerrorlines title 'Ordinate (Y)'
>> Not enough columns for this style
>
> I have tried changing the "#+PLOT:" line to say this,
>
>> #+PLOT: title:"My plot" ind:1 deps:(2 3 4 5 6) type:2d with:xyerrorlines
>
> But that doesn't work either. I think the problem is org-plot doesn't
> recognise that when plotting with error bars, gnuplot expects more
> than two columns of data. So a command like this should be sent to
> gnuplot,
>
>> plot '/tmp/org-plot30213YHV' using 1:2:3:4:5:6 with xyerrorlines title 'Ordinate (Y)'
>
> In fact typing this on the gnuplot terminal actually generates the
> desired plot!
>
>
> So I thought maybe I should try org-babel. So I tried something like this,
>
>> #+srcname: plot-data-w-err
>> #+begin_src gnuplot
>> set title 'My plot'
>> plot 'data-table' using 1:2:3:4:5:6 with xyerrorlines title 'Ordinate (Y)'
>> #+end_src
>
> and gave my table a name like this,
>
> #+tblname: data-table
>
> But that didn't behave as I was expecting it to. I think I don't quite
> understand how to pass a table as an input to a source block.
>
> I was hoping someone on the list could either help me understand how
> babel uses tables as inputs, or pass the correct command to gnuplot
> with org-plot. BTW, org-mode is phenomenal. Loving every bit of
> it. Thank you Carsten /et al./ :)
>
> Specifics:
> Org-mode version 7.01
> GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.20.1) of
> 2010-05-13 on x86-07.phx2.fedoraproject.org
> gnuplot 4.4 patchlevel 0
next prev parent reply other threads:[~2010-07-25 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-25 4:26 gnuplot with errorbars in org-mode Suvayu Ali
2010-07-25 14:48 ` Eric Schulte [this message]
2010-07-25 16:53 ` suvayu ali
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=87pqyb1utm.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=fatkasuvayu+linux@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).