emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [org-plot/gnuplot] Plotting candlestick plots
@ 2015-09-17 17:05 Foivos S. Zakkak
  2015-09-18 10:47 ` Suvayu Ali
  0 siblings, 1 reply; 3+ messages in thread
From: Foivos S. Zakkak @ 2015-09-17 17:05 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello list,

I am trying to plot some candlesticks through org-plot/gnuplot,  but I
fail.

It seems that org-plot/gnuplot supports a list of numbers in deps, i.e.,
deps:(2 3 4) and then creates a string of the form:
'test.dat' using X with lines
where X is first 2 then 3 and finally 4 for deps:(2 3 4)

To plot candlesticks though, gnuplot expects a line of the form:
'test'.dat' using 1:3:2:6:5:xticlabels(7) with candlesticks whiskerbars

I thought that maybe setting deps to ("1:3:2:6:5") could give me the
result I wanted, but I was wrong.

I have traced the problem to be in org-plot/gnuplot-script, specifically
in the following code segment:

--8<---------------cut here---------------start------------->8---
(2d (dotimes (col num-cols)
      (unless (and (eq type '2d)
                   (or (and ind (equal (1+ col) ind))
                       (and deps (not (member (1+ col) deps)))))
        (setf plot-lines
              (cons
               (format plot-str data-file
                       (or (and ind (> ind 0)
                                (not text-ind)
                                (format "%d:" ind)) "")
                       (1+ col)
                       (if text-ind (format ":xticlabel(%d)" ind) "")
                       with
                       (or (nth col col-labels) (format "%d" (1+ col))))
               plot-lines)))))
--8<---------------cut here---------------end--------------->8---

This code-segment essentially goes through the columns in the data file
and checks for each of them if it is contained in `deps`, if so it
proceeds with creating a line of the form:
'test.dat' using X...

I believe an easy fix would be to unconditionally go through deps and
create a line of the form:
'test.dat' using X... where X is the corresponding element of deps.

I tried to hack it, but didn't have much success, any help is welcome.

Kind regards,
Foivos
--
WWW: foivos.zakkak.net
PGP: 7B40 69D9 29BA AE91 C0B3  220A 0846 BFD1 03F0 4EA1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 212 bytes --]

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

* Re: [org-plot/gnuplot] Plotting candlestick plots
  2015-09-17 17:05 [org-plot/gnuplot] Plotting candlestick plots Foivos S. Zakkak
@ 2015-09-18 10:47 ` Suvayu Ali
  2015-09-18 16:27   ` Emacs-orgmode Digest, Vol 115, Issue 21 Foivos S. Zakkak
  0 siblings, 1 reply; 3+ messages in thread
From: Suvayu Ali @ 2015-09-18 10:47 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Sep 17, 2015 at 08:05:16PM +0300, Foivos S. Zakkak wrote:
> Hello list,
> 
> I am trying to plot some candlesticks through org-plot/gnuplot,  but I
> fail.
> 
> It seems that org-plot/gnuplot supports a list of numbers in deps, i.e.,
> deps:(2 3 4) and then creates a string of the form:
> 'test.dat' using X with lines
> where X is first 2 then 3 and finally 4 for deps:(2 3 4)
> 
> To plot candlesticks though, gnuplot expects a line of the form:
> 'test'.dat' using 1:3:2:6:5:xticlabels(7) with candlesticks whiskerbars

Org plot is there for quick and easy plotting.  I would recommend using
babel with gnuplot source blocks.  You can easily pass tables as data,
and configure your plot as you wish.  Unfortunately I have not done this
recently, so I don't have any simple examples handy, but I'm sure there
are plenty on Worg.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Emacs-orgmode Digest, Vol 115, Issue 21
  2015-09-18 10:47 ` Suvayu Ali
@ 2015-09-18 16:27   ` Foivos S. Zakkak
  0 siblings, 0 replies; 3+ messages in thread
From: Foivos S. Zakkak @ 2015-09-18 16:27 UTC (permalink / raw)
  To: emacs-orgmode



On Fri, Sep 18, 2015 at 12:47:07 +0200, Suvayu Ali wrote:
> On Thu, Sep 17, 2015 at 08:05:16PM +0300, Foivos S. Zakkak wrote:
>> Hello list,
>>
>> I am trying to plot some candlesticks through org-plot/gnuplot,  but I
>> fail.
>>
>> It seems that org-plot/gnuplot supports a list of numbers in deps, i.e.,
>> deps:(2 3 4) and then creates a string of the form:
>> 'test.dat' using X with lines
>> where X is first 2 then 3 and finally 4 for deps:(2 3 4)
>>
>> To plot candlesticks though, gnuplot expects a line of the form:
>> 'test'.dat' using 1:3:2:6:5:xticlabels(7) with candlesticks whiskerbars
>
> Org plot is there for quick and easy plotting.

I see what you mean, but I believe something like
--8<---------------cut here---------------start------------->8---
#+PLOT: ind:1 deps:("1:4:3:7:6") with:candlesticks
|------------+-----------+------+------+--------+------+------|
| # Variable |      mean |  min |   q1 | median |   q3 |  max |
|------------+-----------+------+------+--------+------+------|
|          1 |      2166 | 2166 | 2166 |   2166 | 2166 | 2166 |
|         15 | 2166.6666 | 2166 | 2166 |   2167 | 2167 | 2168 |
|        255 | 2167.1803 | 2166 | 2167 |   2167 | 2168 | 2169 |
|        271 | 2247.3874 | 2242 | 2246 |   2247 | 2249 | 2252 |
|------------+-----------+------+------+--------+------+------|
--8<---------------cut here---------------end--------------->8---
is still pretty simple and yet so powerful.

> I would recommend using babel with gnuplot source blocks.  You can
> easily pass tables as data, and configure your plot as you wish.
> Unfortunately I have not done this recently, so I don't have any
> simple examples handy, but I'm sure there are plenty on Worg.
>
> Hope this helps,
>

It sure does! I'll have a look into it, thanks.

Foivos
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
--
WWW: foivos.zakkak.net
PGP: 7B40 69D9 29BA AE91 C0B3  220A 0846 BFD1 03F0 4EA1

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

end of thread, other threads:[~2015-09-18 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17 17:05 [org-plot/gnuplot] Plotting candlestick plots Foivos S. Zakkak
2015-09-18 10:47 ` Suvayu Ali
2015-09-18 16:27   ` Emacs-orgmode Digest, Vol 115, Issue 21 Foivos S. Zakkak

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