From mboxrd@z Thu Jan 1 00:00:00 1970 From: suvayu ali Subject: Re: gnuplot with errorbars in org-mode Date: Sun, 25 Jul 2010 09:53:29 -0700 Message-ID: References: <4C4BBCFD.1010406@gmail.com> <87pqyb1utm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=51656 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Od4SW-0002xC-9H for emacs-orgmode@gnu.org; Sun, 25 Jul 2010 12:53:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Od4SU-000656-JJ for emacs-orgmode@gnu.org; Sun, 25 Jul 2010 12:53:52 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:48903) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Od4SU-00064t-ER for emacs-orgmode@gnu.org; Sun, 25 Jul 2010 12:53:50 -0400 Received: by vws16 with SMTP id 16so1920118vws.0 for ; Sun, 25 Jul 2010 09:53:49 -0700 (PDT) In-Reply-To: <87pqyb1utm.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org This works like a charm Eric!! Now with org-babel working I can imagine all sorts of wonderful possibilities. I can now have common code blocks which are called to setup the gnuplot terminal depending on the need (say for png or eps or just regular interactive) for different sets of data or different output requirements! Thank you sooo much. :) On 25 July 2010 07:48, Eric Schulte wrote: > 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=3Ddata-table :file example.png > =A0set title 'My plot' > =A0plot "$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. =A0Please see the quick-guide and the manua= l > 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-Sourc= e-Code > > Manual:Babel > http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Sour= ce-Code > > Suvayu Ali 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 | >>> |--------------+--------------+------------+-------------+------------+= -------------| >>> | =A0 =A0 =A0 =A0 =A0 60 | =A0 =A01.1140741 | =A0 =A0 =A0 0020 | =A0 = =A0 =A0 =A00100 | =A01.1699508 | =A0 1.0680423 | >>> | =A0 =A0 =A0 =A0 =A0150 | =A0 =A01.1187818 | =A0 =A0 =A0 0100 | =A0 = =A0 =A0 =A00200 | =A01.1593492 | =A0 1.0855438 | >>> | =A0 =A0 =A0 =A0 =A0350 | =A0 =A01.1193459 | =A0 =A0 =A0 0200 | =A0 = =A0 =A0 =A00500 | =A01.1331885 | =A0 1.1086636 | >>> | =A0 =A0 =A0 =A0 =A0600 | =A0 =A01.1029173 | =A0 =A0 =A0 0500 | =A0 = =A0 =A0 =A00700 | =A01.0940769 | =A0 1.1121185 | >>> | =A0 =A0 =A0 =A0 =A0850 | =A0 =A01.0841388 | =A0 =A0 =A0 0700 | =A0 = =A0 =A0 =A01000 | =A01.0676310 | =A0 1.1000886 | >>> | =A0 =A0 =A0 =A0 1250 | =A0 =A01.0358938 | =A0 =A0 =A0 1000 | =A0 =A0 = =A0 =A01500 | =A01.0127586 | =A0 1.0586916 | >>> | =A0 =A0 =A0 =A0 2000 | =A0 0.89370079 | =A0 =A0 =A0 1500 | =A0 =A0 = =A0 =A02500 | 0.88014981 | =A0 =A0 =A0 0.925 | >> >> This gives me an error like this, >> >>> gnuplot> plot '/tmp/org-plot30213YHV' using 1:2 with xyerrorlines title= 'Ordinate (Y)' >>> =A0 =A0 =A0 =A0 =A0Not 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:xyerrorline= s >> >> 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 thi= s, >> >>> #+srcname: plot-data-w-err >>> #+begin_src gnuplot >>> =A0 set title 'My plot' >>> =A0 plot 'data-table' using 1:2:3:4:5:6 with xyerrorlines title 'Ordina= te (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 > --=20 Suvayu Open source is the future. It sets us free.