I've got this code in an Emacs orgmode file:
#+begin_src gnuplot :exports results :file images/sinecosine.pngresetset terminal png size 360, 360 enhanced# Line stylesset border linewidth 1set style line 1 linecolor rgb '#0060ad' linetype 1 linewidth 1 # blueset style line 2 linecolor rgb '#dd181f' linetype 1 linewidth 1 # red# Legendset key at 6.1,1.3# Axes label set xlabel 'x'set ylabel 'y'set xzeroaxis linetype 2 linewidth 1 set yzeroaxis linetype 2 linewidth 1# Axis rangesset xrange[-2*pi:2*pi]set yrange[-1.5:1.5]# Axis labelsset xtics ("-2{/Symbol P}" -2*pi, "-{/Symbol P}" -pi, 0, "{/Symbol P}" pi, "2{/Symbol P}" 2*pi)set ytics 1set tics scale 0.75# Functions to plota = 0.9f(x) = a * sin(x)g(x) = a * cos(x)# Plotplot f(x) title 'sin(x)' with lines ls 1, \ g(x) notitle with lines ls 2#+end_src
and it gives a gnuplot (3.7) without the proper pi symbol -- just like in this and this post. Yes, I can get the eps version of this to work, but not this png (or svg) version, which is needed for HTML export. Any new ideas?
Update
Here is the stand-alone code I've tried -- successfully:
resetset encoding utf8set terminal svg enhanced fname 'Times New Roman' rounded dashed standaloneset output "gp-test4-output.svg"# Line stylesset border linewidth 1set style line 1 linecolor rgb '#0060ad' linetype 1 linewidth 1 # blueset style line 2 linecolor rgb '#dd181f' linetype 1 linewidth 1 # red# Legendset key at 6.1,1.3# Axes label set xlabel 'x'set ylabel 'y'set xzeroaxis linetype 2 linewidth 1 set yzeroaxis linetype 2 linewidth 1# Axis rangesset xrange[-2*pi:2*pi]set yrange[-1.5:1.5]# Axis labelsset xtics ("-2Π" -2*pi, "-Π" -pi, 0, "Π" pi, "2Π" 2*pi)set ytics 1set tics scale 0.75# Functions to plota = 0.9f(x) = a * sin(x)g(x) = a * cos(x)# Plotplot f(x) title 'sin(x)' with lines ls 1, \ g(x) notitle with lines ls 2
I've swapped out the {/Symbol P}
for Π. From a terminal command line I've gotten it to work and produce just fine. The Ubuntu repo did install the latest-greatest gnuplot (gnuplot 5.2 patchlevel 6). So doing the experiment again, when I C-c C-c
in the org-mode codeblock I get
gnuplot-mode 0.7-beta (gnuplot 3.7) -- report bugs with "C-c C-u"
and the same error: junk instead of Π. (Not sure what the gnuplot 3.7 is about.) Running the codeblock above, BTW, starts a gnuplot REPL, and it says it's latest-greatest gnuplot. But when the stand-alone code above in Emacs (with gnuplot-mode) is called a la "send buffer to gnuplot" (the Emacs gnuplot REPL) it gives the error, BUT when I "send file to gnuplot", it produces the Π error-free. Totally bizarre, IMHO.
Here's my subscriptions:
(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/") ("org" . "https://orgmode.org/elpa/")))
which gives two offerings for gnuplot modes:
gnuplot 20141231.2137 available melpa drive gnuplot from within emacs
and then this:
gnuplot-mode 20171013.1616 installed Major mode for editing gnuplot scripts
So then I uninstalled Emacs gnuplot
(20141231.2137), then installed gnuplot-mode
(20171013.1616). This solved the gnuplot-run-buffer
problem, but the org-mode codeblock now gives this error:
executing Gnuplot code block...org-babel-execute:gnuplot: Cannot open load file: No such file or directory, gnuplot
Searching customize
I only find four variables associated with gnuplot, one being Gnuplot Program, which I have as /usr/bin/gnuplot
. I'm on latest-greatest Emacs and org-mode in Ubuntu 19.04. How do I better tell org-babel where to find Gnuplot? I suspect this newer mode is not the intended partner for Emacs org-mode; however the older mode is not doing greek letters properly in org-mode.