To install this package, run in Emacs:
M-x package-install RET gnuplot RET
It is recommended to run
gnuplot-mode on GNU Emacs 25 or above,
using gnuplot version 5.0 or above.
The el-get package includes a gnuplot-mode recipe. So to install simply call
M-x el-get-install RET gnuplot-mode
Alternatively, you can directly place the following in your init file so that
el-get can install and load gnuplot-mode at Emacs start up:
(el-get 'sync 'gnuplot-mode)
After fetching the package's source from the homepage, byte-compile
the package's files using the
make command and move the compiled
.elc files to your chosen target directory.
First of all, make sure that
gnuplot.el is in your load-path (this is automatic if using a package helper like use-package). To do so manually, add the following snippet in your emacs configuration file
(add-to-list 'load-path "/path/to/gnuplot")
gnuplot-info-lookup-symbol looks at the Gnuplot info
file. For that function to work, a
gnuplot.info file must be placed
somewhere where info can find it. The following snippet allows you
to put the
gnuplot.info any place convenient:
(add-to-list 'Info-default-directory-list "/path/to/info/file")
You can automatically enable
gnuplot-mode using the snippet below:
(autoload 'gnuplot-mode "gnuplot" "Gnuplot major mode" t) (autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot-mode" t) (setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))
Apart from enabling
gnuplot-mode automatically (see above), these
two functions are useful for starting up gnuplot-mode:
M-x gnuplot-mode : start gnuplot-mode in the current buffer
M-x gnuplot-make-buffer : open a new buffer (which is not visiting
a file) and start gnuplot-mode in that buffer
gnuplot-mode is on, the following keybindings are available:
|send current line to gnuplot
|send current line to gnuplot and move forward 1 line
|send current region to gnuplot
|send entire buffer to gnuplot
|send a file to gnuplot
|insert filename at point
|negate set option on current line
|set arguments for command at point
|set arguments for command under mouse cursor
|read the gnuplot info file
|kill gnuplot process
|M-tab or M-ret
|complete keyword before point
|newline and indent
|indent current line
With the exception of the commands for sending commands to Gnuplot, most of the above commands also work in the Gnuplot comint buffer, in addition to the following:
|plot the most recent script buffer line-by-line
|save the current script buffer and load that file
|pop back to most recent script buffer
By default gnuplot-mode will try to parse your commands as you type
and suggest only relevant completion candidates on typing
TAB. For example, with point after the
with of a
tab completion will suggest only plotting styles. This also enables
more specific help topic lookup in the gnuplot info file, provided you
have the right version of
gnuplot.info installed (see the
Installation section for isntructions).
If the context-sensitivity annoys you, you can get simple
non-context-sensitive completion back by toggling
gnuplot-context-sensitive-mode. See also the variable
By its nature, the completion code has to know a fair bit about the
structure of the gnuplot language. If you use it with an old version
of gnuplot (pre version 4) it will make mistakes. Most of gnuplot
4.6's command language is parsed correctly except for the
If you install the file
gnuplot-eldoc.el from a recent Gnuplot
distribution, gnuplot-mode can show syntax hints in the modeline when
eldoc-mode is turned on and context sensitivity is enabled.
You can optionally have plots displayed inline in the Gnuplot comint
process buffer. This is handy for trying things out without having to
switch between Emacs and the Gnuplot display. Call
gnuplot-inline-display-mode in a gnuplot-mode buffer to try it out. This
feature is implemented using temporary
png files, and is also somewhat
experimental. It requires Gnuplot to have
png support and a GNU Emacs
with image support. Please report bugs.
Multiple users have reported issues when trying to work with
gnuplot.el on Windows. Most notably, the gnuplot process hangs after
sending a first line of input (this is a common Emacs issue on
Windows, see here).
A partial workaround was to use
pgnuplot.exe as the
pgnuplot.exe is not included with
gnuplot since version 5.0.
You currently have two solutions:
Experiment using the
variables. For instance, setting
(setq gnuplot-program "/path/to/cmdproxy.exe") (setq gnuplot-program-args "/C /path/to/gnuplot.exe")
has been reported to work (see here for a reference).
comint is involved, it should function
correctly, but you lose most features of the
We would like to implement a send-buffer without comint as well
pause -1 command, which waits for the user to press a key,
is problematic when running under Emacs. Sending
pause -1 to the
running gnuplot process will make Emacs appear to freeze. (It isn't
really crashed: typing
C-g will unlock it and let you continue). The
workaround for now is to make Gnuplot output a string before pausing,
pause -1 "Hit return" or similar.
Some users have reported issues when trying to display unicode characters. This issue is likely due to your distribution bundling gnuplot with editline instead of readline. Recompiling the source with support for unicode should fix the issue until this issue is fixed upstream. Thanks to rolandog for discovering this fix.
List of changes for
gnuplot.el version 0.8.0 ranging from January 2021
to February 2023.
List of changes for
gnuplot.el version 0.8.0 ranging from March 2014
to January 2021.
gnuplot-program-args variable for passing additional
arguments to the gnuplot program binary.
gnuplot-inline-image-mode can now take three values:
gnuplot.info manual file has been updated for gnuplot
gnuplot-program-args customization option to pass
additional arguments to the gnuplot process.
syntax-proprietize-rules in gnuplot buffers.
gnuplot-context-sensitive-mode is now a normal minor mode.
completion-at-point in gnuplot
comint-process-echoes is now buffer-local.
gnuplot-insert. Negate option function, bound to
C-c C-h with no response goes to Commands menu. Transparent toolbar
icons. Replace kw-compl with a simple completion function. Put
gnuplot-toolbar code in gnuplot.el.
gnuplot-save-and-plot-from-comint and keybindings in the comint
(process-kill-without-query gnuplot-process nil).
gnuplot-negate-option checks if set option has a negated form.
gnuplot-kill-gnuplot-buffer made more robust. fixed a bug in
gnuplot-plot-from-comint. fixed description of gnuplot-faces
gnuplot-which-highlight variable and revamped how
colorization gets turned on. This is a bit tricky since I want it to
work with font-lock under emacs and xemacs and with hilit19.
pgnuplot.c and Win9x install instructions to the distribution.
Fixed a defface bug. Added
gnuplot-keywords-when allowing deferral
of parsing the info file.
gnuplot-version number from startup message and set
gnuplot-echo-command-line-flag accordingly. Added
gnuplot-program-version variable. Check that font-lock is actually
gnuplot-determine-gnuplot-version so that the gnuplot
version number and
comint-process-echos actually get set
correctly. Actually, the first time something is plotted, the
echoing might not work, but the second time it will.
comint-process-echos gets set. Maybe I got
it right this time? Also fixed certain situations where the info
file did notget properly loaded (insertion with info toggle on and
info button in GUI).