emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-plot questions
@ 2008-10-22 14:27 JBash
  2008-10-22 15:35 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: JBash @ 2008-10-22 14:27 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi,

First of all, thanks to all for the work on org-mode and org-plot.

A question about org-plot...

Question 1:
When I include an index column in the first column of the table,  I am
getting evenly spaced data points, with the xtic labels being coming from
the 'ind:' column (2, in the first data set here).

The behavior I expected was to use the second column (Frequency) as the
independent variable, and to get a plot with 3 groups of 3 points, near
frequencies of 1, 10, and 20. as I get with the 'Data Set B' group.

Is this expected and correct?

I know that this will also include the first column in the plot, which leads
to my next question.

Question 2:
When I try to use the deps option, I either get an error or an undesired
result.  For example, if I include a "deps:3,4", I get a "Wrong type
argument" error.  If I enclose the 3,4 in single quotes (eg. deps:'3,4'), I
get only the third column plotted, and not both third and fourth as I
expected.  What am I doing wrong?
A comment - enclosing the argument for deps in single quotes, if that is the
intention, seems inconsistent with the arguments for other options of that
type (ind, for example).

Question 3:
Is there a way to produce 2 different plots from the same table data?

Thanks again for the help.
Jerry

** Data Set A
#+PLOT: ind:2
| Index | Frequency |  Amplitude | Phase | Delta | Peak |
|     1 |       0.9 |          9 |     6 |     5 |  198 |
|     2 |       1.0 |         10 |     9 |     7 |  212 |
|     3 |       1.1 |         11 |     8 |     3 |  144 |
|     4 |       9.9 |         19 |    12 |     9 |  235 |
|     5 |      10.0 |         18 |     7 |    12 |  222 |
|     6 |      10.1 |         22 |    14 |     4 |  187 |
|     7 |      19.9 |         14 |    11 |     6 |  220 |
|     8 |      20.0 |         20 |    15 |    14 |  213 |
|     9 |      20.1 |         18 |    16 |    11 |  201 |

** Data Set B
#+PLOT: ind:1
| Frequency | Amplitude | Phase | Delta | Peak |
|-----------+-----------+-------+-------+------|
|       0.9 |         9 |     6 |     5 |  198 |
|       1.0 |        10 |     9 |     7 |  212 |
|       1.1 |        11 |     8 |     3 |  144 |
|       9.9 |        19 |    12 |     9 |  235 |
|      10.0 |        18 |     7 |    12 |  222 |
|      10.1 |        22 |    14 |     4 |  187 |
|      19.9 |        14 |    11 |     6 |  220 |
|      20.0 |        20 |    15 |    14 |  213 |
|      20.1 |        18 |    16 |    11 |  201 |

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

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

_______________________________________________
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] 5+ messages in thread

* Re: org-plot questions
  2008-10-22 14:27 org-plot questions JBash
@ 2008-10-22 15:35 ` Eric Schulte
  2008-10-22 17:39   ` JBash
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2008-10-22 15:35 UTC (permalink / raw)
  To: JBash; +Cc: emacs-orgmode

JBash <bashveank@gmail.com> writes:

> Hi,
>
> First of all, thanks to all for the work on org-mode and org-plot.
>
> A question about org-plot...
>
> Question 1:
> When I include an index column in the first column of the table,  I am getting evenly spaced data points,
> with the xtic labels being coming from the 'ind:' column (2, in the first data set here).
>
> The behavior I expected was to use the second column (Frequency) as the independent variable, and to get a
> plot with 3 groups of 3 points, near frequencies of 1, 10, and 20. as I get with the 'Data Set B' group.
>
> Is this expected and correct?
>

Hi Jerry,

Not exactly expected, but I believe it is the correct behavior for now.
Notice that you are missing an hline in your table after the headers.
Without an obvious division between the headers, and the table data
org-plot can not tell that the data is numeric, and should be
interpreted as such, so it applies the values of the index column as
xlabels to evenly spaced points (as if they were strings).  Try the
following table, and you should get a result more inline with
expectations.

#+PLOT: ind:2 with:points
| Index | Frequency | Amplitude | Phase | Delta | Peak |
|-------+-----------+-----------+-------+-------+------|
|     1 |       0.9 |         9 |     6 |     5 |  198 |
|     2 |       1.0 |        10 |     9 |     7 |  212 |
|     3 |       1.1 |        11 |     8 |     3 |  144 |
|     4 |       9.9 |        19 |    12 |     9 |  235 |
|     5 |      10.0 |        18 |     7 |    12 |  222 |
|     6 |      10.1 |        22 |    14 |     4 |  187 |
|     7 |      19.9 |        14 |    11 |     6 |  220 |
|     8 |      20.0 |        20 |    15 |    14 |  213 |
|     9 |      20.1 |        18 |    16 |    11 |  201 |

>
> I know that this will also include the first column in the plot, which leads to my next question.
>
> Question 2:
> When I try to use the deps option, I either get an error or an undesired result.  For example, if I include
> a "deps:3,4", I get a "Wrong type argument" error.  If I enclose the 3,4 in single quotes (eg. deps:'3,4'),
> I get only the third column plotted, and not both third and fourth as I expected.  What am I doing wrong?
> A comment - enclosing the argument for deps in single quotes, if that is the intention, seems inconsistent
> with the arguments for other options of that type (ind, for example).
>

Sorry, the documentation is wrong and it specifies that the dependent
columns should be specified as a comma separated list, when in actuality
they should be specified as a standard lisp list "inside parenthesis
separated by spaces".  Thanks for catching this, I will submit a patch
to the documentation.

#+PLOT: ind:1 deps:(3 4)
| Frequency | Amplitude | Phase | Delta | Peak |
|-----------+-----------+-------+-------+------|
|       0.9 |         9 |     6 |     5 |  198 |
|       1.0 |        10 |     9 |     7 |  212 |
|       1.1 |        11 |     8 |     3 |  144 |
|       9.9 |        19 |    12 |     9 |  235 |
|      10.0 |        18 |     7 |    12 |  222 |
|      10.1 |        22 |    14 |     4 |  187 |
|      19.9 |        14 |    11 |     6 |  220 |
|      20.0 |        20 |    15 |    14 |  213 |
|      20.1 |        18 |    16 |    11 |  201 |

>
> Question 3:
> Is there a way to produce 2 different plots from the same table data?
>

Currently no there is not.  In the current setup all of the plot lines
adjacent to a table are collected and used to generate a single plot for
the table.  I does seem like a good idea to allow multiple plots from a
single table.  Two ideas that come to mind are...

1) keep all of the plot lines adjacent with the table, but number them
   into any number of different plots.  For example the following would
   specify plots 1 and 2 for a table

#+PLOT1: title:"the first plot"
#+PLOT1: ind:1 with:points
#+PLOT2: title:"the second plot on the same table"
#+PLOT2: ind:2 deps:(3 4) with:lines
| Frequency | Amplitude | Phase | Delta | Peak |
|-----------+-----------+-------+-------+------|
|       0.9 |         9 |     6 |     5 |  198 |
|       1.0 |        10 |     9 |     7 |  212 |
|       1.1 |        11 |     8 |     3 |  144 |
|       9.9 |        19 |    12 |     9 |  235 |
|      10.0 |        18 |     7 |    12 |  222 |
|      10.1 |        22 |    14 |     4 |  187 |
|      19.9 |        14 |    11 |     6 |  220 |
|      20.0 |        20 |    15 |    14 |  213 |
|      20.1 |        18 |    16 |    11 |  201 |

2) the only other mechanism which occurs to me is to somehow label the
   table with a unique ID, and then allow the plot lines to be located
   anywhere in the org-mode file and include the table ID as a new
   argument to the PLOT lines.  This approach seems more flexible if
   more complicated.

Thanks for the bug reports and ideas -- Eric

>
> Thanks again for the help.
> Jerry
>
> ** Data Set A
> #+PLOT: ind:2
> | Index | Frequency |  Amplitude | Phase | Delta | Peak |
> |     1 |       0.9 |          9 |     6 |     5 |  198 |
> |     2 |       1.0 |         10 |     9 |     7 |  212 |
> |     3 |       1.1 |         11 |     8 |     3 |  144 |
> |     4 |       9.9 |         19 |    12 |     9 |  235 |
> |     5 |      10.0 |         18 |     7 |    12 |  222 |
> |     6 |      10.1 |         22 |    14 |     4 |  187 |
> |     7 |      19.9 |         14 |    11 |     6 |  220 |
> |     8 |      20.0 |         20 |    15 |    14 |  213 |
> |     9 |      20.1 |         18 |    16 |    11 |  201 |
>
> ** Data Set B
> #+PLOT: ind:1
> | Frequency | Amplitude | Phase | Delta | Peak |
> |-----------+-----------+-------+-------+------|
> |       0.9 |         9 |     6 |     5 |  198 |
> |       1.0 |        10 |     9 |     7 |  212 |
> |       1.1 |        11 |     8 |     3 |  144 |
> |       9.9 |        19 |    12 |     9 |  235 |
> |      10.0 |        18 |     7 |    12 |  222 |
> |      10.1 |        22 |    14 |     4 |  187 |
> |      19.9 |        14 |    11 |     6 |  220 |
> |      20.0 |        20 |    15 |    14 |  213 |
> |      20.1 |        18 |    16 |    11 |  201 |
>
> _______________________________________________
> 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] 5+ messages in thread

* Re: org-plot questions
  2008-10-22 15:35 ` Eric Schulte
@ 2008-10-22 17:39   ` JBash
  2008-10-22 22:43     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: JBash @ 2008-10-22 17:39 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


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

Thanks, Eric!

It's a great tool... I like how it, within org, makes it easy to keep the
data organized an yet easily accessible.

Another quick org-plot question...

I found that to turn on the grid, I use:
#+PLOT: set:grid

So, to set an axis label, I tried
#+PLOT: set:xlabel("Frequency")
and
#+PLOT: set:xlabel "Frequency"
and a few other things, but didn't hit on the right combination.  What's the
correct syntax?

--snip--

>
> Notice that you are missing an hline in your table after the headers.
>

Sorry, I should have seen that.

>
> > When I try to use the deps option, I either get an error or an undesired
> result.  For example, if I include
> > a "deps:3,4", I get a "Wrong type argument" error.  If I enclose the 3,4
> in single quotes (eg. deps:'3,4'),
>

>
> Currently no there is not.  In the current setup all of the plot lines
> adjacent to a table are collected and used to generate a single plot for
> the table.  I does seem like a good idea to allow multiple plots from a
> single table.  Two ideas that come to mind are...
>
> 1) keep all of the plot lines adjacent with the table, but number them
>   into any number of different plots.  For example the following would
>   specify plots 1 and 2 for a table
>
> #+PLOT1: title:"the first plot"
> #+PLOT1: ind:1 with:points
> #+PLOT2: title:"the second plot on the same table"
> #+PLOT2: ind:2 deps:(3 4) with:lines
> | Frequency | Amplitude | Phase | Delta | Peak |
> |-----------+-----------+-------+-------+------|
> |       0.9 |         9 |     6 |     5 |  198 |
> |       1.0 |        10 |     9 |     7 |  212 |
> |       1.1 |        11 |     8 |     3 |  144 |
> |       9.9 |        19 |    12 |     9 |  235 |
> |      10.0 |        18 |     7 |    12 |  222 |
> |      10.1 |        22 |    14 |     4 |  187 |
> |      19.9 |        14 |    11 |     6 |  220 |
> |      20.0 |        20 |    15 |    14 |  213 |
> |      20.1 |        18 |    16 |    11 |  201 |
>
> 2) the only other mechanism which occurs to me is to somehow label the
>   table with a unique ID, and then allow the plot lines to be located
>

This feature (multiple plots from a single table) would be a very nice
addition, with either approach.

>
>
> Thanks for the bug reports and ideas -- Eric
>

You're welcome, and thanks for your help.

Jerry

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

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

_______________________________________________
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] 5+ messages in thread

* Re: org-plot questions
  2008-10-22 17:39   ` JBash
@ 2008-10-22 22:43     ` Eric Schulte
  2008-10-23  1:14       ` Samuel Wales
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2008-10-22 22:43 UTC (permalink / raw)
  To: JBash; +Cc: emacs-orgmode

JBash <bashveank@gmail.com> writes:

> Thanks, Eric!
>
> It's a great tool... I like how it, within org, makes it easy to keep the data organized an yet easily
> accessible.
>

Thanks, I'm happy it's proving useful.

>
> Another quick org-plot question...
>
> I found that to turn on the grid, I use:
> #+PLOT: set:grid
>
> So, to set an axis label, I tried
> #+PLOT: set:xlabel("Frequency")
> and
> #+PLOT: set:xlabel "Frequency"
> and a few other things, but didn't hit on the right combination.  What's the correct syntax?
>

try 

#+PLOT: set:"xlabel 'Frequency'"

You need the double " quotes for any argument that contains spaces, and
gnuplot requires quotes (in this case using single ' quotes) around the
argument to xlabel.

I agree this isn't obvious, if you have a suggestion for improving the
syntax please let me know.

>     Currently no there is not.  In the current setup all of the plot lines
>     adjacent to a table are collected and used to generate a single plot for
>     the table.  I does seem like a good idea to allow multiple plots from a
>     single table.  Two ideas that come to mind are...
>    
>     1) keep all of the plot lines adjacent with the table, but number them
>       into any number of different plots.  For example the following would
>       specify plots 1 and 2 for a table
>    
>     #+PLOT1: title:"the first plot"
>     #+PLOT1: ind:1 with:points
>     #+PLOT2: title:"the second plot on the same table"
>     #+PLOT2: ind:2 deps:(3 4) with:lines
>     | Frequency | Amplitude | Phase | Delta | Peak |
>     |-----------+-----------+-------+-------+------|
>     |       0.9 |         9 |     6 |     5 |  198 |
>     |       1.0 |        10 |     9 |     7 |  212 |
>     |       1.1 |        11 |     8 |     3 |  144 |
>     |       9.9 |        19 |    12 |     9 |  235 |
>     |      10.0 |        18 |     7 |    12 |  222 |
>     |      10.1 |        22 |    14 |     4 |  187 |
>     |      19.9 |        14 |    11 |     6 |  220 |
>     |      20.0 |        20 |    15 |    14 |  213 |
>     |      20.1 |        18 |    16 |    11 |  201 |
>    
>     2) the only other mechanism which occurs to me is to somehow label the
>       table with a unique ID, and then allow the plot lines to be located
>
> This feature (multiple plots from a single table) would be a very nice
> addition, with either approach.

I agree, if I find time I will look at implementing it.

Thanks -- Eric

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

* Re: org-plot questions
  2008-10-22 22:43     ` Eric Schulte
@ 2008-10-23  1:14       ` Samuel Wales
  0 siblings, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2008-10-23  1:14 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

On Wed, Oct 22, 2008 at 15:43, Eric Schulte <schulte.eric@gmail.com> wrote:
> I agree this isn't obvious, if you have a suggestion for improving the
> syntax please let me know.

I haven't looked into this matter, so this comment might not be
relevant, but I do have a suggestion that I had earlier written for
the *general* problem of choosing a syntax for new functionality when
you don't have obvious models to follow.

Some of the desiderata for a syntax include: consistent, easy to
parse, hard to corrupt, simple to quote, simple to escape (especially
with things like regexps that are already complicated), supports being
confident that exporting will not exhibit unexpected behavior, easier
for the user to remember without reference materials, flexible,
extensible, supports macros, nestable, pretty-printable, a published
reference standard, and print-readable (serializing).  If your syntax
has those, then you're doing well.

If you don't have a model to follow (such as org or gnuplot), then
Lisp (el because this is el or cl because it's a standard that is
similar to el and meticulously speced) has usually had a lot of
thought put into its syntax.  You might get a joke or two, but we know
better.  :)

Again, perhaps not relevant, but maybe food for thought for future
questions about syntax.

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

end of thread, other threads:[~2008-10-23  1:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22 14:27 org-plot questions JBash
2008-10-22 15:35 ` Eric Schulte
2008-10-22 17:39   ` JBash
2008-10-22 22:43     ` Eric Schulte
2008-10-23  1:14       ` Samuel Wales

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