1 @c Time-stamp: "2024-03-07 12:17:14 villate"
3 * Introduction to Plotting::
5 * Functions and Variables for Plotting::
8 * Gnuplot_pipes Format Functions::
11 @c -----------------------------------------------------------------------------
12 @node Introduction to Plotting, Plotting Formats, Plotting, Plotting
13 @section Introduction to Plotting
14 @c -----------------------------------------------------------------------------
16 To make the plots, Maxima can use an external plotting package or its
17 own graphical interface Xmaxima (see the section on @mref{Plotting
18 Formats}). The plotting functions calculate a set of points and pass
19 them to the plotting package together with a set of commands specific to
20 that graphic program. In some cases those commands and data are saved in
21 a file and the graphic program is executed giving it the name of that
24 When a file is created, it will begiven the name
25 @code{maxout_xxx.format}, where @code{xxx} is a number that is unique to
26 every concurrently-running instance of Maxima and @code{format} is the
27 name of the plotting format being used (@code{gnuplot}, @code{xmaxima},
28 @code{mgnuplot} or @code{geomview}).
30 There are commands to save the plot in a graphic format file, rather
31 than showing it in the screen. The default name for that graphic file is
32 @code{maxplot.extension}, where @code{extension} is the extension
33 normally used for the kind of graphic file selected, but that name can
34 also be specified by the user.
36 The @code{maxout_xxx.format} and @code{maxplot.extension} files are created
37 in the directory specified by the system variable
38 @mrefdot{maxima_tempdir} That location can be changed by assigning to
39 that variable (or to the environment variable @env{MAXIMA_TEMPDIR}) a string
40 that represents a valid directory where Maxima can create new files. The
41 output of the Maxima plotting command will be a list with the names of
42 the file(s) created, including their complete path, or empty if no files
43 are created. Those files should be deleted after the maxima session ends.
45 If the format used is either @code{gnuplot} or @code{xmaxima}, and the
46 @code{maxout_xxx.gnuplot} or @code{maxout_xxx.xmaxima} was saved,
47 @code{gnuplot} or @code{xmaxima} can be run, giving it the name of that
48 file as argument, in order to view again a plot previously created in
49 Maxima. Thus, when a Maxima plotting command fails, the format can be
50 set to @code{gnuplot} or @code{xmaxima} and the plain-text file
51 @code{maxout_xxx.gnuplot} (or @code{maxout_xxx.xmaxima}) can be
52 inspected to look for the source of the problem.
54 The additional package @ref{draw} provides functions similar to the ones
55 described in this section with some extra features, but it only works
56 with @code{gnuplot}. Note that some plotting options have the same name
57 in both plotting packages, but their syntax and behavior is
58 different. To view the documentation for a graphic option @code{opt},
59 type @code{?? opt} in order to choose the information for either of
62 @opencatbox{Categories:}
66 @c -----------------------------------------------------------------------------
67 @node Plotting Formats, Functions and Variables for Plotting, Introduction to Plotting, Plotting
68 @section Plotting Formats
69 @c -----------------------------------------------------------------------------
71 Maxima can use either Gnuplot, Xmaxima or Geomview as graphics
72 program. Gnuplot and Geomview are external programs which must be
73 installed separately, while Xmaxima is distributed with Maxima. To see
74 which plotting format you are currently using, use the command
75 @code{get_plot_option(plot_format);} and to change to another format,
76 you can use @code{set_plot_option([plot_format, <format>])}, where
77 @code{<format>} is the name of one of the formats described below. Those
78 two commands show and change the global plot format, while each
79 individual plotting command can use its own format, if it includes an
80 option @code{[plot_format, <format>]} (see @mref{get_plot_option} and
81 @mref{set_plot_option}).
83 The plotting formats are the following:
89 Used to launch the external program gnuplot, which must be installed in
90 your system. All plotting commands and data are saved into the file
91 @code{maxout_xxx.gnuplot}.
94 @strong{gnuplot_pipes} (default value)
96 It is similar to the @code{gnuplot} format except that the commands and
97 plot data are sent directly to @code{gnuplot} without creating any
98 files. A single gnuplot process is kept open, with a single graphic
99 window, and subsequent plot commands will be sent to the same process,
100 replacing previous plots in that same window. Even if the graphic window
101 is closed, the @code{gnuplot} process is still running until the end of
102 the session or until it is killed with @mrefdot{gnuplot_close}. The
103 function @mref{gnuplot_replot} can be used to modify a plot that has
104 already been displayed on the screen or to open again the graphic window
107 This format does not work with some versions of Lisp under Windows and
108 it is only used to plot to the screen; whenever graphic files are to be
109 created, the format is silently switched to @code{gnuplot} and the
110 commands needed to create the graphic file are saved with the data in
111 file @code{maxout_xxx.gnuplot}.
116 Mgnuplot is a Tk-based wrapper around gnuplot. It is an old interface
117 still included in the Maxima distribution, but it is currently disabled
118 because it does not have most of the features introduced by the newer
119 versions of the plotting commands. Mgnuplot requires an external gnuplot
120 installation and, in Unix systems, the Tcl/Tk system.
125 Xmaxima is a Tcl/Tk graphical interface for Maxima that can also be used
126 to display plots created when Maxima is run from the console or from
127 other graphical interfaces. To use this format, the xmaxima program,
128 which is distributed together with Maxima, must be installed; in some
129 Linux distributions Xmaxima is distributed in a package separate from
130 other parts of Maxima. If Maxima is being run from the Xmaxima console,
131 the data and commands are passed to xmaxima through the same socket used
132 for the communication between Maxima and the Xmaxima console. When used
133 from a terminal or from graphical interfaces different from Xmaxima, the
134 commands and data are saved in the file @code{maxout_xxx.xmaxima} and
135 xmaxima is run with the name of that file as argument.
140 Geomview, a Motif based interactive 3D viewing program for Unix. It can
141 only be used to display plots created with @code{plot3d}. To use this
142 format, the geomview program must be installed.
146 @opencatbox{Categories:}
150 @c -----------------------------------------------------------------------------
151 @node Functions and Variables for Plotting, Plotting Options, Plotting Formats, Plotting
152 @section Functions and Variables for Plotting
153 @c -----------------------------------------------------------------------------
155 @c -----------------------------------------------------------------------------
156 @anchor{geomview_command}
157 @defvr {System variable} geomview_command
159 This variable stores the name of the command used to run the geomview
160 program when the plot format is @code{geomview}. Its default value is
161 "geomview". If the geomview program is not found unless you give
162 its complete path or if you want to try a different version of it,
163 you may change the value of this variable. For instance,
166 @c geomview_command: "/usr/local/bin/my_geomview"$
169 (%i1) geomview_command: "/usr/local/bin/my_geomview"$
172 @opencatbox{Categories:}
177 @c -----------------------------------------------------------------------------
178 @anchor{get_plot_option}
179 @deffn {Function} get_plot_option (@var{keyword}, @var{index})
181 Returns the current default value of the option named @var{keyword},
182 which is a list. The optional argument @var{index} must be a positive
183 integer which can be used to extract only one element from the list
184 (element 1 is the name of the option).
186 See also @mrefcomma{set_plot_option} @mref{remove_plot_option} and the
187 section on @mrefdot{Plotting Options}
190 @c -----------------------------------------------------------------------------
191 @anchor{gnuplot_command}
192 @defvr {System variable} gnuplot_command
194 This variable stores the name of the command used to run the gnuplot
195 program when the plot format is @code{gnuplot} or
196 @code{gnuplot_pipes}. Its default value is "gnuplot". If the gnuplot
197 program is not found unless you give its complete path or if you want to
198 try a different version of it, you may change the value of this
199 variable. For instance,
202 @c gnuplot_command: "/usr/local/bin/my_gnuplot"$
205 (%i1) gnuplot_command: "/usr/local/bin/my_gnuplot"$
208 @opencatbox{Categories:}
213 @c -----------------------------------------------------------------------------
214 @anchor{gnuplot_file_args}
215 @defvr {System variable} gnuplot_file_args
217 When a graphic file is going to be created using @code{gnuplot}, this
218 variable is used to specify the format used to print the file name given
219 to gnuplot. Its default value is "~a" in SBCL and Openmcl, and "~s" in
220 other lisp versions, which means that the name of the file will be
221 passed without quotes if SBCL or Openmcl are used and within quotes if
222 other Lisp versions are used. The contents of this variable can be
223 changed in order to add options for the gnuplot program, adding those
224 options before the format directive "~s".
226 @opencatbox{Categories:}
231 @c -----------------------------------------------------------------------------
232 @anchor{gnuplot_view_args}
233 @defvr {System variable} gnuplot_view_args
235 This variable is the format used to parse the argument that will be
236 passed to the gnuplot program when the plot format is
237 @code{gnuplot}. Its default value is "-persist ~a" when SBCL or Openmcl
238 are used, and "-persist ~s" with other Lisp variants, where "~a" or "~s"
239 will be replaced with the name of the file where the gnuplot commands
240 have been written (usually "maxout_xxx.gnuplot"). The option
241 @code{-persist} tells gnuplot to exit after the commands in the file
242 have been executed, without closing the window that displays the plot.
244 Those familiar with gnuplot, might want to change the value of this
245 variable. For example, by changing it to:
248 @c gnuplot_view_args: "~s -"$
251 (%i1) gnuplot_view_args: "~s -"$
254 gnuplot will not be closed after the commands in the file have been
255 executed; thus, the window with the plot will remain, as well as the
256 gnuplot interactive shell where other commands can be issued in order to
259 In Windows versions of Gnuplot older than 4.6.3 the behavior of "~s -"
260 and "-persist ~s" were the opposite; namely, "-persist ~s" made the plot
261 window and the gnuplot interactive shell remain, while "~s -" closed the
262 gnuplot shell keeping the plot window. Therefore, when older gnuplot
263 versions are used in Windows, it might be necessary to adjust the value
264 of @code{gnuplot_view_args}.
266 @opencatbox{Categories:}
271 @c -----------------------------------------------------------------------------
273 @deffn {Function} julia (@var{x}, @var{y}, ...@var{options}...)
275 Creates a graphic representation of the Julia set for the complex number
276 (@var{x} + i @var{y}). The two mandatory parameters @var{x} and @var{y}
277 must be real. This program is part of the additional package
278 @code{dynamics}, but that package does not have to be loaded; the first
279 time julia is used, it will be loaded automatically.
281 Each pixel in the grid is given a color corresponding to the number of
282 iterations it takes the sequence that starts at that point to move out
283 of the convergence circle of radius 2 centered at the origin. The number
284 of pixels in the grid is controlled by the @mref{grid} plot option
285 (default 30 by 30). The maximum number of iterations is set with the
286 option @mrefdot{iterations} The program sets its own default palette:
287 magenta, violet, blue, cyan, green, yellow, orange, red, brown and black,
288 but it can be changed by adding an explicit @mref{palette} option in the
291 The default domain used goes from -2 to 2 in both axes and can be
292 changed with the @code{x} and @code{y} options. By default, the two axes
293 are shown with the same scale, unless the option @mref{yx_ratio} is used
294 or the option @mref{same_xy} is disabled. Other general plot options are
297 The following example shows a region of the Julia set for the number
298 -0.55 + i0.6. The option @mref{color_bar_tics} is used to prevent
299 Gnuplot from adjusting the color box up to 40, in which case the points
300 corresponding the maximum 36 iterations would not be black.
303 @c julia (-0.55, 0.6, [iterations, 36], [x, -0.3, 0.2],
304 @c [y, 0.3, 0.9], [grid, 400, 400], [color_bar_tics, 0, 6, 36])$
308 (%i1) julia (-0.55, 0.6, [iterations, 36], [x, -0.3, 0.2],
309 [y, 0.3, 0.9], [grid, 400, 400], [color_bar_tics, 0, 6, 36])$
314 @image{figures/plotting4,8cm}
317 @opencatbox{Categories:}
318 @category{Package dynamics}
324 @c -----------------------------------------------------------------------------
325 @anchor{make_transform}
326 @deffn {Function} make_transform ([@var{var1}, @var{var2}, @var{var3}], @var{fx}, @var{fy}, @var{fz})
328 Returns a function suitable to be used in the option @mref{transform_xy}@w{}
329 of plot3d. The three variables @var{var1}, @var{var2}, @var{var3} are
330 three dummy variable names, which represent the 3 variables given by the
331 plot3d command (first the two independent variables and then the
332 function that depends on those two variables). The three functions
333 @var{fx}, @var{fy}, @var{fz} must depend only on those 3 variables, and
334 will give the corresponding x, y and z coordinates that should be
335 plotted. There are two transformations defined by default:
336 @mref{polar_to_xy} and @mrefdot{spherical_to_xyz} See the documentation
337 for those two transformations.
339 @opencatbox{Categories:}
344 @c -----------------------------------------------------------------------------
346 @deffn {Function} mandelbrot (@var{options})
348 Creates a graphic representation of the Mandelbrot set. This program is
349 part of the additional package @code{dynamics}, but that package does
350 not have to be loaded; the first time mandelbrot is used, the package
351 will be loaded automatically.
353 This program can be called without any arguments, in which case it will
354 use a default value of 9 iterations per point, a grid with dimensions
355 set by the @mref{grid} plot option (default 30 by 30) and a region
356 that extends from -2 to 2 in both axes. The options are all the same
357 that plot2d accepts, plus an option @mref{iterations} to change the
358 number of iterations.
360 Each pixel in the grid is given a color corresponding to the number of
361 iterations it takes the sequence starting at zero to move out
362 of the convergence circle of radius 2, centered at the origin. The
363 maximum number of iterations is set by the option @mrefdot{iterations}
364 The program uses its own default palette: magenta,violet, blue, cyan,
365 green, yellow, orange, red, brown and black, but it can be changed by
366 adding an explicit @mref{palette} option in the command. By default, the
367 two axes are shown with the same scale, unless the option @mref{yx_ratio}
368 is used or the option @mref{same_xy} is disabled.
373 @c mandelbrot ([iterations, 30], [x, -2, 1], [y, -1.2, 1.2],
377 (%i1) mandelbrot ([iterations, 30], [x, -2, 1], [y, -1.2, 1.2],
382 @image{figures/plotting5,8cm}
385 @opencatbox{Categories:}
386 @category{Package dynamics}
392 @c -----------------------------------------------------------------------------
394 @deffn {System function} polar_to_xy
396 It can be given as value for the @mref{transform_xy} option of
397 plot3d. Its effect will be to interpret the two independent variables in
398 plot3d as the distance from the z axis and the azimuthal angle (polar
399 coordinates), and transform them into x and y coordinates.
401 @opencatbox{Categories:}
406 @c -----------------------------------------------------------------------------
408 @deffn {Function} plot2d @
409 @fname{plot2d} (@var{expr}, @var{range_x}, @var{options}) @
410 @fname{plot2d} (@var{expr_1}=@var{expr_2}, @var{range_x}, @var{range_y}, @var{options}) @
411 @fname{plot2d} ([parametric, @var{expr_x}, @var{expr}_y, @var{range}], @var{options}) @
412 @fname{plot2d} ([discrete, @var{points}], @var{options}) @
413 @fname{plot2d} ([contour, @var{expr}], @var{range_x}, @var{range_y}, @var{options}) @
414 @fname{plot2d} ([@var{type_1}, @dots{}, @var{type_n}], @var{options})
416 There are 5 types of plots that can be plotted by @code{plot2d}:
419 @item @b{Explicit functions}. @code{plot2d} (@var{expr}, @var{range_x},
420 @var{options}), where @var{expr} is an expression that depends on only
421 one variable, or the name of a function with one input parameter and
422 numerical results. @var{range_x} is a list with three elements, the
423 first one being the name of the variable that will be shown on the
424 horizontal axis of the plot, and the other two elements should be two
425 numbers, the first one smaller than the second, that define the minimum
426 and maximum values to be shown on the horizontal axis. The name of the
427 variable used in @var{range_x} must be the same variable on which
428 @var{expr} depends. The result will show in the vertical axis the
429 corresponding values of the expression or function for each value of the
430 variable in the horizontal axis.
432 @item @b{Implicit functions}. @code{plot2d} (@var{expr_1}=@var{expr_2},
433 @var{range_x}, @var{range_y}, @var{options}), where @var{expr_1} and
434 @var{expr_2} are two expressions that can depend on one or two
435 variables. @var{range_x} and @var{range_y} must be two lists of three
436 elements that define the ranges for the variables in the two axes of the
437 plot; the first element of each list is the name of the corresponding
438 variable, and the other two elements are the minimum and maximum values
439 for that variable. The two variables on which @var{expr_1} and
440 @var{expr_2} can depend are those specified by @var{range_x} and
441 @var{range_y}. The result will be a curve or a set of curves where the
442 equation @var{expr_1}=@var{expr_2} is true.
444 @item @b{Parametric functions}. @code{plot2d} ([parametric,
445 @var{expr_x}, @var{expr}_y, @var{range}], @var{options}), where
446 @var{expr_x} and @var{expr}_y are two expressions that depend on a
447 single parameter. @var{range} must be a three-element list; the first
448 element must be the name of the parameter on which @var{expr_x} and
449 @var{expr}_y depend, and the other two elements must be the minimum and
450 maximum values for that parameter. The result will be a curve in which
451 the horizontal and vertical coordinates of each point are the values of
452 @var{expr_x} and @var{expr}_y for a value of the parameter within the
455 @item @b{Set of points}. @code{plot2d} ([discrete, @var{points}],
456 @var{options}), displays a list of points, joined by segments by
457 default. The horizontal and vertical coordinates of each of those points
458 can be specified in three different ways: With two lists of the same
459 length, in which the elements of the first list are the horizontal
460 coordinates of the points and the second list are the vertical
461 coordinates, or with a list of two-element lists, each one corresponding
462 to the two coordinates of one of the points, or with a single list that
463 defines the vertical coordinates of the points; in this last case, the
464 horizontal coordinates of the n points will be assumed to be the first n
467 @item @b{Contour lines}. @code{plot2d} ([contour, @var{expr}],
468 @var{range_x}, @var{range_y}, @var{options}), where @var{expr} is an
469 expression that depends on two variables. @var{range_x} and
470 @var{range_y} will be lists whose first elements are the names of those
471 two variables, followed by two numbers that set the minimum and maximum
472 values for them. The first variable will be represented along the
473 horizontal axis and the second along the vertical axis. The result will
474 be a set of curves along which the given expression has certain
475 values. If those values are not specified with the option @code{levels},
476 plotd2d will try to choose, at the most, 8 values of the form d*10^n, where d is
477 either 1, 2 or 5, all of them within the minimum and maximum values of
478 @var{expr} within the given ranges.
481 At the end of a plot2d command several of the options described in
482 @mref{Plotting Options} can be used. Many instances of the 5 types
483 described above can be combined into a single plot, by putting them
484 inside a list: @code{plot2d} ([@var{type_1}, @dots{}, @var{type_n}],
485 @var{options}). If one of the types included in the list require
486 @var{range_x} or @var{range_y}, those ranges should come immediately
489 If there are several plots to be plotted, a legend will be
490 written to identity each of the expressions. The labels that should be
491 used in that legend can be given with the option @mrefdot{legend} If that
492 option is not used, Maxima will create labels from the expressions or
495 @c PUT EXAMPLES FOR PRECEDING SIMPLE FORMS OF plot2d HERE
499 @item Explicit function.
502 @c plot2d (sin(x), [x, -%pi, %pi])$
505 (%i1) plot2d (sin(x), [x, -%pi, %pi])$
509 @image{figures/plotting6,8cm}
512 @item Implicit function.
515 @c plot2d (x^2-y^3+3*y=2, [x,-2.5,2.5], [y,-2.5,2.5])$
518 (%i1) plot2d (x^2-y^3+3*y=2, [x,-2.5,2.5], [y,-2.5,2.5])$
522 @image{figures/plotting3,8cm}
525 @item Parametric function.
528 @c r: (exp(cos(t))-2*cos(4*t)-sin(t/12)^5)$
529 @c plot2d([parametric, r*sin(t), r*cos(t), [t,-8*%pi,8*%pi]])$
532 (%i1) r: (exp(cos(t))-2*cos(4*t)-sin(t/12)^5)$
533 (%i2) plot2d([parametric, r*sin(t), r*cos(t), [t,-8*%pi,8*%pi]])$
537 @image{figures/plotting11,8cm}
543 @c plot2d ([discrete, makelist(i*%pi, i, 1, 5),
544 @c [0.6, 0.9, 0.2, 1.3, 1]])$
547 (%i1) plot2d ([discrete, makelist(i*%pi, i, 1, 5),
548 [0.6, 0.9, 0.2, 1.3, 1]])$
552 @image{figures/plotting14,8cm}
558 @c plot2d ([contour, u^3 + v^2], [u, -4, 4], [v, -4, 4])$
561 (%i1) plot2d ([contour, u^3 + v^2], [u, -4, 4], [v, -4, 4])$
565 @image{figures/plotting2,8cm}
570 @strong{Examples using options}.
572 If an explicit function grows too fast, the @mref{y} option can be used
573 to limit the values in the vertical axis:
576 @c plot2d (sec(x), [x, -2, 2], [y, -20, 20])$
579 (%i1) plot2d (sec(x), [x, -2, 2], [y, -20, 20])$
583 @image{figures/plotting7,8cm}
586 When the plot box is disabled, no labels are created for the axes. In
587 that case, instead of using @mref{xlabel} and @mref{ylabel} to set the
588 names of the axes, it is better to use option @mrefcomma{label} which
589 allows more flexibility. Option @mref{yx_ratio} is used to change the
590 default rectangular shape of the plot; in this example the plot will
594 @c plot2d ( x^2 - 1, [x, -3, 3], nobox, grid2d,
595 @c [yx_ratio, 1], [axes, solid], [xtics, -2, 4, 2],
596 @c [ytics, 2, 2, 6], [label, ["x", 2.9, -0.3],
597 @c ["x^2-1", 0.1, 8]], [title, "A parabola"])$
600 (%i1) plot2d ( x^2 - 1, [x, -3, 3], nobox, grid2d,
601 [yx_ratio, 1], [axes, solid], [xtics, -2, 4, 2],
602 [ytics, 2, 2, 6], [label, ["x", 2.9, -0.3],
603 ["x^2-1", 0.1, 8]], [title, "A parabola"])$
607 @image{figures/plotting8,8cm}
610 A plot with a logarithmic scale in the vertical axis:
613 @c plot2d (exp(3*s), [s, -2, 2], logy)$
616 (%i1) plot2d (exp(3*s), [s, -2, 2], logy)$
620 @image{figures/plotting9,8cm}
623 Plotting functions by name:
627 @c :lisp (defun |$g| (x) (m* x x x))
628 @c H(x) := if x < 0 then x^4 - 1 else 1 - x^5 $
629 @c plot2d ([F, G, H], [u, -1, 1], [y, -1.5, 1.5])$
633 (%i2) :lisp (defun |$g| (x) (m* x x x))
635 (%i2) H(x) := if x < 0 then x^4 - 1 else 1 - x^5 $
636 (%i3) plot2d ([F, G, H], [u, -1, 1], [y, -1.5, 1.5])$
640 @image{figures/plotting10,8cm}
643 Plot of a circle, using its parametric representation, together with the
644 function -@code{|@var{x}|}. The circle will only look like a circle if
645 the scale in the two axes is the same, which is done with the option
649 @c plot2d([[parametric, cos(t), sin(t), [t,0,2*%pi]], -abs(x)],
650 @c [x, -sqrt(2), sqrt(2)], same_xy)$
654 (%i1) plot2d([[parametric, cos(t), sin(t), [t,0,2*%pi]], -abs(x)],
655 [x, -sqrt(2), sqrt(2)], same_xy)$
660 @image{figures/plotting12,8cm}
663 A plot of 200 random numbers between 0 and 9:
666 @c plot2d ([discrete, makelist ( random(10), 200)])$
670 (%i1) plot2d ([discrete, makelist ( random(10), 200)])$
675 @image{figures/plotting13,8cm}
678 In the next example a table with three columns is saved in a file
679 ``data.txt'' which is then read and the second and third column are
680 plotted on the two axes:
684 @c with_stdout ("data.txt", for x:0 thru 10 do
685 @c print (x, x^2, x^3))$
686 @c data: read_matrix ("data.txt")$
687 @c plot2d ([discrete, transpose(data)[2], transpose(data)[3]],
688 @c [style,points], [point_type,diamond], [color,red])$
691 (%i1) display2d:false$
692 (%i2) with_stdout ("data.txt", for x:0 thru 10 do
693 print (x, x^2, x^3))$
694 (%i3) data: read_matrix ("data.txt")$
695 (%i4) plot2d ([discrete, transpose(data)[2], transpose(data)[3]],
696 [style,points], [point_type,diamond], [color,red])$
700 @image{figures/plotting15,8cm}
703 A plot of discrete data points together with a continuous function:
706 @c xy: [[10, .6], [20, .9], [30, 1.1], [40, 1.3], [50, 1.4]]$
707 @c plot2d([[discrete, xy], 2*%pi*sqrt(l/980)], [l,0,50],
708 @c [style, points, lines], [color, red, blue],
709 @c [point_type, asterisk],
710 @c [legend, "experiment", "theory"],
711 @c [xlabel, "pendulum's length (cm)"],
712 @c [ylabel, "period (s)"])$
715 (%i1) xy: [[10, .6], [20, .9], [30, 1.1], [40, 1.3], [50, 1.4]]$
716 (%i2) plot2d([[discrete, xy], 2*%pi*sqrt(l/980)], [l,0,50],
717 [style, points, lines], [color, red, blue],
718 [point_type, asterisk],
719 [legend, "experiment", "theory"],
720 [xlabel, "pendulum's length (cm)"],
721 [ylabel, "period (s)"])$
725 @image{figures/plotting16,8cm}
728 See also the section about Plotting Options.
730 @opencatbox{Categories:}
735 @c -----------------------------------------------------------------------------
737 @deffn {Function} plot3d @
738 @fname{plot3d} (@var{expr}, @var{x_range}, @var{y_range}, @dots{}, @var{options}, @dots{}) @
739 @fname{plot3d} ([@var{expr_1}, @dots{}, @var{expr_n}], @var{x_range}, @var{y_range}, @dots{}, @var{options}, @dots{})
741 Displays a plot of one or more surfaces defined as functions of two
742 variables or in parametric form.
744 The functions to be plotted may be specified as expressions or function names.
745 The mouse can be used to rotate the plot looking at the surface from different
750 Plot of a function of two variables:
753 @c plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
758 (%i1) plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
764 @image{figures/plotting17,8cm}
767 Use of the @mref{z} option to limit a function that goes to infinity
768 (in this case the function is minus infinity on the x and y axes); this also
769 shows how to plot with only lines and no shading:
772 @c plot3d ( log ( x^2*y^2 ), [x, -2, 2], [y, -2, 2], [z, -8, 4],
773 @c nopalette, [color, magenta])$
777 (%i1) plot3d ( log ( x^2*y^2 ), [x, -2, 2], [y, -2, 2], [z, -8, 4],
778 nopalette, [color, magenta])$
783 @image{figures/plotting18,8cm}
786 The infinite values of z can also be avoided by choosing a grid that
787 does not fall on any points where the function is undefined, as in the
788 next example, which also shows how to change the palette and how to
789 include a color bar that relates colors to values of the z variable:
792 @c plot3d (log (x^2*y^2), [x, -2, 2], [y, -2, 2],[grid, 29, 29],
793 @c [palette, [gradient, red, orange, yellow, green]],
794 @c color_bar, [xtics, 1], [ytics, 1], [ztics, 4],
795 @c [color_bar_tics, 4])$
799 (%i1) plot3d (log (x^2*y^2), [x, -2, 2], [y, -2, 2],[grid, 29, 29],
800 [palette, [gradient, red, orange, yellow, green]],
801 color_bar, [xtics, 1], [ytics, 1], [ztics, 4],
802 [color_bar_tics, 4])$
807 @image{figures/plotting19,8cm}
810 Two surfaces in the same plot. Ranges specific to one of the surfaces can
811 be given by placing each expression and its ranges in a separate list;
812 global ranges for the complete plot are also given after the function
816 @c plot3d ([[-3*x - y, [x, -2, 2], [y, -2, 2]],
817 @c 4*sin(3*(x^2 + y^2))/(x^2 + y^2), [x, -3, 3], [y, -3, 3]],
818 @c [x, -4, 4], [y, -4, 4])$
821 (%i1) plot3d ([[-3*x - y, [x, -2, 2], [y, -2, 2]],
822 4*sin(3*(x^2 + y^2))/(x^2 + y^2), [x, -3, 3], [y, -3, 3]],
823 [x, -4, 4], [y, -4, 4])$
827 @image{figures/plotting20,8cm}
830 Plot of a Klein bottle, defined parametrically:
833 @c expr_1: 5*cos(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)-10$
834 @c expr_2: -5*sin(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)$
835 @c expr_3: 5*(-sin(x/2)*cos(y)+cos(x/2)*sin(2*y))$
836 @c plot3d ([expr_1, expr_2, expr_3], [x, -%pi, %pi],
837 @c [y, -%pi, %pi], [grid, 50, 50])$
840 (%i1) expr_1: 5*cos(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)-10$
841 (%i2) expr_2: -5*sin(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3)$
842 (%i3) expr_3: 5*(-sin(x/2)*cos(y)+cos(x/2)*sin(2*y))$
843 (%i4) plot3d ([expr_1, expr_2, expr_3], [x, -%pi, %pi],
844 [y, -%pi, %pi], [grid, 50, 50])$
848 @image{figures/plotting21,8cm}
851 Plot of a ``spherical harmonic'' function, using the predefined
852 transformation, @code{spherical_to_xyz} to transform from spherical
853 coordinates to rectangular coordinates. See the documentation for
854 @mrefdot{spherical_to_xyz}
857 @c plot3d (sin(2*theta)*cos(phi), [theta,0,%pi], [phi,0,2*%pi],
858 @c [transform_xy, spherical_to_xyz], [grid, 30, 60], nolegend)$
861 (%i1) plot3d (sin(2*theta)*cos(phi), [theta,0,%pi], [phi,0,2*%pi],
862 [transform_xy, spherical_to_xyz], [grid, 30, 60], nolegend)$
866 @image{figures/plotting22,8cm}
869 Use of the pre-defined function @code{polar_to_xy} to transform from
870 cylindrical to rectangular coordinates. See the documentation for
871 @mrefdot{polar_to_xy}
874 @c plot3d (r^.33*cos(th/3), [r,0,1], [th,0,6*%pi], nobox,
875 @c nolegend, [grid, 12, 80], [transform_xy, polar_to_xy])$
879 (%i1) plot3d (r^.33*cos(th/3), [r,0,1], [th,0,6*%pi], nobox,
880 nolegend, [grid, 12, 80], [transform_xy, polar_to_xy])$
885 @image{figures/plotting23,8cm}
888 Plot of a sphere using the transformation from spherical to rectangular
889 coordinates. Option @mref{same_xyz} is used to get the three axes
890 scaled in the same proportion. When transformations are used, it is not
891 convenient to eliminate the mesh lines, because Gnuplot will not show the
895 @c plot3d ( 5, [theta,0,%pi], [phi,0,2*%pi], same_xyz, nolegend,
896 @c [transform_xy, spherical_to_xyz], [mesh_lines_color,blue],
897 @c [palette,[gradient,"#1b1b4e", "#8c8cf8"]])$
901 (%i1) plot3d ( 5, [theta,0,%pi], [phi,0,2*%pi], same_xyz, nolegend,
902 [transform_xy, spherical_to_xyz], [mesh_lines_color,blue],
903 [palette,[gradient,"#1b1b4e", "#8c8cf8"]])$
908 @image{figures/plotting24,8cm}
911 Definition of a function of two-variables using a matrix. Notice the
912 single quote in the definition of the function, to prevent @code{plot3d}
913 from failing when it realizes that the matrix will require integer
917 @c M: matrix([1,2,3,4], [1,2,3,2], [1,2,3,4], [1,2,3,3])$
918 @c f(x, y) := float('M [round(x), round(y)])$
919 @c plot3d (f(x,y), [x,1,4], [y,1,4], [grid,3,3], nolegend)$
922 (%i1) M: matrix([1,2,3,4], [1,2,3,2], [1,2,3,4], [1,2,3,3])$
923 (%i2) f(x, y) := float('M [round(x), round(y)])$
924 (%i3) plot3d (f(x,y), [x,1,4], [y,1,4], [grid,3,3], nolegend)$
928 @image{figures/plotting25,8cm}
931 By setting the elevation equal to zero, a surface can be seen as a map
932 in which each color represents a different level.
935 @c plot3d (cos (-x^2 + y^3/4), [x,-4,4], [y,-4,4], [zlabel,""],
936 @c [mesh_lines_color,false], [elevation,0], [azimuth,0],
937 @c color_bar, [grid,80,80], noztics, [color_bar_tics,1])$
941 (%i1) plot3d (cos (-x^2 + y^3/4), [x,-4,4], [y,-4,4], [zlabel,""],
942 [mesh_lines_color,false], [elevation,0], [azimuth,0],
943 color_bar, [grid,80,80], noztics, [color_bar_tics,1])$
948 @image{figures/plotting26,8cm}
951 See also @mrefdot{Plotting Options}
953 @opencatbox{Categories:}
958 @c -----------------------------------------------------------------------------
959 @anchor{plot_options}
960 @defvr {System variable} plot_options
962 This option is being kept for compatibility with older versions, but its
963 use is deprecated. To set global plotting options, see their current
964 values or remove options, use @mrefcomma{set_plot_option}
965 @mref{get_plot_option} and @mrefdot{remove_plot_option}
967 @opencatbox{Categories:}
972 @c -----------------------------------------------------------------------------
973 @anchor{remove_plot_option}
974 @deffn {Function} remove_plot_option (@var{name})
976 Removes the default value of an option. The name of the option must be given.
978 See also @mrefcomma{set_plot_option} @mref{get_plot_option} and
979 @mref{Plotting Options}.
981 @opencatbox{Categories:}
985 @c -----------------------------------------------------------------------------
986 @anchor{set_plot_option}
987 @deffn {Function} set_plot_option (@var{option})
989 Accepts any of the options listed in the section Plotting Options, and
990 saves them for use in plotting commands. The values of the options set
991 in each plotting command will have precedence, but if those options are
992 not given, the default values set with this function will be used.
994 @code{set_plot_option} evaluates its argument and returns the complete
995 list of options (after modifying the option given). If called without
996 any arguments, it will simply show the list of current default options.
998 See also @mrefcomma{remove_plot_option} @mref{get_plot_option} and the section
1003 Modification of the @mref{grid} values.
1006 @c set_plot_option ([grid, 30, 40]);
1009 (%i1) set_plot_option ([grid, 30, 40]);
1010 (%o1) [[plot_format, gnuplot_pipes], [grid, 30, 40],
1011 [run_viewer, true], [axes, true], [nticks, 29], [adapt_depth, 5],
1012 [color, blue, red, green, magenta, black, cyan],
1013 [point_type, bullet, box, triangle, plus, times, asterisk],
1014 [palette, [gradient, green, cyan, blue, violet],
1015 [gradient, magenta, violet, blue, cyan, green, yellow, orange,
1016 red, brown, black]], [gnuplot_preamble, ], [gnuplot_term, default]]
1019 @opencatbox{Categories:}
1024 @c -----------------------------------------------------------------------------
1025 @anchor{spherical_to_xyz}
1026 @deffn {System function} spherical_to_xyz
1028 It can be given as value for the @mref{transform_xy} option of
1029 @mrefdot{plot3d} Its effect will be to interpret the two independent
1030 variables and the function in @code{plot3d} as the spherical coordinates
1031 of a point (first, the angle with the z axis, then the angle of the xy
1032 projection with the x axis and finally the distance from the origin) and
1033 transform them into x, y and z coordinates.
1035 @opencatbox{Categories:}
1040 @c -----------------------------------------------------------------------------
1041 @node Plotting Options, Gnuplot Options, Functions and Variables for Plotting, Plotting
1042 @section Plotting Options
1043 @c -----------------------------------------------------------------------------
1045 All options consist of a list starting with one of the keywords in this
1046 section, followed by one or more values. If the option appears inside
1047 one of the plotting commands, its value will be local for that
1048 command. It the option is given as argument to
1049 @mrefcomma{set_plot_option} its value will be global and used in all
1050 plots, unless it is overridden by a local value.
1052 Some of the options may have different effects in different plotting
1053 commands as it will be pointed out in the following list. The options
1054 that accept among their possible values true or false, can also be set
1055 to true by simply writing their names, and false by writing their names
1056 with the prefix no. For instance, typing @code{logx} as an option is
1057 equivalent to writing @code{[logx, true]} and @code{nobox} is equivalent
1058 to @code{[box, false]}. When just the name of the option is used for an
1059 option which cannot have a value @code{true}, it means that any value
1060 previously assigned to that option will be removed, leaving it to the
1061 graphic program to decide what to do.
1063 @c -----------------------------------------------------------------------------
1064 @anchor{adapt_depth}
1065 @defvr {Plot option} adapt_depth [adapt_depth, @var{integer}]
1066 Default value: @code{5}
1068 The maximum number of splittings used by the adaptive plotting routine
1069 of @mref{plot2d}; @var{integer} must be a non-negative integer. A value
1070 of zero means that adaptive plotting will not be used and the resulting
1071 plot will have 1+4*@var{nticks} points (see option @mref{nticks}). To
1072 have more control on the number of points and their positions, a list of
1073 points can be created and then plotted using the @code{discrete} method
1076 @opencatbox{Categories:}
1081 @c -----------------------------------------------------------------------------
1083 @defvr {Plot option} axes @
1084 [axes, @var{symbol}], axes, noaxes
1086 Default value: @code{true}
1088 Where @var{symbol} can be either @code{true}, @code{false}, @code{x},
1089 @code{y} or @code{solid}. If @code{false}, no axes are shown; if equal
1090 to @code{x} or @code{y} only the x or y axis will be shown; if it is
1091 equal to @code{true}, both axes will be shown and @code{solid} will show
1092 the two axes with a solid line, rather than the default broken
1093 line. This option does not have any effect in the 3 dimensional plots.
1094 The single keywords @code{axes} and @code{noaxes} can be used as
1095 synonyms for @code{[axes, true]} and @code{[axes, false]}.
1097 @opencatbox{Categories:}
1102 @c -----------------------------------------------------------------------------
1104 @defvr {Plot option} azimuth [azimuth, @var{number}]
1106 Default value: @code{30}
1108 A plot3d plot can be thought of as starting with the x and y axis in the
1109 horizontal and vertical axis, as in plot2d, and the z axis coming out of
1110 the screen. The z axis is then rotated around the x axis through an
1111 angle equal to @mref{elevation} and then the new xy plane is rotated
1112 around the new z axis through an angle @mrefdot{azimuth} This option sets
1113 the value for the azimuth, in degrees.
1115 See also @mrefdot{elevation}
1117 @opencatbox{Categories:}
1122 @c -----------------------------------------------------------------------------
1124 @defvr {Plot option} box [box, @var{symbol}], box, nobox
1126 Default value: @code{true}
1128 If set to @code{true}, a bounding box will be drawn for the plot; if set
1129 to @code{false}, no box will be drawn.
1130 The single keywords @code{box} and @code{nobox} can be used as
1131 synonyms for @code{[box, true]} and @code{[box, false]}.
1133 @opencatbox{Categories:}
1138 @c -----------------------------------------------------------------------------
1140 @defvr {Plot option} color [color, @var{color_1}, @dots{}, @var{color_n}]
1142 In 2d plots it defines the color (or colors) for the various curves. In
1143 @mrefcomma{plot3d} it defines the colors used for the mesh lines of the
1144 surfaces, when no palette is being used.
1146 If there are more curves or surfaces than colors, the colors will be
1147 repeated in sequence. The valid colors are @code{red}, @code{green},
1148 @code{blue}, @code{magenta}, @code{cyan}, @code{yellow}, @code{orange},
1149 @code{violet}, @code{brown}, @code{gray}, @code{black}, @code{white}, or
1150 a string starting with the character # and followed by six hexadecimal
1151 digits: two for the red component, two for green component and two for
1152 the blue component. If the name of a given color is unknown color, black
1153 will be used instead.
1155 @opencatbox{Categories:}
1160 @c -----------------------------------------------------------------------------
1162 @defvr {Plot option} color_bar [color_bar, @var{symbol}], color_bar, @
1165 Default value: @code{false} in plot3d, @code{true} in mandelbrot and julia
1167 Where @var{symbol} can be either @code{true} or @code{false}. If
1168 @code{true}, whenever @mrefcomma{plot3d} @mref{mandelbrot} or
1169 @mref{julia} use a palette to represent different values, a box will be
1170 shown on the right, showing the corresponding between colors and values.
1171 The single keywords @code{color_bar} and @code{nocolor_bar} can be used
1172 as synonyms for @code{[color_bar, true]} and @code{[color_bar, false]}.
1174 @opencatbox{Categories:}
1179 @c -----------------------------------------------------------------------------
1180 @anchor{color_bar_tics}
1181 @defvr {Plot option} color_bar_tics [color_bar_tics, @var{x1}, @var{x2}, @
1182 @var{x3}], color_bar_tics, nocolor_bar_tics
1184 Defines the values at which a mark and a number will be placed in the
1185 color bar. The first number is the initial value, the second the
1186 increments and the third is the last value where a mark is placed. The
1187 second and third numbers can be omitted. When only one number is given,
1188 it will be used as the increment from an initial value that will be
1189 chosen automatically. The single keyword @code{color_bar_tics} removes a
1190 value given previously, making the graphic program use its default for
1191 the values of the tics and @code{nocolor_bar_tics} will not show any
1192 tics on the color bar.
1194 @opencatbox{Categories:}
1199 @c -----------------------------------------------------------------------------
1201 @defvr {Plot option} elevation [elevation, @var{number}]
1203 Default value: @code{60}
1205 A plot3d plot can be thought of as starting with the x and y axis in the
1206 horizontal and vertical axis, as in plot2d, and the z axis coming out of
1207 the screen. The z axis is then rotated around the x axis through an
1208 angle equal to @mref{elevation} and then the new xy plane is rotated
1209 around the new z axis through an angle @mrefdot{azimuth} This option sets
1210 the value for the elevation, in degrees.
1212 See also @mrefdot{azimuth}
1214 @opencatbox{Categories:}
1219 @c -----------------------------------------------------------------------------
1221 @defvr {Plot option} grid [grid, @var{integer}, @var{integer}]
1222 Default value: @code{30}, @code{30}
1224 Sets the number of grid points to use in the x- and y-directions for
1225 three-dimensional plotting or for the @mref{julia} and @mref{mandelbrot}
1228 For a way to actually draw a grid See @mrefdot{grid2d}
1230 @opencatbox{Categories:}
1235 @c -----------------------------------------------------------------------------
1237 @defvr {Plot option} grid2d [grid2d, @var{value}], grid2d, nogrid2d
1239 Default value: @code{false}
1241 Shows a grid of lines on the xy plane. The points where the grid lines
1242 are placed are the same points where tics are marked in the x and y
1243 axes, which can be controlled with the @mref{xtics} and @mref{ytics}
1244 options. The single keywords @code{grid2d} and @code{nogrid2d} can be
1245 used as synonyms for @code{[grid2d, true]} and @code{[grid2d, false]}.
1247 See also @mrefdot{grid}
1249 @opencatbox{Categories:}
1254 @c -----------------------------------------------------------------------------
1256 @defvr {Plot option} iterations [iterations, @var{value}]
1258 Default value: @code{9}
1260 Number of iterations made by the programs mandelbrot and julia.
1262 @opencatbox{Categories:}
1267 @c -----------------------------------------------------------------------------
1269 @defvr {Plot option} label [label, [@var{string}, @var{x}, @var{y}], @dots{}]
1271 Writes one or several labels in the points with @var{x}, @var{y}
1272 coordinates indicated after each label.
1274 @opencatbox{Categories:}
1279 @c -----------------------------------------------------------------------------
1281 @defvr {Plot option} legend [legend, @var{string_1}, @dots{}, @
1282 @var{string_n}], legend, nolegend
1284 It specifies the labels for the plots when various plots are shown. If
1285 there are more plots than the number of labels given, they will be
1286 repeated. If given the value @code{false}, no legends will be shown.
1287 By default, the names of the expressions or functions will be used, or
1288 the words discrete1, discrete2, @dots{}, for discrete sets of points.
1289 The single keyword @code{legend} removes any previously defined legends,
1290 leaving it to the plotting program to set up a legend. The keyword
1291 @code{nolegend} is a synonym for @code{[legend, false]}.
1293 @opencatbox{Categories:}
1298 @c -----------------------------------------------------------------------------
1300 @defvr {Plot option} levels [levels, @var{number}, @dots{}]
1302 This option is used by @mref{plot2d} to do contour plots. If only one
1303 number is given after the keyword @code{levels}, it must be a natural
1304 number; @code{plot2d} will try to plot that number of contours with
1305 values between the minimum and maximum value of the expression given,
1306 with the form d*10^n, where d is either 1, 2 or 5. Since not always it will
1307 be possible to find that number of levels in that interval, the number of
1308 contour lines show will be smaller than the number specified by this
1311 If more than one number are given after the keyword @code{levels},
1312 @mrefdot{plot2d} will show the contour lines corresponding to those
1313 values of the expression plotted, if they exist within the domain used.
1315 @opencatbox{Categories:}
1320 @c -----------------------------------------------------------------------------
1322 @defvr {Plot option} logx [logx, @var{value}], logx, nologx
1324 Default value: @code{false}
1326 Makes the horizontal axes to be scaled logarithmically. It can be either
1327 true or false. The single keywords @code{logx} and @code{nologx} can be
1328 used as synonyms for @code{[logx, true]} and @code{[logx, false]}.
1330 @opencatbox{Categories:}
1335 @c -----------------------------------------------------------------------------
1337 @defvr {Plot option} logy [logy, @var{value}], logy, nology
1339 Default value: @code{false}
1341 Makes the vertical axes to be scaled logarithmically. It can be either
1343 The single keywords @code{logy} and @code{nology} can be used as
1344 synonyms for @code{[logy, true]} and @code{[logy, false]}.
1346 @opencatbox{Categories:}
1351 @c -----------------------------------------------------------------------------
1352 @anchor{mesh_lines_color}
1353 @defvr {Plot option} mesh_lines_color [mesh_lines_color, @var{color}], @
1354 mesh_lines_color, no_mesh_lines
1356 Default value: @code{black}
1358 It sets the color used by plot3d to draw the mesh lines, when a palette
1359 is being used. It accepts the same colors as for the option
1360 @mref{color}@w{} (see the list of allowed colors in @mref{color}). It
1361 can also be given a value @code{false} to eliminate completely the mesh
1362 lines. The single keyword @code{mesh_lines_color} removes any previously
1363 defined colors, leaving it to the graphic program to decide what color
1364 to use. The keyword @code{no_mesh_lines} is a synonym for
1365 @code{[mesh_lines_color, false]}
1367 @opencatbox{Categories:}
1372 @c -----------------------------------------------------------------------------
1374 @defvr {Plot option} nticks [nticks, @var{integer}]
1376 Default value: @code{29}
1378 When plotting functions with @mrefcomma{plot2d} it is gives the initial
1379 number of points used by the adaptive plotting routine for plotting
1380 functions. When plotting parametric functions with @mrefcomma{plot3d}
1381 it sets the number of points that will be shown for the plot.
1383 @opencatbox{Categories:}
1388 @c -----------------------------------------------------------------------------
1390 @defvr {Plot option} palette @
1391 [palette, [@var{palette_1}], @dots{}, [@var{palette_n}]], palette, nopalette
1393 It can consist of one palette or a list of several palettes. Each
1394 palette is a list with a keyword followed by values. If the keyword is
1395 gradient, it should be followed by a list of valid colors.
1397 If the keyword is hue, saturation or value, it must be followed by 4
1398 numbers. The first three numbers, which must be between 0 and 1, define
1399 the hue, saturation and value of a basic color to be assigned to the
1400 minimum value of z. The keyword specifies which of the three attributes
1401 (hue, saturation or value) will be increased according to the values of
1402 z. The last number indicates the increase corresponding to the maximum
1403 value of z. That last number can be bigger than 1 or negative; the
1404 corresponding values of the modified attribute will be rounded modulo 1.
1406 Gnuplot only uses the first palette in the list; xmaxima will use the
1407 palettes in the list sequentially, when several surfaces are plotted
1408 together; if the number of palettes is exhausted, they will be repeated
1411 The color of the mesh lines will be given by the option
1412 @mrefdot{mesh_lines_color} If @code{palette} is given the value
1413 @code{false}, the surfaces will not be shaded but represented with a
1414 mesh of curves only. In that case, the colors of the lines will be
1415 determined by the option @mrefdot{color}
1417 The single keyword @code{palette} removes any palette previously
1418 defined, leaving it to the graphic program to decide the palette to use
1419 and @code{nopalette} is a synonym for @code{[palette, false]}.
1421 @opencatbox{Categories:}
1426 @c -----------------------------------------------------------------------------
1427 @anchor{plotepsilon}
1428 @defvr {Plot option} plotepsilon [plotepsilon, @var{value}]
1432 This value is used by @mref{plot2d} when plotting implicit functions or
1433 contour lines. When plotting an explicit function @code{expr_1=expr_2},
1434 it is converted into @code{expr_1-expr_2} and the points where that equals
1435 zero are searched. When a contour line for @code{expr} equal to some value
1436 is going to be plotted, the points where @code{expr} minus that value
1437 are equal to zero are searched. The search is done by computing those
1438 expressions at a grid of points (see @mref{sample}). If at one of the
1439 points in that grid the absolute value of the expression is less than
1440 the value of @code{plotepsilon}, it will be assumed to be zero, and
1441 therefore, as being part of the curve to be plotted.
1443 @opencatbox{Categories:}
1448 @c -----------------------------------------------------------------------------
1449 @anchor{plot_format}
1450 @defvr {Plot option} plot_format [plot_format, @var{format}]
1452 Default value: @code{gnuplot}, in Windows systems, or @code{gnuplot_pipes} in
1455 Where @var{format} is one of the following: gnuplot, xmaxima, mgnuplot,
1456 gnuplot_pipes or geomview.
1458 It sets the format to be used for plotting as explained in
1459 @mrefdot{Plotting Formats}
1461 @opencatbox{Categories:}
1466 @c -----------------------------------------------------------------------------
1467 @anchor{plot_real_part}
1468 @defvr {Plot option} plot_realpart [plot_realpart, @var{symbol}], @
1469 plot_realpart, noplot_realpart
1471 Default value: @code{false}
1473 If set to @code{true}, the functions to be plotted will be considered as
1474 complex functions whose real value should be plotted; this is equivalent
1475 to plotting @code{realpart(@var{function})}. If set to @code{false},
1476 nothing will be plotted when the function does not give a real value.
1477 For instance, when @code{x} is negative, @code{log(x)} gives a complex
1478 value, with real value equal to @code{log(abs(x))}; if
1479 @code{plot_realpart} were @code{true}, @code{log(-5)} would be plotted
1480 as @code{log(5)}, while nothing would be plotted if @code{plot_realpart}
1481 were @code{false}. The single keyword @code{plot_realpart} can be used
1482 as a synonym for @code{[plot_realpart, true]} and @code{noplot_realpart}
1483 is a synonym for @code{[plot_realpart, false]}.
1485 @opencatbox{Categories:}
1490 @c -----------------------------------------------------------------------------
1492 @defvr {Plot option} point_type [point_type, @var{type_1}, @dots{}, @
1495 In gnuplot, each set of points to be plotted with the style ``points''
1496 or ``linespoints'' will be represented with objects taken from this
1497 list, in sequential order. If there are more sets of points than objects
1498 in this list, they will be repeated sequentially.
1499 The possible objects that can be used are: @code{bullet}, @code{circle},
1500 @code{plus}, @code{times}, @code{asterisk}, @code{box}, @code{square},
1501 @code{triangle}, @code{delta}, @code{wedge}, @code{nabla}, @code{diamond},
1504 @opencatbox{Categories:}
1509 @c -----------------------------------------------------------------------------
1511 @defvr {Plot option} pdf_file [pdf_file, @var{file_name}]
1513 Saves the plot into a PDF file with name equal to @var{file_name},
1514 rather than showing it in the screen. By default, the file will be
1515 created in the directory defined by the variable
1516 @mrefcomma{maxima_tempdir} unless @var{file_name} contains the character
1517 ``/'', in which case it will be assumed to contain the complete path where
1518 the file should be created. The value of @mref{maxima_tempdir} can be changed
1519 to save the file in a different directory. When the option
1520 @mref{gnuplot_pdf_term_command} is also given, it will be used to set up
1521 Gnuplot's PDF terminal; otherwise, Gnuplot's pdfcairo terminal
1522 will be used with solid colored lines of width 3, plot
1523 size of 17.2 cm by 12.9 cm and font of 18 points.
1525 @opencatbox{Categories:}
1530 @c -----------------------------------------------------------------------------
1532 @defvr {Plot option} png_file [png_file, @var{file_name}]
1534 Saves the plot into a PNG graphics file with name equal to @var{file_name},
1535 rather than showing it in the screen. By default, the file will be
1536 created in the directory defined by the variable
1537 @mrefcomma{maxima_tempdir} unless @var{file_name} contains the character
1538 ``/'', in which case it will be assumed to contain the complete path where
1539 the file should be created. The value of @mref{maxima_tempdir} can be changed
1540 to save the file in a different directory. When the option
1541 @mref{gnuplot_png_term_command} is also given, it will be used to set up
1542 Gnuplot's PNG terminal; otherwise, Gnuplot's pngcairo terminal
1543 will be used, with a font of size 12.
1545 @opencatbox{Categories:}
1550 @c -----------------------------------------------------------------------------
1552 @defvr {Plot option} ps_file [ps_file, @var{file_name}]
1554 Saves the plot into a Postscript file with name equal to @var{file_name},
1555 rather than showing it in the screen. By default, the file will be
1556 created in the directory defined by the variable
1557 @mrefcomma{maxima_tempdir} unless @var{file_name} contains the character
1558 ``/'', in which case it will be assumed to contain the complete path where
1559 the file should be created. The value of @mref{maxima_tempdir} can be changed
1560 to save the file in a different directory. When the option
1561 @mref{gnuplot_ps_term_command} is also given, it will be used to set up
1562 Gnuplot's Postscript terminal; otherwise, Gnuplot's postscript terminal
1563 will be used with the EPS option, solid colored lines of width 2, plot
1564 size of 16.4 cm by 12.3 cm and font of 24 points.
1566 @opencatbox{Categories:}
1571 @c -----------------------------------------------------------------------------
1573 @defvr {Plot option} run_viewer [run_viewer, @var{symbol}], run_viewer, @
1576 Default value: @code{true}
1578 This option is only used when the plot format is @code{gnuplot} and the
1579 terminal is @code{default} or when the Gnuplot terminal is set to
1580 @code{dumb} (see @mref{gnuplot_term}) and can have a true or false
1583 If the terminal is @code{default}, a file @code{maxout_xxx.gnuplot} (or
1584 other name specified with @mref{gnuplot_out_file}) is created with the
1585 gnuplot commands necessary to generate the plot. Option @code{run_viewer}
1586 controls whether or not Gnuplot will be launched to execute those
1587 commands and show the plot.
1589 If the terminal is @code{default}, gnuplot is run to execute the
1590 commands in @code{maxout_xxx.gnuplot}, producing another file
1591 @code{maxplot.txt} (or other name specified with
1592 @mref{gnuplot_out_file}). Option @code{run_viewer} controls whether or
1593 not that file, with an ASCII representation of the plot, will be shown
1594 in the Maxima or Xmaxima console.
1596 Its default value, true, makes the plots appear in either the console or
1597 a separate graphics window. @code{run_viewer} and @code{norun_viewer}
1598 are synonyms for @code{[run_viewer, true]} and @code{[run_viewer,
1601 @opencatbox{Categories:}
1606 @c -----------------------------------------------------------------------------
1608 @defvr {Plot option} same_xy [same_xy , @var{value}], same_xy, nosame_xy
1610 It can be either true or false. If true, the scales used in the x and y
1611 axes will be the same, in either 2d or 3d plots. See also
1612 @mrefdot{yx_ratio} @code{same_xy} and @code{nosame_xy} are synonyms for
1613 @code{[same_xy, true]} and @code{[same_xy, false]}.
1615 @opencatbox{Categories:}
1620 @c -----------------------------------------------------------------------------
1622 @defvr {Plot option} same_xyz [same_xyz , @var{value}], same_xyz, nosame_xyz
1624 It can be either true or false. If true, the scales used in the 3 axes
1625 of a 3d plot will be the same. @code{same_xyz} and @code{nosame_xyz} are
1626 synonyms for @code{[same_xyz, true]} and @code{[same_xyz, false]}.
1628 @opencatbox{Categories:}
1633 @c -----------------------------------------------------------------------------
1635 @defvr {Plot option} sample [sample, @var{nx}, @var{ny}]
1637 Default value: @code{[sample, 47, 47]}
1639 @var{nx} and @var{ny} must be two natural numbers that will be used by
1640 @mref{plot2d} to look for the points that make part of the plot of an
1641 implicit function or a contour line. The domain is divided into @var{nx}
1642 intervals in the horizontal axis and @var{ny} intervals in the vertical
1643 axis and the numerical value of the expression is computed at the
1644 borders of those intervals. Higher values of @var{nx} and @var{ny} will
1645 give smoother curves, but will increase the time needed to trace the
1646 plot. When there are critical points in the plot where the curve changes
1647 direction, to get better results it is more important to try to make
1648 those points to be at the border of the intervals, rather than
1649 increasing @var{nx} and @var{ny}.
1651 @opencatbox{Categories:}
1656 @c -----------------------------------------------------------------------------
1658 @defvr {Plot option} style @
1659 [style, @var{type_1}, @dots{}, @var{type_n}], @
1660 [style, [@var{style_1}], @dots{}, [@var{style_n}]]
1662 The styles that will be used for the various functions or sets of data
1663 in a 2d plot. The word @var{style} must be followed by one or more
1664 styles. If there are more functions and data sets than the styles
1665 given, the styles will be repeated. Each style can be either
1666 @var{lines} for line segments, @var{points} for isolated points,
1667 @var{linespoints} for segments and points, or @var{dots} for small
1668 isolated dots. Gnuplot accepts also an @var{impulses} style.
1670 Each of the styles can be enclosed inside a list with some additional
1671 parameters. @var{lines} accepts one or two numbers: the width of the
1672 line and an integer that identifies a color. The default color codes
1673 are: 1: blue, 2: red, 3: magenta, 4: orange, 5: brown, 6: lime and 7:
1674 aqua. If you use Gnuplot with a terminal different than X11,
1675 those colors might be different; for example, if you use the option
1676 [@var{gnuplot_term}, @var{ps}], color index 4 will correspond to black,
1679 @var{points} accepts one, two, or three parameters; the first parameter
1680 is the radius of the points, the second parameter is an integer that
1681 selects the color, using the same code used for @var{lines} and the
1682 third parameter is currently used only by Gnuplot and it corresponds
1683 to several objects instead of points. The default types of
1684 objects are: 1: filled circles, 2: open circles, 3: plus signs, 4: x,
1685 5: *, 6: filled squares, 7: open squares, 8: filled triangles, 9: open
1686 triangles, 10: filled inverted triangles, 11: open inverted triangles,
1687 12: filled lozenges and 13: open lozenges.
1689 @var{linespoints} accepts up to five parameters: line width, points
1690 radius, color, type of object to replace the points, and the gnuplot
1691 pointinterval option to control space between points.
1693 See also @mref{color} and @mrefdot{point_type}
1695 @opencatbox{Categories:}
1700 @c -----------------------------------------------------------------------------
1702 @defvr {Plot option} svg_file [svg_file, @var{file_name}]
1704 Saves the plot into an SVG file with name equal to @var{file_name},
1705 rather than showing it in the screen. By default, the file will be
1706 created in the directory defined by the variable
1707 @mrefcomma{maxima_tempdir} unless @var{file_name} contains the character
1708 ``/'', in which case it will be assumed to contain the complete path where
1709 the file should be created. The value of @mref{maxima_tempdir} can be changed
1710 to save the file in a different directory. When the option
1711 @mref{gnuplot_svg_term_command} is also given, it will be used to set up
1712 Gnuplot's SVG terminal; otherwise, Gnuplot's svg terminal
1713 will be used with font of 14 points.
1715 @opencatbox{Categories:}
1720 @c -----------------------------------------------------------------------------
1722 @defvr {Plot option} t [t, @var{min}, @var{max}]
1724 Default range for parametric plots.
1726 @opencatbox{Categories:}
1731 @c -----------------------------------------------------------------------------
1733 @defvr {Plot option} title [title, @var{text}]
1735 Defines a title that will be written at the top of the plot.
1737 @opencatbox{Categories:}
1742 @c -----------------------------------------------------------------------------
1743 @anchor{transform_xy}
1744 @defvr {Plot option} transform_xy [transform_xy, @var{symbol}], notransform_xy
1746 Where @var{symbol} is either @code{false} or the result obtained by
1747 using the function @code{transform_xy}. If different from @code{false},
1748 it will be used to transform the 3 coordinates in
1749 plot3d. @code{notransform_xy} removes any transformation function
1752 See @mrefcomma{make_transform} @mref{polar_to_xy} and
1753 @mrefdot{spherical_to_xyz}
1755 @opencatbox{Categories:}
1760 @c -----------------------------------------------------------------------------
1762 @defvr {Plot option} window [window, @var{n}]
1764 Opens the plot in window number @var{n}, instead of the default window
1765 0. If window number @var{n} is already opened, the plot in that window
1766 will be replaced by the current plot.
1768 @opencatbox{Categories:}
1774 @c -----------------------------------------------------------------------------
1776 @defvr {Plot option} x [x, @var{min}, @var{max}]
1778 When used as the first option in a @mref{plot2d} command (or any of the
1779 first two in @mref{plot3d}), it indicates that the first independent variable
1780 is x and it sets its range. It can also be used again after the first
1781 option (or after the second option in plot3d) to define the effective
1782 horizontal domain that will be shown in the plot.
1784 @opencatbox{Categories:}
1789 @c -----------------------------------------------------------------------------
1791 @defvr {Plot option} xlabel [xlabel, @var{string}]
1793 Specifies the @var{string} that will label the first axis; if this
1794 option is not used, that label will be the name of the independent
1795 variable, when plotting functions with @mref{plot2d} the name of the
1796 first variable, when plotting surfaces with @mref{plot3d}, or the first
1797 expression in the case of a parametric plot.
1799 @opencatbox{Categories:}
1804 @c -----------------------------------------------------------------------------
1806 @defvr {Plot option} xtics [xtics, @var{x1}, @var{x2}, @var{x3}], @
1807 [xtics, @code{false}], xtics, noxtics
1809 Defines the values at which a mark and a number will be placed in the x
1810 axis. The first number is the initial value, the second the increments
1811 and the third is the last value where a mark is placed. The second and
1812 third numbers can be omitted, in which case the first number is the
1813 increment from an initial value that will be chosen by the graphic
1814 program. If @code{[xtics, false]} is used, no marks or numbers will be
1815 shown along the x axis.
1817 The single keyword @code{xtics} removes any values previously
1818 defined, leaving it to the graphic program to decide the values to use
1819 and @code{noxtics} is a synonym for @code{[xtics, false]}
1821 @opencatbox{Categories:}
1826 @c -----------------------------------------------------------------------------
1828 @defvr {Plot option} xy_scale [xy_scale, @var{sx}, @var{sy}]
1830 In a 2d plot, it defines the ratio of the total size of the Window to
1831 the size that will be used for the plot. The two numbers given as
1832 arguments are the scale factors for the x and y axes.
1834 This option does not change the size of the graphic window or the placement
1835 of the graph in the window. If you want to change the aspect ratio of the
1836 plot, it is better to use option @mrefdot{yx_ratio} For instance,
1837 @code{[yx_ratio, 10]} instead of @code{[xy_scale, 0.1, 1]}.
1839 @opencatbox{Categories:}
1844 @c -----------------------------------------------------------------------------
1846 @defvr {Plot option} y [y, @var{min}, @var{max}]
1848 When used as one of the first two options in @mrefcomma{plot3d} it indicates
1849 that one of the independent variables is y and it sets its range. Otherwise,
1850 it defines the effective domain of the second variable that will be
1853 @opencatbox{Categories:}
1858 @c -----------------------------------------------------------------------------
1860 @defvr {Plot option} ylabel [ylabel, @var{string}]
1862 Specifies the @var{string} that will label the second axis; if this
1863 option is not used, that label will be ``y'', when plotting explicit
1864 functions with @mref{plot2d}, or the name of the second variable, when
1865 plotting surfaces with @mref{plot3d}, or the second expression in the
1866 case of a parametric plot.
1868 @opencatbox{Categories:}
1873 @c -----------------------------------------------------------------------------
1875 @defvr {Plot option} ytics [ytics, @var{y1}, @var{y2}, @var{y3}], @
1876 [ytics, @code{false}], ytics, noytics
1878 Defines the values at which a mark and a number will be placed in the y
1879 axis. The first number is the initial value, the second the increments
1880 and the third is the last value where a mark is placed. The second and
1881 third numbers can be omitted, in which case the first number is the
1882 increment from an initial value that will be chosen by the graphic
1883 program. If @code{[ytics, false]} is used, no marks or numbers will be
1884 shown along the y axis.
1886 The single keyword @code{ytics} removes any values previously
1887 defined, leaving it to the graphic program to decide the values to use
1888 and @code{noytics} is a synonym for @code{[ytics, false]}
1890 @opencatbox{Categories:}
1895 @c -----------------------------------------------------------------------------
1897 @defvr {Plot option} yx_ratio [yx_ratio, @var{r}]
1899 In a 2d plot, the ratio between the vertical and the horizontal sides of
1900 the rectangle used to make the plot. See also @mrefdot{same_xy}
1902 @opencatbox{Categories:}
1907 @c -----------------------------------------------------------------------------
1909 @defvr {Plot option} z [z, @var{min}, @var{max}]
1911 Used in @mref{plot3d} to set the effective range of values of z that will be
1914 @opencatbox{Categories:}
1919 @c -----------------------------------------------------------------------------
1921 @defvr {Plot option} zlabel [zlabel, @var{string}]
1923 Specifies the @var{string} that will label the third axis, when using
1924 @mrefdot{plot3d} If this option is not used, that label will be ``z'', when
1925 plotting surfaces, or the third expression in the case of a parametric
1926 plot. It can not be used with @mref{set_plot_option} and it will be
1927 ignored by @mrefdot{plot2d}
1929 @opencatbox{Categories:}
1934 @c -----------------------------------------------------------------------------
1936 @defvr {Plot option} zmin [zmin, @var{z}], zmin
1938 In 3d plots, the value of z that will be at the bottom of the plot box.
1940 The single keyword @code{zmin} removes any value previously
1941 defined, leaving it to the graphic program to decide the value to use.
1943 @opencatbox{Categories:}
1948 @c -----------------------------------------------------------------------------
1950 @defvr {Plot option} ztics [ztics, @var{z1}, @var{z2}, @var{z3}], @
1951 [ztics, @code{false}], ztics, noztics
1953 Defines the values at which a mark and a number will be placed in the z
1954 axis. The first number is the initial value, the second the increments
1955 and the third is the last value where a mark is placed. The second and
1956 third numbers can be omitted, in which case the first number is the
1957 increment from an initial value that will be chosen by the graphic
1958 program. If @code{[ztics, false]} is used, no marks or numbers will be
1959 shown along the z axis.
1961 The single keyword @code{ztics} removes any values previously
1962 defined, leaving it to the graphic program to decide the values to use
1963 and @code{noztics} is a synonym for @code{[ztics, false]}
1965 @opencatbox{Categories:}
1970 @c -----------------------------------------------------------------------------
1971 @node Gnuplot Options, Gnuplot_pipes Format Functions, Plotting Options, Plotting
1972 @section Gnuplot Options
1973 @c -----------------------------------------------------------------------------
1975 There are several plot options specific to gnuplot. All of them consist
1976 of a keyword (the name of the option), followed by a string that should
1977 be a valid gnuplot command, to be passed directly to gnuplot. In most
1978 cases, there exist a corresponding plotting option that will produce a
1979 similar result and whose use is more recommended than the gnuplot
1982 @c -----------------------------------------------------------------------------
1983 @anchor{gnuplot_term}
1984 @defvr {Plot option} gnuplot_term [gnuplot_term, @var{terminal_name}]
1986 Sets the output terminal type for gnuplot. The argument @var{terminal_name}
1987 can be a string or one of the following 3 special symbols
1990 @strong{default} (default value)
1992 Gnuplot output is displayed in a separate graphical window and the
1993 gnuplot terminal used will be specified by the value of the option
1994 @mrefdot{gnuplot_default_term_command}
1999 Gnuplot output is saved to a file @code{maxout_xxx.gnuplot} using "ASCII
2000 art" approximation to graphics. If the option @mref{gnuplot_out_file} is
2001 set to @var{filename}, the plot will be saved there, instead of the
2002 default @code{maxout_xxx.gnuplot}. The settings for the ``dumb'' terminal of
2003 Gnuplot are given by the value of option
2004 @mrefdot{gnuplot_dumb_term_command} If option @mref{run_viewer} is set
2005 to true and the plot_format is @code{gnuplot} that ASCII representation
2006 will also be shown in the Maxima or Xmaxima console.
2011 Gnuplot generates commands in the PostScript page description language.
2012 If the option @mref{gnuplot_out_file} is set to @var{filename}, gnuplot
2013 writes the PostScript commands to @var{filename}. Otherwise, it is
2014 saved as @code{maxplot.ps} file. The settings for this terminal are given by the value of the option @mrefdot{gnuplot_dumb_term_command}
2017 A string representing any valid gnuplot term specification
2019 Gnuplot can generate output in many other graphical formats such as png,
2020 jpeg, svg etc. To use those formats, option @code{gnuplot_term} can be
2021 set to any supported gnuplot term name (which must be a symbol) or even a
2022 full gnuplot term specification with any valid options (which must be a string). For
2023 example @code{[gnuplot_term, png]} creates output in PNG (Portable
2024 Network Graphics) format while @code{[gnuplot_term, "png size
2025 1000,1000"]} creates PNG of 1000 x 1000 pixels size. If the option
2026 @mref{gnuplot_out_file} is set to @var{filename}, gnuplot writes the
2027 output to @var{filename}. Otherwise, it is saved as
2028 @code{maxplot.@var{term}} file, where @var{term} is gnuplot terminal
2032 @opencatbox{Categories:}
2037 @c -----------------------------------------------------------------------------
2038 @anchor{gnuplot_out_file}
2039 @defvr {Plot option} gnuplot_out_file [gnuplot_out_file, @var{file_name}]
2041 It can be used to replace the default name for the file that contains
2042 the commands that will interpreted by gnuplot, when the terminal is set
2043 to @code{default}, or to replace the default name of the graphic file
2044 that gnuplot creates, when the terminal is different from
2045 @code{default}. If it contains one or more slashes, ``/'', the name of
2046 the file will be left as it is; otherwise, it will be appended to the
2047 path of the temporary directory. The complete name of the files created
2048 by the plotting commands is always sent as output of those commands so
2049 they can be seen if the command is ended by semi-colon.
2051 When used in conjunction with the @mref{gnuplot_term} option, it can be
2052 used to save the plot in a file, in one of the graphic formats supported
2053 by Gnuplot. To create PNG, PDF, Postscript or SVG, it is easier to use
2054 options @mrefcomma{png_file} @mrefcomma{pdf_file} @mrefcomma{ps_file}
2055 or @mrefdot{svg_file}
2057 @opencatbox{Categories:}
2062 @c -----------------------------------------------------------------------------
2063 @anchor{gnuplot_script_file}
2064 @defvr {Plot option} gnuplot_script_file [gnuplot_script_file, @var{file_name_or_function}]
2066 Creates a plot with @code{plot2d}, @code{plot3d}, @code{mandelbrot} or
2067 @code{julia} using the @code{gnuplot} @mref{plot_format} and saving
2068 the script sent to Gnuplot in the file specified by @var{file_name_or_function}.
2069 The value @var{file_name_or_function} can be a string or a Maxima function of
2070 one variable that returns a string. If that string corresponds to a
2071 complete file path (directory and file name), the script will be created in
2072 that file and will not be deleted after Maxima is closed; otherwise, the
2073 string will give the name of a file to be created in the temporary directory
2074 and deleted when Maxima is closed.
2076 In this example, the script file name is set to ``sin.gnuplot'', in the
2080 (%i1) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, "./sin.gnuplot"]);
2082 (%o1) ["./sin.gnuplot"]
2085 In this example, @code{gnuplot_maxout_prt(@var{file})} is a function
2086 that takes the default file name, @var{file}. It constructs a full file
2087 name for the data file by interpolating a random 8-digit integer with a
2088 pad of zeros into the default file name (``maxout'' followed by the id
2089 number of the Maxima process, followed by ``.gnuplot''). The temporary
2090 directory is determined by @mref{maxima_tempdir} (it is ``/tmp'' in this
2094 (%i1) gnuplot_maxout_prt(file) := block([beg,end],
2095 [beg,end] : split(file,"."),
2096 printf(false,"~a_~8,'0d.~a",beg,random(10^8-1),end)) $
2098 (%i2) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, gnuplot_maxout_prt]);
2100 (%o2) ["/tmp/maxout68715_09606909.gnuplot"]
2103 By default, the script would have been saved in a file named
2104 @code{maxoutXXXXX.gnuplot} (XXXXX=68715 in this example) in the temporary
2105 directory. If the print statement in function @code{gnuplot_maxout_prt}
2106 above included a directory path, the file would have been saved in that
2107 directory rather than in the temporary directory.
2109 @opencatbox{Categories:}
2114 @c -----------------------------------------------------------------------------
2115 @anchor{gnuplot_pm3d}
2116 @defvr {Plot option} gnuplot_pm3d [gnuplot_pm3d, @var{value}]
2118 With a value of @code{false}, it can be used to disable the use of PM3D
2119 mode, which is enabled by default.
2121 @opencatbox{Categories:}
2126 @c -----------------------------------------------------------------------------
2127 @anchor{gnuplot_preamble}
2128 @defvr {Plot option} gnuplot_preamble [gnuplot_preamble, @var{string}]
2130 This option inserts gnuplot commands before any other commands sent to
2131 Gnuplot. Any valid gnuplot commands may be used. Multiple commands should
2132 be separated with a semi-colon. See also @mrefdot{gnuplot_postamble}
2134 @opencatbox{Categories:}
2139 @c -----------------------------------------------------------------------------
2140 @anchor{gnuplot_postamble}
2141 @defvr {Plot option} gnuplot_postamble [gnuplot_postamble, @var{string}]
2143 This option inserts gnuplot commands after other commands sent to
2144 Gnuplot and right before the plot command is sent. Any valid gnuplot
2145 commands may be used. Multiple commands should be separated with a
2146 semi-colon. See also @mrefdot{gnuplot_preamble}
2148 @opencatbox{Categories:}
2153 @c -----------------------------------------------------------------------------
2154 @anchor{gnuplot_default_term_command}
2155 @defvr {Plot option} gnuplot_default_term_command
2156 [gnuplot_default_term_command, @var{command}]
2158 The gnuplot command to set the terminal type for the default
2159 terminal. It this option is not set, the command used will be: @code{"set term wxt size 640,480 font \",12\"; set term pop"}.
2161 @opencatbox{Categories:}
2166 @c -----------------------------------------------------------------------------
2167 @anchor{gnuplot_dumb_term_command}
2168 @defvr {Plot option} gnuplot_dumb_term_command
2169 [gnuplot_dumb_term_command, @var{command}]
2171 The gnuplot command to set the terminal type for the dumb terminal. It
2172 this option is not set, the command used will be: @code{"set term dumb
2173 79 22"}, which makes the text output 79 characters by 22 characters.
2175 @opencatbox{Categories:}
2180 @c -----------------------------------------------------------------------------
2181 @anchor{gnuplot_pdf_term_command}
2182 @defvr {Plot option} gnuplot_pdf_term_command [gnuplot_pdf_term_command, @var{command}]
2184 The gnuplot command to set the terminal type for the PDF
2185 terminal. If this option is not set, the command used will be: @code{"set term pdfcairo color solid lw 3 size 17.2 cm, 12.9 cm font \",18\""}. See the gnuplot documentation for more information.
2187 @opencatbox{Categories:}
2192 @c -----------------------------------------------------------------------------
2193 @anchor{gnuplot_png_term_command}
2194 @defvr {Plot option} gnuplot_png_term_command [gnuplot_png_term_command, @var{command}]
2196 The gnuplot command to set the terminal type for the PNG terminal. If
2197 this option is not set, the command used will be:
2198 @code{"set term pngcairo font \",12\""}. See the gnuplot documentation
2199 for more information.
2201 @opencatbox{Categories:}
2206 @c -----------------------------------------------------------------------------
2207 @anchor{gnuplot_ps_term_command}
2208 @defvr {Plot option} gnuplot_ps_term_command [gnuplot_ps_term_command, @var{command}]
2210 The gnuplot command to set the terminal type for the PostScript
2211 terminal. If this option is not set, the command used will be: @code{"set term postscript eps color solid lw 2 size 16.4 cm, 12.3 cm font \",24\""}. See the gnuplot documentation for @code{set term postscript} for
2214 @opencatbox{Categories:}
2219 @c -----------------------------------------------------------------------------
2220 @anchor{gnuplot_strings}
2221 @defvr {Plot option} gnuplot_strings [gnuplot_strings, @var{value}]
2223 With a value of @code{true}, all strings used in labels and titles will
2224 be interpreted by gnuplot as ``enhanced'' text, if the terminal being used
2225 supports it. In enhanced mode, some characters such as ^ and _ are not
2226 printed, but interpreted as formatting characters. For a list of the
2227 formatting characters and their meaning, see the documentation for enhanced
2228 in Gnuplot. The default value for this option is @code{false}, which will
2229 not treat any characters as formatting characters.
2231 @opencatbox{Categories:}
2236 @c -----------------------------------------------------------------------------
2237 @anchor{gnuplot_svg_background}
2238 @defvr {Plot option} gnuplot_svg_background @*
2240 [gnuplot_svg_background, @var{color}] @*
2241 nognuplot_svg_background
2243 Specify the background color for SVG image output.
2244 @var{color} must be a string which specifies a color name recognized by Gnuplot,
2245 or an RGB triple of the form @code{"#xxxxxx"} where @code{x} is a hexadecimal digit.
2246 The default value is @code{"white"}.
2248 When the value of @code{gnuplot_svg_background} is @code{false},
2249 the background is the default determined by Gnuplot.
2250 At present (April 2023),
2251 the Gnuplot default is to specify the background in SVG output as @code{"none"}.
2253 @code{nognuplot_svg_background}, specified by itself without a value,
2254 is equivalent to @code{[gnuplot_svg_background, false]}.
2256 @opencatbox{Categories:}
2261 @c -----------------------------------------------------------------------------
2262 @anchor{gnuplot_svg_term_command}
2263 @defvr {Plot option} gnuplot_svg_term_command [gnuplot_svg_term_command, @var{command}]
2265 The gnuplot command to set the terminal type for the SVG
2266 terminal. If this option is not set, the command used will be:
2267 @code{"set term svg font \",14\""}. See the gnuplot documentation for
2270 @opencatbox{Categories:}
2275 @c -----------------------------------------------------------------------------
2276 @anchor{gnuplot_curve_titles}
2277 @defvr {Plot option} gnuplot_curve_titles
2279 This is an obsolete option that has been replaced by @mref{legend} described
2282 @opencatbox{Categories:}
2287 @c -----------------------------------------------------------------------------
2288 @anchor{gnuplot_curve_styles}
2289 @defvr {Plot option} gnuplot_curve_styles
2291 This is an obsolete option that has been replaced by @mrefdot{style}
2293 @opencatbox{Categories:}
2298 @c -----------------------------------------------------------------------------
2299 @node Gnuplot_pipes Format Functions, , Gnuplot Options, Plotting
2300 @section Gnuplot_pipes Format Functions
2301 @c -----------------------------------------------------------------------------
2303 @c -----------------------------------------------------------------------------
2304 @anchor{gnuplot_start}
2305 @deffn {Function} gnuplot_start ()
2307 Opens the pipe to gnuplot used for plotting with the @code{gnuplot_pipes}
2308 format. Is not necessary to manually open the pipe before plotting.
2310 @opencatbox{Categories:}
2315 @c -----------------------------------------------------------------------------
2316 @anchor{gnuplot_close}
2317 @deffn {Function} gnuplot_close ()
2319 Closes the pipe to gnuplot which is used with the @code{gnuplot_pipes} format.
2321 @opencatbox{Categories:}
2326 @c -----------------------------------------------------------------------------
2327 @anchor{gnuplot_send}
2328 @deffn {Function} gnuplot_send (@var{s})
2330 Sends the command @var{s} to the gnuplot pipe. If that pipe is not currently
2331 opened, it will be opened before sending the command. @var{s} must be a
2334 @opencatbox{Categories:}
2339 @c -----------------------------------------------------------------------------
2340 @anchor{gnuplot_restart}
2341 @deffn {Function} gnuplot_restart ()
2343 Closes the pipe to gnuplot which is used with the @code{gnuplot_pipes}
2344 format and opens a new pipe.
2346 @opencatbox{Categories:}
2351 @c -----------------------------------------------------------------------------
2352 @anchor{gnuplot_replot}
2353 @deffn {Function} gnuplot_replot @
2354 @fname{gnuplot_replot} () @
2355 @fname{gnuplot_replot} (@var{s})
2357 Updates the gnuplot window. If @code{gnuplot_replot} is called with a
2358 gnuplot command in a string @var{s}, then @code{s} is sent to gnuplot
2359 before reploting the window.
2361 @opencatbox{Categories:}
2366 @c -----------------------------------------------------------------------------
2367 @anchor{gnuplot_reset}
2368 @deffn {Function} gnuplot_reset ()
2370 Resets the state of gnuplot used with the @code{gnuplot_pipes} format. To
2371 update the gnuplot window call @mref{gnuplot_replot} after @code{gnuplot_reset}.
2373 @opencatbox{Categories:}