From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johan Ekh Subject: Re: Plotting date on xaxis Date: Tue, 23 Feb 2010 17:27:13 +0100 Message-ID: <417457b51002230827w555d345dg98fbbea5c0091a36@mail.gmail.com> References: <417457b51002221031k48e2470aof86f6b6e71ea454b@mail.gmail.com> <87zl30c6zn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1379498100==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NjxbV-0007r6-9H for emacs-orgmode@gnu.org; Tue, 23 Feb 2010 11:27:21 -0500 Received: from [140.186.70.92] (port=38728 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjxbU-0007q9-2w for emacs-orgmode@gnu.org; Tue, 23 Feb 2010 11:27:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NjxbT-0001qs-9X for emacs-orgmode@gnu.org; Tue, 23 Feb 2010 11:27:20 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:34463) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NjxbS-0001qo-KR for emacs-orgmode@gnu.org; Tue, 23 Feb 2010 11:27:19 -0500 Received: by fxm22 with SMTP id 22so4016879fxm.26 for ; Tue, 23 Feb 2010 08:27:17 -0800 (PST) In-Reply-To: <87zl30c6zn.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: emacs-orgmode@gnu.org --===============1379498100== Content-Type: multipart/alternative; boundary=001485f91450cad368048047059f --001485f91450cad368048047059f Content-Type: text/plain; charset=ISO-8859-1 Thanks guys, the babel version worked perfect so I didn't try the other one thanks! Would it be possible to use python and matplotlib with babel instead of gnuplot? If so, could you just indicate how such a src code block would look like? Babel seems super cool! /Johan On Tue, Feb 23, 2010 at 3:47 PM, Eric Schulte wrote: > Hi Johan, > > You could try plotting your table using standard org-mode date formats > which org-plot will understand without any need to specify a timefmt > string. > > #+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespo set:"xdata time" > set:"yrange [90:]" > | Date | Kg | > |------------------+------| > | <2010-02-21 Sun> | 95.0 | > | <2010-02-22 Mon> | 93.0 | > | <2010-02-23 Tue> | 92.0 | > | <2010-02-24 Wed> | 91.5 | > | <2010-02-25 Thu> | 91.0 | > | <2010-02-26 Fri> | 92.0 | > > Alternatively if you want more control over your plots and more direct > access to gnuplot you can use org-babel to pass your table directly to > gnuplot as follows. > > #+results: my-table > | Date | Kg | > |------------+------| > | 2010-02-21 | 95.0 | > | 2010-02-22 | 93.0 | > | 2010-02-23 | 92.0 | > | 2010-02-24 | 91.5 | > | 2010-02-25 | 91.0 | > | 2010-02-26 | 92.0 | > > #+begin_src gnuplot :var data=my-table > set xdata time > set timefmt '%Y-%m-%d' > set yrange [90:] > plot data using 1:2 with linespoints title 'Kg' > #+end_src > > Best -- Eric > > Johan Ekh writes: > > > Hi all, > > I try to plot a table looking like this > > > > | Date | Kg | > > |-----------------+--------| > > | 2010-02-21 | 95.0 | > > | 2010-02-22 | 93.0 | > > | 2010-02-23 | 92.0 | > > | 2010-02-24 | 91.5 | > > | 2010-02-25 | 91.0 | > > | 2010-02-29 | 92.0 | > > | | | > > > > with the dates on the xaxis using > > > > #+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespo set:"xdata > time" timefmt:%Y-%m-%d > > set:"yrange [90:]" > > > > but no plot is generated. If I remove , the plot is > generated but without > > interpreting the dates as dates. > > > > Can anyone see what I do wrong? > > > > Thanks in advance, > > > > Johan > > > > _______________________________________________ > > Emacs-orgmode mailing list > > Please use `Reply All' to send replies to the list. > > Emacs-orgmode@gnu.org > > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > --001485f91450cad368048047059f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks guys,
the babel version worked perfect so I didn't try the ot= her one thanks!
Would it be possible to use python and matplotlib with b= abel instead of gnuplot?
If so, could you just indicate how such a src c= ode block would look like?

Babel seems super cool!

/Johan

On Tue, Feb 23, 2010 at 3:47 PM, Eric Schulte <schulte.eric@gmail.com> w= rote:
Hi Johan,

You could try plotting your table using standard org-mode date formats
which org-plot will understand without any need to specify a timefmt
string.

#+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespo set:&q= uot;xdata time" set:"yrange [90:]"
| Date =A0 =A0 =A0 =A0 =A0 =A0 | =A0 Kg |
|------------------+------|
| <2010-02-21 Sun> | 95.0 |
| <2010-02-22 Mon> | 93.0 |
| <2010-02-23 Tue> | 92.0 |
| <2010-02-24 Wed> | 91.5 |
| <2010-02-25 Thu> | 91.0 |
| <2010-02-26 Fri> | 92.0 |

Alternatively if you want more control over your plots and more direct
access to gnuplot you can use org-babel to pass your table directly to
gnuplot as follows.

#+results: my-table
| =A0 =A0 =A0 Date | =A0 Kg |
|------------+------|
| 2010-02-21 | 95.0 |
| 2010-02-22 | 93.0 |
| 2010-02-23 | 92.0 |
| 2010-02-24 | 91.5 |
| 2010-02-25 | 91.0 |
| 2010-02-26 | 92.0 |

#+begin_src gnuplot :var data=3Dmy-table
=A0set xdata time
=A0set timefmt '%Y-%m-%d'
=A0set yrange [90:]
=A0plot data using 1:2 with linespoints title 'Kg'
#+end_src

Best -- Eric
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
>
Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

--001485f91450cad368048047059f-- --===============1379498100== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1379498100==--