5

I would like to graph functions and datasets from calc-mode. (That's a reasonable thing to do in 2021, right?)

Following the directions at Basic Graphics and Vectors as Lists, I started calc-mode, created two vectors, and typed g f:

--- Emacs Calculator Mode ---
2: [0, 1, 2, 3]
1: [0, 1, 3, 9]
   .
g f

No graph is produced. In the *Gnuplot Trail* buffer that is created, I can see that I've got gnuplot v5.4 installed.

(BTW, TIL that the 'gnu' in 'gnuplot' has nothing to do with 'GNU', How did it come about and why is it called gnuplot?)

Also in the trail buffer, there are these error messages:

Terminal type is now 'qt'
gnuplot> 
Terminal type is now 'unknown'
                      ^
         unknown or ambiguous terminal type; type just 'set terminal' for a list

gnuplot> gnuplot> 
gnuplot> set notime
               ^
         "/var/folders/cj/hmr0n_q91kd7lg4jsqb8w9100000gn/T/calcAkJV7MZ" line 23: Unrecognized option.  See 'help unset'.

This makes me think I am using too new a version of gnuplot for the version of Calc I have installed. I am running vanilla Emacs 27.1. I couldn't figure out how to get Calc to tell me what version of calc-mode I have installed (including reading the source).

Searching site:emacs.stackexchange.com calc-mode gnuplot produced nothing of relevance.

I have once gotten the contents of various buffers like *Gnuplot Temp*, *Gnuplot Temp-2*, and *Gnuplot Commands*, saved them into independent local files, and run gnuplot from the command line and gotten a chart created, but I would like to figure out how to get things to work the normal way.

What should I do next?

Greg C
  • 97
  • 4
  • Try `g D default` and `g f` again. – NickD Mar 05 '21 at 21:12
  • That didn't seem to result in any difference. (Hi again NickD!) – Greg C Mar 05 '21 at 22:04
  • But then I tried `g D qt`, and THAT got `g f` to work. Now I will try to figure out how to set that terminal type as my default, to see if that results in calc graphing without further twiddling – Greg C Mar 05 '21 at 22:18
  • `C-u g D qt` should set it permanently according to the doc. – NickD Mar 05 '21 at 22:28
  • The other thing I needed to do was edit the source code to replace 'set notime' with 'unset timestamp'. I can't figure any way around needing to do that. I guess I will try to figure out how to ask if I should submit a PR for that? – Greg C Mar 05 '21 at 22:49
  • Apparently `set notimestamp` is OK - see the [fix](https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=78017a6e598ed7663aa04bd19c426f16bbc05006) – NickD Mar 05 '21 at 23:21
  • Interesting, even just adding an `s` to `time` appears sufficient. Followup question tho. That fix went in on 2020-12-07. The [latest version of 27.1.91](https://alpha.gnu.org/gnu/emacs/pretest/emacs-27.1.91.tar.xz) came out on 2021-01-29, but still lacks the commit that fixes this problem. How can I tell which version of Emacs will have this fix in it? – Greg C Mar 06 '21 at 23:02

1 Answers1

5

I've got the same issue here (emacs 27.1 and gnuplot 5.4).
Calc is issuing an option which is unknown to gnuplot: set notime. This seems to be a bug in calc. Calc is also issuing multiple deprecated commands (it should use unset instead of set no...), but these only trigger warnings.

To work around the unknown option, locate file calc-graph.el and edit it. In this file search for the string set notime\n and replace it with set notimestamp\n.

It is at line 354:

         "set notime\nset border\nset ztics\nset zeroaxis\n"

this line needs to state:

         "set notimestamp\nset border\nset ztics\nset zeroaxis\n"

Save the file (maybe compile it) and restart Emacs.

Afterwards plotting is working again.

Edit. this is already fixed in recent version at github.com/emacs-mirror.
Edit2: NickD posted the link to the fixing commit

jue
  • 4,476
  • 8
  • 20