emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Generating boxplot (candlestick) diagrams (babel or org-plot)
@ 2012-01-08 15:44 Karl Voit
  2012-01-08 16:38 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Voit @ 2012-01-08 15:44 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I'm new to babel/gnuplot/org-plot and want to generate classic
Boxplot[1] diagrams.

My tests failed so far:

#+TBLNAME: mydata
#+PLOT: title:"Boxplots of mydata" with:candlesticks
| A | B |
|---+---|
| 5 | 5 |
| 5 | 6 |
| 4 | 5 |
| 5 | 6 |
| 2 | 4 |
| 2 | 5 |

... with «org-plot/gnuplot» results in:
#+begin_verse
gnuplot-mode 0.6.0 (gnuplot 4.4) -- report bugs with "C-c C-u"
Starting gnuplot plotting program...Done

#+end_verse

... with nothing else.


#+begin_src gnuplot  :var data=mydata :file output.png
set title "Plot Test"

plot data using 1:2 with candlestick
#+end_src

... results in empty output.png file.


What is the problem here? At least the second method should end up
in an error message or a file with content I guess.

  1. http://en.wikipedia.org/wiki/Boxplot
-- 
Karl Voit

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

* Re: Generating boxplot (candlestick) diagrams (babel or org-plot)
  2012-01-08 15:44 Generating boxplot (candlestick) diagrams (babel or org-plot) Karl Voit
@ 2012-01-08 16:38 ` Eric Schulte
  2012-01-08 17:30   ` Karl Voit
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-01-08 16:38 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1911 bytes --]

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi!
>
> I'm new to babel/gnuplot/org-plot and want to generate classic
> Boxplot[1] diagrams.
>
> My tests failed so far:
>
> #+TBLNAME: mydata
> #+PLOT: title:"Boxplots of mydata" with:candlesticks
> | A | B |
> |---+---|
> | 5 | 5 |
> | 5 | 6 |
> | 4 | 5 |
> | 5 | 6 |
> | 2 | 4 |
> | 2 | 5 |
>
> ... with «org-plot/gnuplot» results in:
> #+begin_verse
> gnuplot-mode 0.6.0 (gnuplot 4.4) -- report bugs with "C-c C-u"
> Starting gnuplot plotting program...Done
>
> #+end_verse
>
> ... with nothing else.
>
>
> #+begin_src gnuplot  :var data=mydata :file output.png
> set title "Plot Test"
>
> plot data using 1:2 with candlestick
> #+end_src
>
> ... results in empty output.png file.
>

In more complex examples like these I would recommend using a gnuplot
code block rather than using Org-plot.  Gnuplot has an extremely
comprehensive built in help system, typing "help boxplot" at the gnuplot
REPL returns the following.

,----
| gnuplot> help boxplot
|  Boxplots are a common way to represent a statistical distribution of values.
|  Quartile boundaries are determined such that 1/4 of the points have a value
|  equal or less than the first quartile boundary, 1/2 of the points have a value
|  equal or less than the second quartile (median) value, etc.  A box is drawn
|  around the region between the first and third quartiles, with a horizontal line
|  at the median value.  Whiskers extend from the box to user-specified limits.
|  Points that lie outside these limits are drawn individually.
| 
|  Examples
| 
|      # Place a boxplot at x coordinate 1.0 representing the y values in column 5
|      plot 'data' using (1.0):5
| 
| ...
`----

Also see the help for "candlestick".  Using this information the
attached Org-mode file generates a candlestick plot using a Gnuplot code
block.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: candlestick.org --]
[-- Type: text/x-org, Size: 642 bytes --]

#+Title: Box-Plots with Gnuplot
#+Options: ^:nil

#+name: sample
| x | box_min | whisker_min | whisker_high | box_high |
|---+---------+-------------+--------------+----------|
| 1 |       2 |           0 |            6 |        4 |
| 2 |       3 |           1 |            7 |        5 |
| 3 |       4 |           2 |            8 |        6 |
| 4 |       5 |           3 |            9 |        7 |
| 5 |       6 |           4 |           10 |        8 |
| 6 |       7 |           5 |           11 |        9 |

#+begin_src gnuplot :var data=sample :results silent
  set xrange [0:7]
  plot data using 1:2:3:4:5 with candlesticks
#+end_src

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]


Best,

>
>
> What is the problem here? At least the second method should end up
> in an error message or a file with content I guess.
>
>   1. http://en.wikipedia.org/wiki/Boxplot

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: Generating boxplot (candlestick) diagrams (babel or org-plot)
  2012-01-08 16:38 ` Eric Schulte
@ 2012-01-08 17:30   ` Karl Voit
  2012-01-08 18:05     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Voit @ 2012-01-08 17:30 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric!

* Eric Schulte <eric.schulte@gmx.com> wrote:
>
> In more complex examples like these I would recommend using a gnuplot
> code block rather than using Org-plot.  

Thought so. Thanks for confirmation.

> Gnuplot has an extremely
> comprehensive built in help system, typing "help boxplot" at the gnuplot
> REPL returns the following.

My gnuplot (Version 4.4 patchlevel 2) returns:

,----
| gnuplot> help boxplot
| Sorry, no help for 'boxplot'
| gnuplot>
`----

gnuplot-doc is installed. Do I miss something else? «help
candlestick» works. Is «boxplot» a part of an additional extension
package?

> Also see the help for "candlestick".  Using this information the
> attached Org-mode file generates a candlestick plot using a Gnuplot code
> block.
>
> #+name: sample
>| x | box_min | whisker_min | whisker_high | box_high |
>|---+---------+-------------+--------------+----------|
>
> #+begin_src gnuplot :var data=sample :results silent
>   set xrange [0:7]
>   plot data using 1:2:3:4:5 with candlesticks
> #+end_src

Your example works like charm at my side. 

And now I also understand the problem I had: I thought that gnuplot
is able to derive min/max whisker min/max from the data columns by
itself.

Well - this is bad news to me since I do not see any reasonable way
to use gnuplot for that purpose. I might need to learn R or
Python/matplotlib :-(

Thanks for your help anyway!

-- 
Karl Voit

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

* Re: Generating boxplot (candlestick) diagrams (babel or org-plot)
  2012-01-08 17:30   ` Karl Voit
@ 2012-01-08 18:05     ` Eric Schulte
  2012-01-09 16:46       ` Karl Voit
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-01-08 18:05 UTC (permalink / raw)
  To: news1142; +Cc: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi Eric!
>
> * Eric Schulte <eric.schulte@gmx.com> wrote:
>>
>> In more complex examples like these I would recommend using a gnuplot
>> code block rather than using Org-plot.  
>
> Thought so. Thanks for confirmation.
>
>> Gnuplot has an extremely
>> comprehensive built in help system, typing "help boxplot" at the gnuplot
>> REPL returns the following.
>
> My gnuplot (Version 4.4 patchlevel 2) returns:
>
> ,----
> | gnuplot> help boxplot
> | Sorry, no help for 'boxplot'
> | gnuplot>
> `----
>
> gnuplot-doc is installed. Do I miss something else? «help
> candlestick» works. Is «boxplot» a part of an additional extension
> package?
>

I'm using gnuplot 4.5 patchlevel 0 which is probably where this
difference comes in.  As I use gnuplot all the time, I find it
worthwhile to track the development head for nice new features such as
this and beautiful pdf plots through pgf/tikz.

>
>> Also see the help for "candlestick".  Using this information the
>> attached Org-mode file generates a candlestick plot using a Gnuplot code
>> block.
>>
>> #+name: sample
>>| x | box_min | whisker_min | whisker_high | box_high |
>>|---+---------+-------------+--------------+----------|
>>
>> #+begin_src gnuplot :var data=sample :results silent
>>   set xrange [0:7]
>>   plot data using 1:2:3:4:5 with candlesticks
>> #+end_src
>
> Your example works like charm at my side. 
>
> And now I also understand the problem I had: I thought that gnuplot
> is able to derive min/max whisker min/max from the data columns by
> itself.
>
> Well - this is bad news to me since I do not see any reasonable way
> to use gnuplot for that purpose. I might need to learn R or
> Python/matplotlib :-(
>

Judging from the help output for boxplot it looks as though the boxplot
option *will* perform these calculations for you, if you are willing to
move to version 4.5 or later.  The only downside of using new features
in gnuplot is that it is noticeably harder to find help through google.

>
> Thanks for your help anyway!

Happy to help!

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: Generating boxplot (candlestick) diagrams (babel or org-plot)
  2012-01-08 18:05     ` Eric Schulte
@ 2012-01-09 16:46       ` Karl Voit
  0 siblings, 0 replies; 5+ messages in thread
From: Karl Voit @ 2012-01-09 16:46 UTC (permalink / raw)
  To: emacs-orgmode

* Eric Schulte <eric.schulte@gmx.com> wrote:
> Karl Voit <devnull@Karl-Voit.at> writes:
>
> I'm using gnuplot 4.5 patchlevel 0 which is probably where this
> difference comes in.  As I use gnuplot all the time, I find it
> worthwhile to track the development head for nice new features such as
> this and beautiful pdf plots through pgf/tikz.

Glad to know that gnuplot is under active development!

But CSV? ... geesh seriously? ...

>> And now I also understand the problem I had: I thought that gnuplot
>> is able to derive min/max whisker min/max from the data columns by
>> itself.
>>
>> Well - this is bad news to me since I do not see any reasonable way
>> to use gnuplot for that purpose. I might need to learn R or
>> Python/matplotlib :-(
>
> Judging from the help output for boxplot it looks as though the boxplot
> option *will* perform these calculations for you, if you are willing to
> move to version 4.5 or later.  The only downside of using new features
> in gnuplot is that it is noticeably harder to find help through google.

Thanks for giving me OT gnuplot support!

-- 
Karl Voit

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

end of thread, other threads:[~2012-01-09 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08 15:44 Generating boxplot (candlestick) diagrams (babel or org-plot) Karl Voit
2012-01-08 16:38 ` Eric Schulte
2012-01-08 17:30   ` Karl Voit
2012-01-08 18:05     ` Eric Schulte
2012-01-09 16:46       ` Karl Voit

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