### 12.5 Gnuplot Options

There are several plot options specific to gnuplot. All of them consist of a keyword (the name of the option), followed by a string that should be a valid gnuplot command, to be passed directly to gnuplot. In most cases, there exist a corresponding plotting option that will produce a similar result and whose use is more recommended than the gnuplot specific option.

Plot option: gnuplot_term [gnuplot_term, terminal_name]

  Sets the output terminal type for gnuplot. The argument terminal_name can be a string or one of the following 3 special symbols

  - default (default value)

    Gnuplot output is displayed in a separate graphical window and the gnuplot terminal used will be specified by the value of the option `gnuplot_default_term_command`.

  - dumb

    Gnuplot output is saved to a file `maxout_xxx.gnuplot` using "ASCII art" approximation to graphics. If the option `gnuplot_out_file` is set to filename, the plot will be saved there, instead of the default `maxout_xxx.gnuplot`. The settings for the “dumb” terminal of Gnuplot are given by the value of option `gnuplot_dumb_term_command`. If option `run_viewer` is set to true and the plot_format is `gnuplot` that ASCII representation will also be shown in the Maxima or Xmaxima console.

  - ps

    Gnuplot generates commands in the PostScript page description language. If the option `gnuplot_out_file` is set to filename, gnuplot writes the PostScript commands to filename. Otherwise, it is saved as `maxplot.ps` file. The settings for this terminal are given by the value of the option `gnuplot_dumb_term_command`.

  - A string representing any valid gnuplot term specification

    Gnuplot can generate output in many other graphical formats such as png, jpeg, svg etc. To use those formats, option `gnuplot_term` can be set to any supported gnuplot term name (which must be a symbol) or even a full gnuplot term specification with any valid options (which must be a string). For example `[gnuplot_term, png]` creates output in PNG (Portable Network Graphics) format while `[gnuplot_term, "png size 1000,1000"]` creates PNG of 1000 x 1000 pixels size. If the option `gnuplot_out_file` is set to filename, gnuplot writes the output to filename. Otherwise, it is saved as `maxplot.term` file, where term is gnuplot terminal name.

  Categories:Plotting ·

Plot option: gnuplot_out_file [gnuplot_out_file, file_name]

  It can be used to replace the default name for the file that contains the commands that will interpreted by gnuplot, when the terminal is set to `default`, or to replace the default name of the graphic file that gnuplot creates, when the terminal is different from `default`. If it contains one or more slashes, “/”, the name of the file will be left as it is; otherwise, it will be appended to the path of the temporary directory. The complete name of the files created by the plotting commands is always sent as output of those commands so they can be seen if the command is ended by semi-colon.

  When used in conjunction with the `gnuplot_term` option, it can be used to save the plot in a file, in one of the graphic formats supported by Gnuplot. To create PNG, PDF, Postscript or SVG, it is easier to use options `png_file`, `pdf_file`, `ps_file`, or `svg_file`.

  Categories:Plotting ·

Plot option: gnuplot_script_file [gnuplot_script_file, file_name_or_function]

  Creates a plot with `plot2d`, `plot3d`, `mandelbrot` or `julia` using the `gnuplot` `plot_format` and saving the script sent to Gnuplot in the file specified by file_name_or_function. The value file_name_or_function can be a string or a Maxima function of one variable that returns a string. If that string corresponds to a complete file path (directory and file name), the script will be created in that file and will not be deleted after Maxima is closed; otherwise, the string will give the name of a file to be created in the temporary directory and deleted when Maxima is closed.

  In this example, the script file name is set to “sin.gnuplot”, in the current directory.

      (%i1) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, "./sin.gnuplot"]);

      (%o1) ["./sin.gnuplot"]

  In this example, `gnuplot_maxout_prt(file)` is a function that takes the default file name, file. It constructs a full file name for the data file by interpolating a random 8-digit integer with a pad of zeros into the default file name (“maxout” followed by the id number of the Maxima process, followed by “.gnuplot”). The temporary directory is determined by `maxima_tempdir` (it is “/tmp” in this example).

      (%i1) gnuplot_maxout_prt(file) := block([beg,end],
              [beg,end] : split(file,"."),
              printf(false,"~a_~8,'0d.~a",beg,random(10^8-1),end)) $

      (%i2) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, gnuplot_maxout_prt]);

      (%o2) ["/tmp/maxout68715_09606909.gnuplot"]

  By default, the script would have been saved in a file named `maxoutXXXXX.gnuplot` (XXXXX=68715 in this example) in the temporary directory. If the print statement in function `gnuplot_maxout_prt` above included a directory path, the file would have been saved in that directory rather than in the temporary directory.

  Categories:Plotting ·

Plot option: gnuplot_pm3d [gnuplot_pm3d, value]

  With a value of `false`, it can be used to disable the use of PM3D mode, which is enabled by default.

  Categories:Plotting ·

Plot option: gnuplot_preamble [gnuplot_preamble, string]

  This option inserts gnuplot commands before any other commands sent to Gnuplot. Any valid gnuplot commands may be used. Multiple commands should be separated with a semi-colon. See also `gnuplot_postamble`.

  Categories:Plotting ·

Plot option: gnuplot_postamble [gnuplot_postamble, string]

  This option inserts gnuplot commands after other commands sent to Gnuplot and right before the plot command is sent. Any valid gnuplot commands may be used. Multiple commands should be separated with a semi-colon. See also `gnuplot_preamble`.

  Categories:Plotting ·

Plot option: gnuplot_default_term_command

  [gnuplot_default_term_command, command]

  The gnuplot command to set the terminal type for the default terminal. It this option is not set, the command used will be: `"set term wxt size 640,480 font \",12\"; set term pop"`.

  Categories:Plotting ·

Plot option: gnuplot_dumb_term_command

  [gnuplot_dumb_term_command, command]

  The gnuplot command to set the terminal type for the dumb terminal. It this option is not set, the command used will be: `"set term dumb 79 22"`, which makes the text output 79 characters by 22 characters.

  Categories:Plotting ·

Plot option: gnuplot_pdf_term_command [gnuplot_pdf_term_command, command]

  The gnuplot command to set the terminal type for the PDF terminal. If this option is not set, the command used will be: `"set term pdfcairo color solid lw 3 size 17.2 cm, 12.9 cm font \",18\""`. See the gnuplot documentation for more information.

  Categories:Plotting ·

Plot option: gnuplot_png_term_command [gnuplot_png_term_command, command]

  The gnuplot command to set the terminal type for the PNG terminal. If this option is not set, the command used will be: `"set term pngcairo font \",12\""`. See the gnuplot documentation for more information.

  Categories:Plotting ·

Plot option: gnuplot_ps_term_command [gnuplot_ps_term_command, command]

  The gnuplot command to set the terminal type for the PostScript terminal. If this option is not set, the command used will be: `"set term postscript eps color solid lw 2 size 16.4 cm, 12.3 cm font \",24\""`. See the gnuplot documentation for `set term postscript` for more information.

  Categories:Plotting ·

Plot option: gnuplot_strings [gnuplot_strings, value]

  With a value of `true`, all strings used in labels and titles will be interpreted by gnuplot as “enhanced” text, if the terminal being used supports it. In enhanced mode, some characters such as ^ and _ are not printed, but interpreted as formatting characters. For a list of the formatting characters and their meaning, see the documentation for enhanced in Gnuplot. The default value for this option is `false`, which will not treat any characters as formatting characters.

  Categories:Plotting ·

Plot option: gnuplot_svg_background

  [gnuplot_svg_background, color]
  nognuplot_svg_background

  Specify the background color for SVG image output. color must be a string which specifies a color name recognized by Gnuplot, or an RGB triple of the form `"#xxxxxx"` where `x` is a hexadecimal digit. The default value is `"white"`.

  When the value of `gnuplot_svg_background` is `false`, the background is the default determined by Gnuplot. At present (April 2023), the Gnuplot default is to specify the background in SVG output as `"none"`.

  `nognuplot_svg_background`, specified by itself without a value, is equivalent to `[gnuplot_svg_background, false]`.

  Categories:Plotting ·

Plot option: gnuplot_svg_term_command [gnuplot_svg_term_command, command]

  The gnuplot command to set the terminal type for the SVG terminal. If this option is not set, the command used will be: `"set term svg font \",14\""`. See the gnuplot documentation for more information.

  Categories:Plotting ·

Plot option: gnuplot_curve_titles

  This is an obsolete option that has been replaced by `legend` described above.

  Categories:Plotting ·

Plot option: gnuplot_curve_styles

  This is an obsolete option that has been replaced by `style`.

  Categories:Plotting ·