emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Plotting date on xaxis
@ 2010-02-22 18:31 Johan Ekh
  2010-02-23  9:52 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Johan Ekh @ 2010-02-22 18:31 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 644 bytes --]

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 <set:"xdata time">, the plot is
generated but without interpreting the dates as dates.

Can anyone see what I do wrong?

Thanks in advance,

Johan

[-- Attachment #1.2: Type: text/html, Size: 770 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-22 18:31 Plotting date on xaxis Johan Ekh
@ 2010-02-23  9:52 ` Eric S Fraga
  2010-02-23 14:47 ` Eric Schulte
  2010-05-15 13:47 ` Ivan Vilata i Balaguer
  2 siblings, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2010-02-23  9:52 UTC (permalink / raw)
  To: Johan Ekh; +Cc: emacs-orgmode

On Mon, 22 Feb 2010 19:31:41 +0100, Johan Ekh <ekh.johan@gmail.com> wrote:
> 
> [1.1  <text/plain; ISO-8859-1 (7bit)>]
> 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 <set:"xdata time">, the plot is
> generated but without interpreting the dates as dates.
> 
> Can anyone see what I do wrong?
> 
> Thanks in advance,
> 
> Johan
> [1.2  <text/html; ISO-8859-1 (quoted-printable)>]
> 

Johan,

I've played with this a bit and I also cannot get it to work.
However, looking at the gnuplot comint buffer created, there is an
error message that indicates that plotting xdata in time format
requires a using statement to specify directly the columns to plot.  I
have tried, therefore, the following specification on the plot line:

--8<---------------cut here---------------start------------->8---
#+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespoints set:"xdata time" set:"timefmt '%Y-%m-%d'" set:"yrange [90:]" ind:1 deps:(2)
|       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 |
--8<---------------cut here---------------end--------------->8---

I had to put quotes around the time format and also (just in case)
spelled out linespoints fully.  However, this still doesn't work
because org-plot/gnuplot generates the following plot command:

,----
| plot '/tmp/org-plot1831zcQ' using 2:xticlabel(1) with linespoints title 'Kg'
`----

Note the strange using parameters!  I am not sure where this is coming
from unfortunately.  Note that if I type this in directly in gnuplot,
with "using 1:2", everything works just fine.

eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-22 18:31 Plotting date on xaxis Johan Ekh
  2010-02-23  9:52 ` Eric S Fraga
@ 2010-02-23 14:47 ` Eric Schulte
  2010-02-23 16:27   ` Johan Ekh
  2010-02-23 22:52   ` Eric S Fraga
  2010-05-15 13:47 ` Ivan Vilata i Balaguer
  2 siblings, 2 replies; 13+ messages in thread
From: Eric Schulte @ 2010-02-23 14:47 UTC (permalink / raw)
  To: Johan Ekh; +Cc: emacs-orgmode

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 <ekh.johan@gmail.com> 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 <set:"xdata time">, 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-23 14:47 ` Eric Schulte
@ 2010-02-23 16:27   ` Johan Ekh
  2010-02-23 17:15     ` Dan Davison
  2010-02-23 22:52   ` Eric S Fraga
  1 sibling, 1 reply; 13+ messages in thread
From: Johan Ekh @ 2010-02-23 16:27 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2451 bytes --]

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 <schulte.eric@gmail.com>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 <ekh.johan@gmail.com> 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 <set:"xdata time">, 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
>

[-- Attachment #1.2: Type: text/html, Size: 3430 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-23 16:27   ` Johan Ekh
@ 2010-02-23 17:15     ` Dan Davison
  2010-02-23 17:33       ` Eric Schulte
  0 siblings, 1 reply; 13+ messages in thread
From: Dan Davison @ 2010-02-23 17:15 UTC (permalink / raw)
  To: Johan Ekh; +Cc: emacs-orgmode

Johan Ekh <ekh.johan@gmail.com> writes:

> 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?

Hi Johan,

I've never used matplotlib, but here's a start. Firstly, one thing I
notice is that org-babel-python currently doesn't like the column names
on the table (I'll add it to our TODO list). So if we make a table like
this, without the header:

#+results: my-table-nohdr
| 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 |

Then pass the data into python and have a look at what we've got:

#+begin_src python :var data=my-table-nohdr :results output
print str(data)
#+end_src

#+results:
: [['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]]

So if you know how to use matplotlib to create your plot using that list
of lists, then you should be set. To get output to file you will need to
use something like :file pyplot.png, *and* arrange that your code writes
the graphical output to pyplot.png. A link to pyplot.png will be
inserted in the org buffer.

Given my ignorance of gnuplot and matplotlib, I would use R. Unlike
python, but like gnuplot, the graphical output is automatically sent to
the specified file, without having to explicitly tell R to so so:

#+begin_src R :var d=my-table :file R-plot.png
  plot(as.Date(d$Date), d$Kg, ylab="Kg", type="b")
#+end_src

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

Dan

>
> Babel seems super cool!
>
> /Johan
>
> On Tue, Feb 23, 2010 at 3:47 PM, Eric Schulte <schulte.eric@gmail.com> 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 <ekh.johan@gmail.com> 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 <set:"xdata time">, 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
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-23 17:15     ` Dan Davison
@ 2010-02-23 17:33       ` Eric Schulte
  0 siblings, 0 replies; 13+ messages in thread
From: Eric Schulte @ 2010-02-23 17:33 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode

Dan Davison <davison@stats.ox.ac.uk> writes:

> Johan Ekh <ekh.johan@gmail.com> writes:
>
>> 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?
>
> Hi Johan,
>
> I've never used matplotlib, but here's a start. Firstly, one thing I
> notice is that org-babel-python currently doesn't like the column names
> on the table (I'll add it to our TODO list). So if we make a table like
> this, without the header:
>

One nice way to get around headers is through indexing into variable
references, so for example the following two are equivalent...

#+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 python :var data=my-table[2:-1] :results output
  print str(data)
#+end_src

#+results: my-table-nohdr
| 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 python :var data=my-table-nohdr :results output
  print str(data)
#+end_src

Best -- Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-23 14:47 ` Eric Schulte
  2010-02-23 16:27   ` Johan Ekh
@ 2010-02-23 22:52   ` Eric S Fraga
  2010-02-24  0:05     ` Eric Schulte
  1 sibling, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2010-02-23 22:52 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

On Tue, 23 Feb 2010 07:47:25 -0700, "Eric Schulte" <schulte.eric@gmail.com> 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.

Eric,

thanks for this suggestion as well as the one using org-babel (which I
would have typically used myself these days).  However, the point
still stands: why doesn't what Johan tried initially work?

I have narrowed down what causes the problem although I don't
understand why (I haven't had any time to look at the elisp code).
Basically, the problem with Johan's initial table was the extra empty
row at the end:

--8<---------------cut here---------------start------------->8---
#+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespoints set:"xdata time" set:"timefmt '%Y-%m-%d'" set:"yrange [90:]"
|       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-28 | 92.0 |
|            |      |
--8<---------------cut here---------------end--------------->8---

With the empty row there, the "using 1:2" option to the gnuplot plot
command is not generated correctly, instead generating "using
1:xticlable(1)" which gnuplot doesn't like!  If the last row is
deleted, everything works just fine (even if February doesn't have 29
days in 2010 ;-).

HTH,
eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-23 22:52   ` Eric S Fraga
@ 2010-02-24  0:05     ` Eric Schulte
  2010-02-24  8:07       ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Schulte @ 2010-02-24  0:05 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

[...]
>
> I have narrowed down what causes the problem although I don't
> understand why (I haven't had any time to look at the elisp code).
> Basically, the problem with Johan's initial table was the extra empty
> row at the end:
>

Ah,

Thanks for isolating the issue.

It looks like the empty last row is tricking org-plot.el into thinking
that the entire Date column contains text labels, so it tries to use the
values of that column to label the data with xticlabels [1].  This is
useful for histograms such as the "Citas" graph in [2].

So all in all I'd say this is fine behavior for something like org-plot
which tries to guess the user's intentions.

Best -- Eric

>
> #+PLOT: title:"Weight" ind:1 deps:(2) type:2d with:linespoints set:"xdata time" set:"timefmt '%Y-%m-%d'" set:"yrange [90:]"
> |       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-28 | 92.0 |
> |            |      |
>
> With the empty row there, the "using 1:2" option to the gnuplot plot
> command is not generated correctly, instead generating "using
> 1:xticlable(1)" which gnuplot doesn't like!  If the last row is
> deleted, everything works just fine (even if February doesn't have 29
> days in 2010 ;-).
>
> HTH,
> eric

Footnotes: 
[1]  http://www.gnuplot.info/docs/node135.html

[2]  http://orgmode.org/worg/org-tutorials/org-plot.php

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-24  0:05     ` Eric Schulte
@ 2010-02-24  8:07       ` Eric S Fraga
  2010-02-25 17:44         ` Eric Schulte
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2010-02-24  8:07 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

On Tue, 23 Feb 2010 17:05:45 -0700, "Eric Schulte" <schulte.eric@gmail.com> wrote:
> 
> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
> 
> [...]
> >
> > I have narrowed down what causes the problem although I don't
> > understand why (I haven't had any time to look at the elisp code).
> > Basically, the problem with Johan's initial table was the extra empty
> > row at the end:
> >
> 
> Ah,
> 
> Thanks for isolating the issue.
> 
> It looks like the empty last row is tricking org-plot.el into thinking
> that the entire Date column contains text labels, so it tries to use the
> values of that column to label the data with xticlabels [1].  This is
> useful for histograms such as the "Citas" graph in [2].
> 
> So all in all I'd say this is fine behavior for something like org-plot
> which tries to guess the user's intentions.

Well, good intentions is one thing, wrong behaviour is another?  If
the user has specified "ind:1 deps:(2)", even if org-plot identifies
column 1 as having labels for the tic marks, the generated parameter
to the plot command should be, at best:

  ... using 1:2:xticlabels(1) ...

which is actually nonsensical as well but not as bad as what is
currently generated:

  ... using 1:xticlabels(1)

which completely ignores the "deps:(2)" option!

In any case, I'm not suggesting in any way that this is a critical
bug!  Simply removing the empty line allows org-plot to work
perfectly.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-24  8:07       ` Eric S Fraga
@ 2010-02-25 17:44         ` Eric Schulte
  2010-02-25 20:11           ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Schulte @ 2010-02-25 17:44 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

> On Tue, 23 Feb 2010 17:05:45 -0700, "Eric Schulte" <schulte.eric@gmail.com> wrote:
>> 
>> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
>> 
>> [...]
>> >
>> > I have narrowed down what causes the problem although I don't
>> > understand why (I haven't had any time to look at the elisp code).
>> > Basically, the problem with Johan's initial table was the extra empty
>> > row at the end:
>> >
>> 
>> Ah,
>> 
>> Thanks for isolating the issue.
>> 
>> It looks like the empty last row is tricking org-plot.el into thinking
>> that the entire Date column contains text labels, so it tries to use the
>> values of that column to label the data with xticlabels [1].  This is
>> useful for histograms such as the "Citas" graph in [2].
>> 
>> So all in all I'd say this is fine behavior for something like org-plot
>> which tries to guess the user's intentions.
>
> Well, good intentions is one thing, wrong behaviour is another?  If
> the user has specified "ind:1 deps:(2)", even if org-plot identifies
> column 1 as having labels for the tic marks, the generated parameter
> to the plot command should be, at best:
>
>   ... using 1:2:xticlabels(1) ...
>

I just applied a patch which results in the above plotting command, and
yields the following gnuplot error when the table contains an empty line

 "illegal day of month"

which to me seems entirely appropriate.

All of the plots form the org-plot page on worg still work with this
patch (which amounts to org-plot's test suite), so I relatively
confident that it shouldn't break any existing functionality.

One problem with org-plot's attempt to guess the best action in each
situation is that the code will get increasingly ugly as these corner
cases continue to arise, and as that happens it becomes increasingly
difficult to know a-priori if a patch will cause unforeseen problems.

Best -- Eric

>
> which is actually nonsensical as well but not as bad as what is
> currently generated:
>
>   ... using 1:xticlabels(1)
>
> which completely ignores the "deps:(2)" option!
>
> In any case, I'm not suggesting in any way that this is a critical
> bug!  Simply removing the empty line allows org-plot to work
> perfectly.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-25 17:44         ` Eric Schulte
@ 2010-02-25 20:11           ` Eric S Fraga
  2010-02-26 15:09             ` Johan Ekh
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2010-02-25 20:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

On Thu, 25 Feb 2010 10:44:33 -0700, "Eric Schulte" <schulte.eric@gmail.com> wrote:
> 
> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
> 

[...]

> > Well, good intentions is one thing, wrong behaviour is another?  If
> > the user has specified "ind:1 deps:(2)", even if org-plot identifies
> > column 1 as having labels for the tic marks, the generated parameter
> > to the plot command should be, at best:
> >
> >   ... using 1:2:xticlabels(1) ...
> >
> 
> I just applied a patch which results in the above plotting command, and
> yields the following gnuplot error when the table contains an empty line
> 
>  "illegal day of month"
> 
> which to me seems entirely appropriate.

It does indeed seem perfectly appropriate!  Thanks.

> All of the plots form the org-plot page on worg still work with this
> patch (which amounts to org-plot's test suite), so I relatively
> confident that it shouldn't break any existing functionality.
> 
> One problem with org-plot's attempt to guess the best action in each
> situation is that the code will get increasingly ugly as these corner
> cases continue to arise, and as that happens it becomes increasingly
> difficult to know a-priori if a patch will cause unforeseen problems.

Yes, I can imagine.  I guess, for Johan's benefit, that it's best to
move on to org-babel for the more complex problems leaving the direct
gnuplot support for "simple" cases!

Thanks again,
eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-25 20:11           ` Eric S Fraga
@ 2010-02-26 15:09             ` Johan Ekh
  0 siblings, 0 replies; 13+ messages in thread
From: Johan Ekh @ 2010-02-26 15:09 UTC (permalink / raw)
  To: emacs-orgmode

Thanks guys,
I really like the org-mode community. I allways get good help with my
newbie questions!

On Thursday, February 25, 2010, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
> On Thu, 25 Feb 2010 10:44:33 -0700, "Eric Schulte" <schulte.eric@gmail.com> wrote:
>>
>> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
>>
>
> [...]
>
>> > Well, good intentions is one thing, wrong behaviour is another?  If
>> > the user has specified "ind:1 deps:(2)", even if org-plot identifies
>> > column 1 as having labels for the tic marks, the generated parameter
>> > to the plot command should be, at best:
>> >
>> >   ... using 1:2:xticlabels(1) ...
>> >
>>
>> I just applied a patch which results in the above plotting command, and
>> yields the following gnuplot error when the table contains an empty line
>>
>>  "illegal day of month"
>>
>> which to me seems entirely appropriate.
>
> It does indeed seem perfectly appropriate!  Thanks.
>
>> All of the plots form the org-plot page on worg still work with this
>> patch (which amounts to org-plot's test suite), so I relatively
>> confident that it shouldn't break any existing functionality.
>>
>> One problem with org-plot's attempt to guess the best action in each
>> situation is that the code will get increasingly ugly as these corner
>> cases continue to arise, and as that happens it becomes increasingly
>> difficult to know a-priori if a patch will cause unforeseen problems.
>
> Yes, I can imagine.  I guess, for Johan's benefit, that it's best to
> move on to org-babel for the more complex problems leaving the direct
> gnuplot support for "simple" cases!
>
> Thanks again,
> eric
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Plotting date on xaxis
  2010-02-22 18:31 Plotting date on xaxis Johan Ekh
  2010-02-23  9:52 ` Eric S Fraga
  2010-02-23 14:47 ` Eric Schulte
@ 2010-05-15 13:47 ` Ivan Vilata i Balaguer
  2 siblings, 0 replies; 13+ messages in thread
From: Ivan Vilata i Balaguer @ 2010-05-15 13:47 UTC (permalink / raw)
  To: emacs-orgmode

Johan Ekh (2010-02-22 19:31:41 +0100) wrote:

> 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 <set:"xdata time">, the plot is
> generated but without interpreting the dates as dates.
>
> Can anyone see what I do wrong?

Today I faced the same problem and I fixed it by replacing
``timefmt:%Y-%m-%d`` with ``set:"timefmt '%Y-%m-%d'".

HTH,

-- 
Ivan Vilata i Balaguer -- http://ivan.lovesgazpacho.net/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-05-15 16:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 18:31 Plotting date on xaxis Johan Ekh
2010-02-23  9:52 ` Eric S Fraga
2010-02-23 14:47 ` Eric Schulte
2010-02-23 16:27   ` Johan Ekh
2010-02-23 17:15     ` Dan Davison
2010-02-23 17:33       ` Eric Schulte
2010-02-23 22:52   ` Eric S Fraga
2010-02-24  0:05     ` Eric Schulte
2010-02-24  8:07       ` Eric S Fraga
2010-02-25 17:44         ` Eric Schulte
2010-02-25 20:11           ` Eric S Fraga
2010-02-26 15:09             ` Johan Ekh
2010-05-15 13:47 ` Ivan Vilata i Balaguer

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).