emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel python/shell or gantt charts with gnuplot from within org-mode
@ 2010-04-13 18:02 Erik Butz
  2010-04-13 18:51 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Butz @ 2010-04-13 18:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I have been playing around with org-mode and have been thinking about
the possibility to create gantt charts with org-mode. I did not find
anything in the archives, and todays thread about taskjuggler brought
me back to the subject.

This is a python script hovering around the web (gantt.py) which
enables gant charts with gnuplot. I played around with this a bit so
as to have it accept ISO timestamps (%Y-%m-%dT%H:%M:%S) and or
durations. Now I am looking for a way to execute this from within
org-mode probably using org-babel

The (bash) syntax would be something like

python gantt.py -t "Title" -i input.txt | gnuplot -persist

I would like to pass an org table to the script instead of the input
file so the equivalent of doing

cat input | python gantt.py -t "Title" | gnuplot -persist

The input structure is (e.g.)

Task 1	2010-4-2T12:00:00	1	validate
Task 2	2010-4-5T12:00:00	5.25	  something
Task 3	2010-4-5T12:00:00	2010-4-10T0:00:00	otherthing
Task 4	5.5			yet another thing
which could well be the column mode representation of a file probably.

I am sorry should this be a bit vague.

Please let me know if I can provide any more information to clarify the problem

Cheers and thanks,

Erik

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

* Re: org-babel python/shell or gantt charts with gnuplot from within org-mode
  2010-04-13 18:02 org-babel python/shell or gantt charts with gnuplot from within org-mode Erik Butz
@ 2010-04-13 18:51 ` Eric Schulte
  2010-04-13 23:42   ` Erik Butz
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2010-04-13 18:51 UTC (permalink / raw)
  To: Erik Butz; +Cc: emacs-orgmode

Erik Butz <erik.butz@googlemail.com> writes:

> Hi all,
>
> I have been playing around with org-mode and have been thinking about
> the possibility to create gantt charts with org-mode. I did not find
> anything in the archives, and todays thread about taskjuggler brought
> me back to the subject.
>
> This is a python script hovering around the web (gantt.py) which
> enables gant charts with gnuplot. I played around with this a bit so
> as to have it accept ISO timestamps (%Y-%m-%dT%H:%M:%S) and or
> durations. Now I am looking for a way to execute this from within
> org-mode probably using org-babel
>
> The (bash) syntax would be something like
>
> python gantt.py -t "Title" -i input.txt | gnuplot -persist
>
> I would like to pass an org table to the script instead of the input
> file so the equivalent of doing
>
> cat input | python gantt.py -t "Title" | gnuplot -persist
>
> The input structure is (e.g.)
>
> Task 1	2010-4-2T12:00:00	1	validate
> Task 2	2010-4-5T12:00:00	5.25	  something
> Task 3	2010-4-5T12:00:00	2010-4-10T0:00:00	otherthing
> Task 4	5.5			yet another thing
> which could well be the column mode representation of a file probably.
>

something like the following in will allow you to pass a table to a
series of shell commands

  #+tblname: tasks
  | Task 1 | 2010-4-2T12:00:00 |                 1 | validate   |
  | Task 2 | 2010-4-5T12:00:00 |              5.25 | something  |
  | Task 3 | 2010-4-5T12:00:00 | 2010-4-10T0:00:00 | otherthing |

  #+begin_src sh :var tasks=tasks
    echo "$tasks" |wc
  #+end_src

  #+results:
  : 3      15     130

you can also use a gnuplot block to accept the output of gantt.py, and
once everything is working it can be packaged up into a library of babel
[1] function which could then be called with a short line like.

#+call: gantt(tasks=my-task-table)

Hope that helps, let me know if you have any more questions. -- Eric

>
> I am sorry should this be a bit vague.
>
> Please let me know if I can provide any more information to clarify the problem
>
> Cheers and thanks,
>
> Erik
>
>
> _______________________________________________
> 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

Footnotes: 
[1]  http://orgmode.org/worg/org-contrib/babel/library-of-babel.php

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

* Re: org-babel python/shell or gantt charts with gnuplot from within org-mode
  2010-04-13 18:51 ` Eric Schulte
@ 2010-04-13 23:42   ` Erik Butz
  2010-04-14  0:24     ` Dan Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Butz @ 2010-04-13 23:42 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Hi Eric,

thanks for this information, this already brings me one step further.

There is now another issue which I run into, trying to get this to
work: python lists seem to be a potential problem. In the code there
are several lists which are constructed by a

    # Generate gnuplot lines
    plot_lines = ['plot ' +
                  ', \\\n\t'.join((' '.join(['-1',
                                       'title "%s"' % t,
                                       'with lines',
                                       'linecolor %s %s ' %
(colorprefix, colors[t]),
                                       'linewidth 6'])
                            for t in tasks))]

which cause the program to fail and not to produce any output when accessed.

I can create lists with append('a') however and use them mostly w/o problems.

Is there any know limitation somewhere in org-babel or am I running
into some other problem here?
(in principle this should just be run like in any normal shell, right?)

Again any hints appreciated

Erik

P.S. let me stress that the code works w/o problems from a normal
shell, since otherwise this sounds more like a python question


On Tue, Apr 13, 2010 at 8:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> Erik Butz <erik.butz@googlemail.com> writes:
>
>> Hi all,
>>
>> I have been playing around with org-mode and have been thinking about
>> the possibility to create gantt charts with org-mode. I did not find
>> anything in the archives, and todays thread about taskjuggler brought
>> me back to the subject.
>>
>> This is a python script hovering around the web (gantt.py) which
>> enables gant charts with gnuplot. I played around with this a bit so
>> as to have it accept ISO timestamps (%Y-%m-%dT%H:%M:%S) and or
>> durations. Now I am looking for a way to execute this from within
>> org-mode probably using org-babel
>>
>> The (bash) syntax would be something like
>>
>> python gantt.py -t "Title" -i input.txt | gnuplot -persist
>>
>> I would like to pass an org table to the script instead of the input
>> file so the equivalent of doing
>>
>> cat input | python gantt.py -t "Title" | gnuplot -persist
>>
>> The input structure is (e.g.)
>>
>> Task 1        2010-4-2T12:00:00       1       validate
>> Task 2        2010-4-5T12:00:00       5.25      something
>> Task 3        2010-4-5T12:00:00       2010-4-10T0:00:00       otherthing
>> Task 4        5.5                     yet another thing
>> which could well be the column mode representation of a file probably.
>>
>
> something like the following in will allow you to pass a table to a
> series of shell commands
>
>  #+tblname: tasks
>  | Task 1 | 2010-4-2T12:00:00 |                 1 | validate   |
>  | Task 2 | 2010-4-5T12:00:00 |              5.25 | something  |
>  | Task 3 | 2010-4-5T12:00:00 | 2010-4-10T0:00:00 | otherthing |
>
>  #+begin_src sh :var tasks=tasks
>    echo "$tasks" |wc
>  #+end_src
>
>  #+results:
>  : 3      15     130
>
> you can also use a gnuplot block to accept the output of gantt.py, and
> once everything is working it can be packaged up into a library of babel
> [1] function which could then be called with a short line like.
>
> #+call: gantt(tasks=my-task-table)
>
> Hope that helps, let me know if you have any more questions. -- Eric
>
>>
>> I am sorry should this be a bit vague.
>>
>> Please let me know if I can provide any more information to clarify the problem
>>
>> Cheers and thanks,
>>
>> Erik
>>
>>
>> _______________________________________________
>> 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
>
> Footnotes:
> [1]  http://orgmode.org/worg/org-contrib/babel/library-of-babel.php
>
>

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

* Re: org-babel python/shell or gantt charts with gnuplot from within org-mode
  2010-04-13 23:42   ` Erik Butz
@ 2010-04-14  0:24     ` Dan Davison
  2010-04-14  8:02       ` Detlef Steuer
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Davison @ 2010-04-14  0:24 UTC (permalink / raw)
  To: Erik Butz; +Cc: emacs-orgmode

Erik Butz <erik.butz@googlemail.com> writes:

> Hi Eric,
>
> thanks for this information, this already brings me one step further.
>
> There is now another issue which I run into, trying to get this to
> work: python lists seem to be a potential problem. In the code there
> are several lists which are constructed by a
>
>     # Generate gnuplot lines
>     plot_lines = ['plot ' +
>                   ', \\\n\t'.join((' '.join(['-1',
>                                        'title "%s"' % t,
>                                        'with lines',
>                                        'linecolor %s %s ' %
> (colorprefix, colors[t]),
>                                        'linewidth 6'])
>                             for t in tasks))]
>
> which cause the program to fail and not to produce any output when accessed.
>
> I can create lists with append('a') however and use them mostly w/o problems.
>
> Is there any know limitation somewhere in org-babel or am I running
> into some other problem here?
> (in principle this should just be run like in any normal shell, right?)

Hi Erik,

So have I understood this right that you're following Eric's model and
passing an org table into a shell block whch calls python?
I.e. something like

#+begin_src sh :var tasks=tasks
  echo "$tasks" | python gantt.py
#+end_src

In that case it should be exactly the same as running the python code in
a shell outside emacs. To debug this, how about capturing the data
that's going into python with

#+begin_src sh :var tasks=tasks
  echo "$tasks" > input-data-for-python
#+end_src

and then outside emacs doing the equivalent of

python gantt.py < input-data-for-python

Does that reveal the same problem?

Dan

>
> Again any hints appreciated
>
> Erik
>
> P.S. let me stress that the code works w/o problems from a normal
> shell, since otherwise this sounds more like a python question
>
>
> On Tue, Apr 13, 2010 at 8:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> Erik Butz <erik.butz@googlemail.com> writes:
>>
>>> Hi all,
>>>
>>> I have been playing around with org-mode and have been thinking about
>>> the possibility to create gantt charts with org-mode. I did not find
>>> anything in the archives, and todays thread about taskjuggler brought
>>> me back to the subject.
>>>
>>> This is a python script hovering around the web (gantt.py) which
>>> enables gant charts with gnuplot. I played around with this a bit so
>>> as to have it accept ISO timestamps (%Y-%m-%dT%H:%M:%S) and or
>>> durations. Now I am looking for a way to execute this from within
>>> org-mode probably using org-babel
>>>
>>> The (bash) syntax would be something like
>>>
>>> python gantt.py -t "Title" -i input.txt | gnuplot -persist
>>>
>>> I would like to pass an org table to the script instead of the input
>>> file so the equivalent of doing
>>>
>>> cat input | python gantt.py -t "Title" | gnuplot -persist
>>>
>>> The input structure is (e.g.)
>>>
>>> Task 1        2010-4-2T12:00:00       1       validate
>>> Task 2        2010-4-5T12:00:00       5.25      something
>>> Task 3        2010-4-5T12:00:00       2010-4-10T0:00:00       otherthing
>>> Task 4        5.5                     yet another thing
>>> which could well be the column mode representation of a file probably.
>>>
>>
>> something like the following in will allow you to pass a table to a
>> series of shell commands
>>
>>  #+tblname: tasks
>>  | Task 1 | 2010-4-2T12:00:00 |                 1 | validate   |
>>  | Task 2 | 2010-4-5T12:00:00 |              5.25 | something  |
>>  | Task 3 | 2010-4-5T12:00:00 | 2010-4-10T0:00:00 | otherthing |
>>
>>  #+begin_src sh :var tasks=tasks
>>    echo "$tasks" |wc
>>  #+end_src
>>
>>  #+results:
>>  : 3      15     130
>>
>> you can also use a gnuplot block to accept the output of gantt.py, and
>> once everything is working it can be packaged up into a library of babel
>> [1] function which could then be called with a short line like.
>>
>> #+call: gantt(tasks=my-task-table)
>>
>> Hope that helps, let me know if you have any more questions. -- Eric
>>
>>>
>>> I am sorry should this be a bit vague.
>>>
>>> Please let me know if I can provide any more information to clarify the problem
>>>
>>> Cheers and thanks,
>>>
>>> Erik
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>> Footnotes:
>> [1]  http://orgmode.org/worg/org-contrib/babel/library-of-babel.php
>>
>>
>
>
> _______________________________________________
> 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] 5+ messages in thread

* Re: org-babel python/shell or gantt charts with gnuplot from within org-mode
  2010-04-14  0:24     ` Dan Davison
@ 2010-04-14  8:02       ` Detlef Steuer
  0 siblings, 0 replies; 5+ messages in thread
From: Detlef Steuer @ 2010-04-14  8:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

May be it's of interest. There's an R package 'plotrix' which seems
to be able to create gantt charts. 
Example picture:
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=74

Disclaimer: I don't know anything about gantt charts or that particular package.

Hth
Detlef


On Tue, 13 Apr 2010 20:24:11 -0400
Dan Davison <davison@stats.ox.ac.uk> wrote:

> Erik Butz <erik.butz@googlemail.com> writes:
> 
> > Hi Eric,
> >
> > thanks for this information, this already brings me one step further.
> >
> > There is now another issue which I run into, trying to get this to
> > work: python lists seem to be a potential problem. In the code there
> > are several lists which are constructed by a
> >
> >     # Generate gnuplot lines
> >     plot_lines = ['plot ' +
> >                   ', \\\n\t'.join((' '.join(['-1',
> >                                        'title "%s"' % t,
> >                                        'with lines',
> >                                        'linecolor %s %s ' %
> > (colorprefix, colors[t]),
> >                                        'linewidth 6'])
> >                             for t in tasks))]
> >
> > which cause the program to fail and not to produce any output when accessed.
> >
> > I can create lists with append('a') however and use them mostly w/o problems.
> >
> > Is there any know limitation somewhere in org-babel or am I running
> > into some other problem here?
> > (in principle this should just be run like in any normal shell, right?)
> 
> Hi Erik,
> 
> So have I understood this right that you're following Eric's model and
> passing an org table into a shell block whch calls python?
> I.e. something like
> 
> #+begin_src sh :var tasks=tasks
>   echo "$tasks" | python gantt.py
> #+end_src
> 
> In that case it should be exactly the same as running the python code in
> a shell outside emacs. To debug this, how about capturing the data
> that's going into python with
> 
> #+begin_src sh :var tasks=tasks
>   echo "$tasks" > input-data-for-python
> #+end_src
> 
> and then outside emacs doing the equivalent of
> 
> python gantt.py < input-data-for-python
> 
> Does that reveal the same problem?
> 
> Dan
> 
> >
> > Again any hints appreciated
> >
> > Erik
> >
> > P.S. let me stress that the code works w/o problems from a normal
> > shell, since otherwise this sounds more like a python question
> >
> >
> > On Tue, Apr 13, 2010 at 8:51 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> >> Erik Butz <erik.butz@googlemail.com> writes:
> >>
> >>> Hi all,
> >>>
> >>> I have been playing around with org-mode and have been thinking about
> >>> the possibility to create gantt charts with org-mode. I did not find
> >>> anything in the archives, and todays thread about taskjuggler brought
> >>> me back to the subject.
> >>>
> >>> This is a python script hovering around the web (gantt.py) which
> >>> enables gant charts with gnuplot. I played around with this a bit so
> >>> as to have it accept ISO timestamps (%Y-%m-%dT%H:%M:%S) and or
> >>> durations. Now I am looking for a way to execute this from within
> >>> org-mode probably using org-babel
> >>>
> >>> The (bash) syntax would be something like
> >>>
> >>> python gantt.py -t "Title" -i input.txt | gnuplot -persist
> >>>
> >>> I would like to pass an org table to the script instead of the input
> >>> file so the equivalent of doing
> >>>
> >>> cat input | python gantt.py -t "Title" | gnuplot -persist
> >>>
> >>> The input structure is (e.g.)
> >>>
> >>> Task 1        2010-4-2T12:00:00       1       validate
> >>> Task 2        2010-4-5T12:00:00       5.25      something
> >>> Task 3        2010-4-5T12:00:00       2010-4-10T0:00:00       otherthing
> >>> Task 4        5.5                     yet another thing
> >>> which could well be the column mode representation of a file probably.
> >>>
> >>
> >> something like the following in will allow you to pass a table to a
> >> series of shell commands
> >>
> >>  #+tblname: tasks
> >>  | Task 1 | 2010-4-2T12:00:00 |                 1 | validate   |
> >>  | Task 2 | 2010-4-5T12:00:00 |              5.25 | something  |
> >>  | Task 3 | 2010-4-5T12:00:00 | 2010-4-10T0:00:00 | otherthing |
> >>
> >>  #+begin_src sh :var tasks=tasks
> >>    echo "$tasks" |wc
> >>  #+end_src
> >>
> >>  #+results:
> >>  : 3      15     130
> >>
> >> you can also use a gnuplot block to accept the output of gantt.py, and
> >> once everything is working it can be packaged up into a library of babel
> >> [1] function which could then be called with a short line like.
> >>
> >> #+call: gantt(tasks=my-task-table)
> >>
> >> Hope that helps, let me know if you have any more questions. -- Eric
> >>
> >>>
> >>> I am sorry should this be a bit vague.
> >>>
> >>> Please let me know if I can provide any more information to clarify the problem
> >>>
> >>> Cheers and thanks,
> >>>
> >>> Erik
> >>>
> >>>
> >>> _______________________________________________
> >>> 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
> >>
> >> Footnotes:
> >> [1]  http://orgmode.org/worg/org-contrib/babel/library-of-babel.php
> >>
> >>
> >
> >
> > _______________________________________________
> > 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] 5+ messages in thread

end of thread, other threads:[~2010-04-14  7:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-13 18:02 org-babel python/shell or gantt charts with gnuplot from within org-mode Erik Butz
2010-04-13 18:51 ` Eric Schulte
2010-04-13 23:42   ` Erik Butz
2010-04-14  0:24     ` Dan Davison
2010-04-14  8:02       ` Detlef Steuer

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