emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Ignore some lines when using org-plot/gnuplot
@ 2009-11-05  4:56 Darlan Cavalcante Moreira
  2009-11-15  3:34 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-11-05  4:56 UTC (permalink / raw)
  To: org-mode Mailinglist


Hi everybody,

Is there a way to ignore some lines when using org-plot/gnuplot to plot a table
in Org? I have a table with some expenses, but the last two lines are the total
calculated from the previous lines. I'd like to plot only the expenses and
ignore the last two lines.

In the docs there is the option "deps" to specify which columns should be
plotted but I can't find an equivalent for lines (there is a line option but I
understand that it is used to send some extra command to gnuplot).


- Darlan

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

* Re: Ignore some lines when using org-plot/gnuplot
  2009-11-05  4:56 Ignore some lines when using org-plot/gnuplot Darlan Cavalcante Moreira
@ 2009-11-15  3:34 ` Eric Schulte
  2009-11-16  1:54   ` Darlan Cavalcante Moreira
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2009-11-15  3:34 UTC (permalink / raw)
  To: Darlan Cavalcante Moreira; +Cc: org-mode Mailinglist

Darlan Cavalcante Moreira <darcamo@gmail.com> writes:

> Hi everybody,
>
> Is there a way to ignore some lines when using org-plot/gnuplot to plot a table
> in Org? I have a table with some expenses, but the last two lines are the total
> calculated from the previous lines. I'd like to plot only the expenses and
> ignore the last two lines.
>
> In the docs there is the option "deps" to specify which columns should be
> plotted but I can't find an equivalent for lines (there is a line option but I
> understand that it is used to send some extra command to gnuplot).
>

Hi Darlan,

Sorry about the extremely delayed reply.  I don't believe that what
you've described is possible in the current implementation of org-plot.
It is possible however using org-babel which supports gnuplot.
Org-babel now allows indexing into the values of variable assignments.

So for example a simple gnuplot example could graph the contents of a
table by assigning that table to a variable

#+tblname: squares
| 1 |  1 |
| 2 |  4 |
| 3 |  9 |
| 4 | 16 |
| 5 | 25 |
| 6 | 36 |

#+begin_src gnuplot :var data=squares :results silent
  plot data using 1:2 with lines
#+end_src

with this new change it is possible to assign only part of the table to
a variable as you've described above.  For example

#+tblname: squares-with-sum
|  1 |  1 |
|  2 |  4 |
|  3 |  9 |
|  4 | 16 |
|  5 | 25 |
|  6 | 36 |
|----+----|
| 21 | 91 |

#+begin_src gnuplot :var data=squares-with-sum[0:-3] :results silent
  plot data using 1:2 with lines
#+end_src

For more information on indexing see the documentation of the
`org-babel-ref-index-list' function.

Thanks for motivating this new feature -- Eric

>
>
> - Darlan
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 3+ messages in thread

* Re: Ignore some lines when using org-plot/gnuplot
  2009-11-15  3:34 ` Eric Schulte
@ 2009-11-16  1:54   ` Darlan Cavalcante Moreira
  0 siblings, 0 replies; 3+ messages in thread
From: Darlan Cavalcante Moreira @ 2009-11-16  1:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: org-mode Mailinglist


Don't worry about a late reply. Sometimes I need a lot of time just to read the
E-Mails here in the list (this is one of the most active lists I have ever seen
and a really good one to follow) and I wonder how you guys not only read it but
also fix bugs and implement new features.

Thanks for this Eric. It sure opens a lot of possibilities.

- Darlan

At Sat, 14 Nov 2009 20:34:55 -0700,
Eric Schulte wrote:
> 
> Darlan Cavalcante Moreira <darcamo@gmail.com> writes:
> 
> > Hi everybody,
> >
> > Is there a way to ignore some lines when using org-plot/gnuplot to plot a table
> > in Org? I have a table with some expenses, but the last two lines are the total
> > calculated from the previous lines. I'd like to plot only the expenses and
> > ignore the last two lines.
> >
> > In the docs there is the option "deps" to specify which columns should be
> > plotted but I can't find an equivalent for lines (there is a line option but I
> > understand that it is used to send some extra command to gnuplot).
> >
> 
> Hi Darlan,
> 
> Sorry about the extremely delayed reply.  I don't believe that what
> you've described is possible in the current implementation of org-plot.
> It is possible however using org-babel which supports gnuplot.
> Org-babel now allows indexing into the values of variable assignments.
> 
> So for example a simple gnuplot example could graph the contents of a
> table by assigning that table to a variable
> 
> #+tblname: squares
> | 1 |  1 |
> | 2 |  4 |
> | 3 |  9 |
> | 4 | 16 |
> | 5 | 25 |
> | 6 | 36 |
> 
> #+begin_src gnuplot :var data=squares :results silent
>   plot data using 1:2 with lines
> #+end_src
> 
> with this new change it is possible to assign only part of the table to
> a variable as you've described above.  For example
> 
> #+tblname: squares-with-sum
> |  1 |  1 |
> |  2 |  4 |
> |  3 |  9 |
> |  4 | 16 |
> |  5 | 25 |
> |  6 | 36 |
> |----+----|
> | 21 | 91 |
> 
> #+begin_src gnuplot :var data=squares-with-sum[0:-3] :results silent
>   plot data using 1:2 with lines
> #+end_src
> 
> For more information on indexing see the documentation of the
> `org-babel-ref-index-list' function.
> 
> Thanks for motivating this new feature -- Eric
> 
> >
> >
> > - Darlan
> >
> >
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Remember: 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] 3+ messages in thread

end of thread, other threads:[~2009-11-16  1:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05  4:56 Ignore some lines when using org-plot/gnuplot Darlan Cavalcante Moreira
2009-11-15  3:34 ` Eric Schulte
2009-11-16  1:54   ` Darlan Cavalcante Moreira

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