emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-plot gives Invalid function error
@ 2021-04-26 16:49 ian martins
  2021-04-26 17:04 ` Timothy
  0 siblings, 1 reply; 10+ messages in thread
From: ian martins @ 2021-04-26 16:49 UTC (permalink / raw)
  To: Org-Mode mailing list

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

I went to test the "Refresh inline" patch [1] and found that org-plot is
broken for me. it
seems to have broken in 1ac45d76e. I tested with =emacs -Q= (but loaded
Org from master and gnuplot.el manually).  I was running the example from
 the doc [2]. I tested on linux and mac, both using emacs 26.3, and got the
same result.

The error message is:

    org-plot/gnuplot: Invalid function: (dump-func (plist-get type
:data-dump))

But if I manually load =org-plot.el= it doesn't give that error, but
still doesn't produce a plot.  I'm not sure what manually loading
=org-plot.el= does since I'd just done a "make clean; make" and restarted.

In the second case (after manually loading =org-plot.el=), this is what is
in
the *gnuplot* buffer:

    Terminal type is now 'qt'
    gnuplot> reset
    gnuplot> set term GNUTERM

    Terminal type is now 'qt'
    Options are '0 font "Sans,9"'
    gnuplot>
    gnuplot> set title 'Citas'
    gnuplot> set yrange [0:]
    gnuplot> set yrange [0:]
    gnuplot> set datafile separator "\t"
    gnuplot> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title
'H-index'
             warning: Skipping data file with no valid points

     ^
             x range is invalid

this is the data file:

    "Chile" 257.72 21.39
    "Leeds" 165.77 19.68
    "Sao Paolo" 71.00 11.50
    "Stockholm" 134.19 14.33
    "Morelia" 257.56 17.67

I'll try to look into it more later.

[1] https://orgmode.org/list/87r1j0mg56.fsf@gmail.com/
[2] https://orgmode.org/manual/Org-Plot.html#Org-Plot

[-- Attachment #2: Type: text/html, Size: 2248 bytes --]

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

* Re: Bug: org-plot gives Invalid function error
  2021-04-26 16:49 Bug: org-plot gives Invalid function error ian martins
@ 2021-04-26 17:04 ` Timothy
  2021-04-27  3:33   ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Timothy @ 2021-04-26 17:04 UTC (permalink / raw)
  To: ian martins; +Cc: emacs-orgmode


Thank you for bringing this up, and bisecting the error. Interesting
that this hasn't been noticed/reported till now.

From a quick test myself, this appears reproducible, though I have no
idea what's going on (yet). Please let me know if you find anything.

--
Timothy

ian martins <ianxm@jhu.edu> writes:

> I went to test the "Refresh inline" patch [1] and found that org-plot is
> broken for me. it
> seems to have broken in 1ac45d76e. I tested with =emacs -Q= (but loaded
> Org from master and gnuplot.el manually).  I was running the example from
>  the doc [2]. I tested on linux and mac, both using emacs 26.3, and got the
> same result.
>
> The error message is:
>
>     org-plot/gnuplot: Invalid function: (dump-func (plist-get type
> :data-dump))
>
> But if I manually load =org-plot.el= it doesn't give that error, but
> still doesn't produce a plot.  I'm not sure what manually loading
> =org-plot.el= does since I'd just done a "make clean; make" and restarted.
>
> In the second case (after manually loading =org-plot.el=), this is what is
> in
> the *gnuplot* buffer:
>
>     Terminal type is now 'qt'
>     gnuplot> reset
>     gnuplot> set term GNUTERM
>
>     Terminal type is now 'qt'
>     Options are '0 font "Sans,9"'
>     gnuplot>
>     gnuplot> set title 'Citas'
>     gnuplot> set yrange [0:]
>     gnuplot> set yrange [0:]
>     gnuplot> set datafile separator "\t"
>     gnuplot> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title
> 'H-index'
>              warning: Skipping data file with no valid points
>
>      ^
>              x range is invalid
>
> this is the data file:
>
>     "Chile" 257.72 21.39
>     "Leeds" 165.77 19.68
>     "Sao Paolo" 71.00 11.50
>     "Stockholm" 134.19 14.33
>     "Morelia" 257.56 17.67
>
> I'll try to look into it more later.
>
> [1] https://orgmode.org/list/87r1j0mg56.fsf@gmail.com/
> [2] https://orgmode.org/manual/Org-Plot.html#Org-Plot


--
Timothy


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

* Re: Bug: org-plot gives Invalid function error
  2021-04-26 17:04 ` Timothy
@ 2021-04-27  3:33   ` Ihor Radchenko
  2021-04-27  3:50     ` Timothy
  0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2021-04-27  3:33 UTC (permalink / raw)
  To: Timothy, ian martins; +Cc: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> From a quick test myself, this appears reproducible, though I have no
> idea what's going on (yet). Please let me know if you find anything.

I remember seeing similar gnuplot errors using ob-gnuplot. They tend to
disappear upon restarting gnuplot process (M-x gnuplot-kill-gunplot-buffer),
probably because ob-gnuplot does not refresh gnuplot session.

A quick look through org-plot code shows that gnuplot session is also
preserved:

(when (get-buffer "*gnuplot*") ; reset *gnuplot* if it already running
      (with-current-buffer "*gnuplot*"
	(goto-char (point-max))))

So, I suspect that the problem I encountered may also be relevant in
org-plot.

Hope it helps.

Best,
Ihor


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

* Re: Bug: org-plot gives Invalid function error
  2021-04-27  3:33   ` Ihor Radchenko
@ 2021-04-27  3:50     ` Timothy
  2021-04-27  4:47       ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Timothy @ 2021-04-27  3:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode


Ihor Radchenko <yantar92@gmail.com> writes:

> ob-gnuplot does not refresh gnuplot session.
>
> A quick look through org-plot code shows that gnuplot session is also
> preserved:

That's why the reset command is run:
https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-plot.el#L560

From the docs:
>  The reset command causes all graph-related options that can be set
>  with the set command to take on their default values. This command is
>  useful, e.g., to restore the default graph settings at the end of a
>  command file, or to return to a defined state after lots of settings
>  have been changed within a command file. Please refer to the set
>  command to see the default values that the various options take.
>
> The following set commands do not change the graph status and are thus
> left unchanged: the terminal set with set term, the output file set
> with set output and directory paths set with set loadpath and set
> fontpath.

Wouldn't this be sufficient?

--
Timothy


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

* Re: Bug: org-plot gives Invalid function error
  2021-04-27  3:50     ` Timothy
@ 2021-04-27  4:47       ` Ihor Radchenko
  2021-05-01 17:13         ` Bastien
  2021-05-09 15:54         ` Timothy
  0 siblings, 2 replies; 10+ messages in thread
From: Ihor Radchenko @ 2021-04-27  4:47 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> That's why the reset command is run:
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/org-plot.el#L560

Sorry, I missed that. It should indeed make things much less likely to
break. One exception is when plot depends on settings defined in
.gnuplot file. reset command clears user customisations in .gnuplot.

Of course, the described bug may be related to something else.
[after some testing...]
Of course, it is:

> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title 'H-index'

This is not valid gnuplot command to create histograms. One needs to use:

plot '/tmp/org-plotiPs0To' using 3:tics(1) with histograms title 'H-index'

Best,
Ihor



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

* Re: Bug: org-plot gives Invalid function error
  2021-04-27  4:47       ` Ihor Radchenko
@ 2021-05-01 17:13         ` Bastien
  2021-05-01 17:18           ` Timothy
  2021-05-09 15:54         ` Timothy
  1 sibling, 1 reply; 10+ messages in thread
From: Bastien @ 2021-05-01 17:13 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Timothy

Hi Ihor and Timothy,

Ihor Radchenko <yantar92@gmail.com> writes:

> Of course, the described bug may be related to something else.
> [after some testing...]
> Of course, it is:
>
>> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title 'H-index'
>
> This is not valid gnuplot command to create histograms.

I'm closing this bug now - feel free to reopen it if I misunderstood
the thread.

-- 
 Bastien


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

* Re: Bug: org-plot gives Invalid function error
  2021-05-01 17:13         ` Bastien
@ 2021-05-01 17:18           ` Timothy
  2021-05-01 17:24             ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Timothy @ 2021-05-01 17:18 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Ihor Radchenko


Bastien <bzg@gnu.org> writes:

>>> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title 'H-index'
>>
>> This is not valid gnuplot command to create histograms.
>
> I'm closing this bug now - feel free to reopen it if I misunderstood
> the thread.

The bug has been identified, but not fixed.  I should get to this within
the next few days, as long as I don't get distracted.

I think it makes sense to leave this open until a fix has been applied.

--
Timothy


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

* Re: Bug: org-plot gives Invalid function error
  2021-05-01 17:18           ` Timothy
@ 2021-05-01 17:24             ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2021-05-01 17:24 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode, Ihor Radchenko

Timothy <tecosaur@gmail.com> writes:

> I think it makes sense to leave this open until a fix has been
> applied.

Done, thanks.

-- 
 Bastien


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

* Re: Bug: org-plot gives Invalid function error
  2021-04-27  4:47       ` Ihor Radchenko
  2021-05-01 17:13         ` Bastien
@ 2021-05-09 15:54         ` Timothy
  2021-05-12 14:07           ` Ihor Radchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Timothy @ 2021-05-09 15:54 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode


Ihor Radchenko <yantar92@gmail.com> writes:

>> plot '/tmp/org-plotiPs0To' using 1:3 with histograms title 'H-index'
>
> This is not valid gnuplot command to create histograms. One needs to use:
>
> plot '/tmp/org-plotiPs0To' using 3:tics(1) with histograms title 'H-index'

I've had a look at this, and it should be addressed in
https://code.orgmode.org/bzg/org-mode/commit/7dd667af.

If you could test it and let me know that would be greatly appreciated
:) It seems to work with the manual example for me.

Until I hear otherwise, I'm marking this bug as fixed.

--
Timothy


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

* Re: Bug: org-plot gives Invalid function error
  2021-05-09 15:54         ` Timothy
@ 2021-05-12 14:07           ` Ihor Radchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2021-05-12 14:07 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:
> If you could test it and let me know that would be greatly appreciated
> :) It seems to work with the manual example for me.
>
> Until I hear otherwise, I'm marking this bug as fixed.

I guess the initial report was using example from the manual:

#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
| Sede      | Max cites | H-index |
|-----------+-----------+---------|
| Chile     |    257.72 |   21.39 |
| Leeds     |    165.77 |   19.68 |
| Sao Paolo |     71.00 |   11.50 |
| Stockholm |    134.19 |   14.33 |
| Morelia   |    257.56 |   17.67 |

The example works for me on master.

Best,
Ihor


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

end of thread, other threads:[~2021-05-12 14:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 16:49 Bug: org-plot gives Invalid function error ian martins
2021-04-26 17:04 ` Timothy
2021-04-27  3:33   ` Ihor Radchenko
2021-04-27  3:50     ` Timothy
2021-04-27  4:47       ` Ihor Radchenko
2021-05-01 17:13         ` Bastien
2021-05-01 17:18           ` Timothy
2021-05-01 17:24             ` Bastien
2021-05-09 15:54         ` Timothy
2021-05-12 14:07           ` Ihor Radchenko

Code repositories for project(s) associated with this 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).