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 four parameters: line width, points
1690 radius, color and type of object to replace the points.
1692 See also @mref{color} and @mrefdot{point_type}
1694 @opencatbox{Categories:}
1699 @c -----------------------------------------------------------------------------
1701 @defvr {Plot option} svg_file [svg_file, @var{file_name}]
1703 Saves the plot into an SVG file with name equal to @var{file_name},
1704 rather than showing it in the screen. By default, the file will be
1705 created in the directory defined by the variable
1706 @mrefcomma{maxima_tempdir} unless @var{file_name} contains the character
1707 ``/'', in which case it will be assumed to contain the complete path where
1708 the file should be created. The value of @mref{maxima_tempdir} can be changed
1709 to save the file in a different directory. When the option
1710 @mref{gnuplot_svg_term_command} is also given, it will be used to set up
1711 Gnuplot's SVG terminal; otherwise, Gnuplot's svg terminal
1712 will be used with font of 14 points.
1714 @opencatbox{Categories:}
1719 @c -----------------------------------------------------------------------------
1721 @defvr {Plot option} t [t, @var{min}, @var{max}]
1723 Default range for parametric plots.
1725 @opencatbox{Categories:}
1730 @c -----------------------------------------------------------------------------
1732 @defvr {Plot option} title [title, @var{text}]
1734 Defines a title that will be written at the top of the plot.
1736 @opencatbox{Categories:}
1741 @c -----------------------------------------------------------------------------
1742 @anchor{transform_xy}
1743 @defvr {Plot option} transform_xy [transform_xy, @var{symbol}], notransform_xy
1745 Where @var{symbol} is either @code{false} or the result obtained by
1746 using the function @code{transform_xy}. If different from @code{false},
1747 it will be used to transform the 3 coordinates in
1748 plot3d. @code{notransform_xy} removes any transformation function
1751 See @mrefcomma{make_transform} @mref{polar_to_xy} and
1752 @mrefdot{spherical_to_xyz}
1754 @opencatbox{Categories:}
1759 @c -----------------------------------------------------------------------------
1761 @defvr {Plot option} window [window, @var{n}]
1763 Opens the plot in window number @var{n}, instead of the default window
1764 0. If window number @var{n} is already opened, the plot in that window
1765 will be replaced by the current plot.
1767 @opencatbox{Categories:}
1773 @c -----------------------------------------------------------------------------
1775 @defvr {Plot option} x [x, @var{min}, @var{max}]
1777 When used as the first option in a @mref{plot2d} command (or any of the
1778 first two in @mref{plot3d}), it indicates that the first independent variable
1779 is x and it sets its range. It can also be used again after the first
1780 option (or after the second option in plot3d) to define the effective
1781 horizontal domain that will be shown in the plot.
1783 @opencatbox{Categories:}
1788 @c -----------------------------------------------------------------------------
1790 @defvr {Plot option} xlabel [xlabel, @var{string}]
1792 Specifies the @var{string} that will label the first axis; if this
1793 option is not used, that label will be the name of the independent
1794 variable, when plotting functions with @mref{plot2d} the name of the
1795 first variable, when plotting surfaces with @mref{plot3d}, or the first
1796 expression in the case of a parametric plot.
1798 @opencatbox{Categories:}
1803 @c -----------------------------------------------------------------------------
1805 @defvr {Plot option} xtics [xtics, @var{x1}, @var{x2}, @var{x3}], @
1806 [xtics, @code{false}], xtics, noxtics
1808 Defines the values at which a mark and a number will be placed in the x
1809 axis. The first number is the initial value, the second the increments
1810 and the third is the last value where a mark is placed. The second and
1811 third numbers can be omitted, in which case the first number is the
1812 increment from an initial value that will be chosen by the graphic
1813 program. If @code{[xtics, false]} is used, no marks or numbers will be
1814 shown along the x axis.
1816 The single keyword @code{xtics} removes any values previously
1817 defined, leaving it to the graphic program to decide the values to use
1818 and @code{noxtics} is a synonym for @code{[xtics, false]}
1820 @opencatbox{Categories:}
1825 @c -----------------------------------------------------------------------------
1827 @defvr {Plot option} xy_scale [xy_scale, @var{sx}, @var{sy}]
1829 In a 2d plot, it defines the ratio of the total size of the Window to
1830 the size that will be used for the plot. The two numbers given as
1831 arguments are the scale factors for the x and y axes.
1833 This option does not change the size of the graphic window or the placement
1834 of the graph in the window. If you want to change the aspect ratio of the
1835 plot, it is better to use option @mrefdot{yx_ratio} For instance,
1836 @code{[yx_ratio, 10]} instead of @code{[xy_scale, 0.1, 1]}.
1838 @opencatbox{Categories:}
1843 @c -----------------------------------------------------------------------------
1845 @defvr {Plot option} y [y, @var{min}, @var{max}]
1847 When used as one of the first two options in @mrefcomma{plot3d} it indicates
1848 that one of the independent variables is y and it sets its range. Otherwise,
1849 it defines the effective domain of the second variable that will be
1852 @opencatbox{Categories:}
1857 @c -----------------------------------------------------------------------------
1859 @defvr {Plot option} ylabel [ylabel, @var{string}]
1861 Specifies the @var{string} that will label the second axis; if this
1862 option is not used, that label will be ``y'', when plotting explicit
1863 functions with @mref{plot2d}, or the name of the second variable, when
1864 plotting surfaces with @mref{plot3d}, or the second expression in the
1865 case of a parametric plot.
1867 @opencatbox{Categories:}
1872 @c -----------------------------------------------------------------------------
1874 @defvr {Plot option} ytics [ytics, @var{y1}, @var{y2}, @var{y3}], @
1875 [ytics, @code{false}], ytics, noytics
1877 Defines the values at which a mark and a number will be placed in the y
1878 axis. The first number is the initial value, the second the increments
1879 and the third is the last value where a mark is placed. The second and
1880 third numbers can be omitted, in which case the first number is the
1881 increment from an initial value that will be chosen by the graphic
1882 program. If @code{[ytics, false]} is used, no marks or numbers will be
1883 shown along the y axis.
1885 The single keyword @code{ytics} removes any values previously
1886 defined, leaving it to the graphic program to decide the values to use
1887 and @code{noytics} is a synonym for @code{[ytics, false]}
1889 @opencatbox{Categories:}
1894 @c -----------------------------------------------------------------------------
1896 @defvr {Plot option} yx_ratio [yx_ratio, @var{r}]
1898 In a 2d plot, the ratio between the vertical and the horizontal sides of
1899 the rectangle used to make the plot. See also @mrefdot{same_xy}
1901 @opencatbox{Categories:}
1906 @c -----------------------------------------------------------------------------
1908 @defvr {Plot option} z [z, @var{min}, @var{max}]
1910 Used in @mref{plot3d} to set the effective range of values of z that will be
1913 @opencatbox{Categories:}
1918 @c -----------------------------------------------------------------------------
1920 @defvr {Plot option} zlabel [zlabel, @var{string}]
1922 Specifies the @var{string} that will label the third axis, when using
1923 @mrefdot{plot3d} If this option is not used, that label will be ``z'', when
1924 plotting surfaces, or the third expression in the case of a parametric
1925 plot. It can not be used with @mref{set_plot_option} and it will be
1926 ignored by @mrefdot{plot2d}
1928 @opencatbox{Categories:}
1933 @c -----------------------------------------------------------------------------
1935 @defvr {Plot option} zmin [zmin, @var{z}], zmin
1937 In 3d plots, the value of z that will be at the bottom of the plot box.
1939 The single keyword @code{zmin} removes any value previously
1940 defined, leaving it to the graphic program to decide the value to use.
1942 @opencatbox{Categories:}
1947 @c -----------------------------------------------------------------------------
1949 @defvr {Plot option} ztics [ztics, @var{z1}, @var{z2}, @var{z3}], @
1950 [ztics, @code{false}], ztics, noztics
1952 Defines the values at which a mark and a number will be placed in the z
1953 axis. The first number is the initial value, the second the increments
1954 and the third is the last value where a mark is placed. The second and
1955 third numbers can be omitted, in which case the first number is the
1956 increment from an initial value that will be chosen by the graphic
1957 program. If @code{[ztics, false]} is used, no marks or numbers will be
1958 shown along the z axis.
1960 The single keyword @code{ztics} removes any values previously
1961 defined, leaving it to the graphic program to decide the values to use
1962 and @code{noztics} is a synonym for @code{[ztics, false]}
1964 @opencatbox{Categories:}
1969 @c -----------------------------------------------------------------------------
1970 @node Gnuplot Options, Gnuplot_pipes Format Functions, Plotting Options, Plotting
1971 @section Gnuplot Options
1972 @c -----------------------------------------------------------------------------
1974 There are several plot options specific to gnuplot. All of them consist
1975 of a keyword (the name of the option), followed by a string that should
1976 be a valid gnuplot command, to be passed directly to gnuplot. In most
1977 cases, there exist a corresponding plotting option that will produce a
1978 similar result and whose use is more recommended than the gnuplot
1981 @c -----------------------------------------------------------------------------
1982 @anchor{gnuplot_term}
1983 @defvr {Plot option} gnuplot_term [gnuplot_term, @var{terminal_name}]
1985 Sets the output terminal type for gnuplot. The argument @var{terminal_name}
1986 can be a string or one of the following 3 special symbols
1989 @strong{default} (default value)
1991 Gnuplot output is displayed in a separate graphical window and the
1992 gnuplot terminal used will be specified by the value of the option
1993 @mrefdot{gnuplot_default_term_command}
1998 Gnuplot output is saved to a file @code{maxout_xxx.gnuplot} using "ASCII
1999 art" approximation to graphics. If the option @mref{gnuplot_out_file} is
2000 set to @var{filename}, the plot will be saved there, instead of the
2001 default @code{maxout_xxx.gnuplot}. The settings for the ``dumb'' terminal of
2002 Gnuplot are given by the value of option
2003 @mrefdot{gnuplot_dumb_term_command} If option @mref{run_viewer} is set
2004 to true and the plot_format is @code{gnuplot} that ASCII representation
2005 will also be shown in the Maxima or Xmaxima console.
2010 Gnuplot generates commands in the PostScript page description language.
2011 If the option @mref{gnuplot_out_file} is set to @var{filename}, gnuplot
2012 writes the PostScript commands to @var{filename}. Otherwise, it is
2013 saved as @code{maxplot.ps} file. The settings for this terminal are given by the value of the option @mrefdot{gnuplot_dumb_term_command}
2016 A string representing any valid gnuplot term specification
2018 Gnuplot can generate output in many other graphical formats such as png,
2019 jpeg, svg etc. To use those formats, option @code{gnuplot_term} can be
2020 set to any supported gnuplot term name (which must be a symbol) or even a
2021 full gnuplot term specification with any valid options (which must be a string). For
2022 example @code{[gnuplot_term, png]} creates output in PNG (Portable
2023 Network Graphics) format while @code{[gnuplot_term, "png size
2024 1000,1000"]} creates PNG of 1000 x 1000 pixels size. If the option
2025 @mref{gnuplot_out_file} is set to @var{filename}, gnuplot writes the
2026 output to @var{filename}. Otherwise, it is saved as
2027 @code{maxplot.@var{term}} file, where @var{term} is gnuplot terminal
2031 @opencatbox{Categories:}
2036 @c -----------------------------------------------------------------------------
2037 @anchor{gnuplot_out_file}
2038 @defvr {Plot option} gnuplot_out_file [gnuplot_out_file, @var{file_name}]
2040 It can be used to replace the default name for the file that contains
2041 the commands that will interpreted by gnuplot, when the terminal is set
2042 to @code{default}, or to replace the default name of the graphic file
2043 that gnuplot creates, when the terminal is different from
2044 @code{default}. If it contains one or more slashes, ``/'', the name of
2045 the file will be left as it is; otherwise, it will be appended to the
2046 path of the temporary directory. The complete name of the files created
2047 by the plotting commands is always sent as output of those commands so
2048 they can be seen if the command is ended by semi-colon.
2050 When used in conjunction with the @mref{gnuplot_term} option, it can be
2051 used to save the plot in a file, in one of the graphic formats supported
2052 by Gnuplot. To create PNG, PDF, Postscript or SVG, it is easier to use
2053 options @mrefcomma{png_file} @mrefcomma{pdf_file} @mrefcomma{ps_file}
2054 or @mrefdot{svg_file}
2056 @opencatbox{Categories:}
2061 @c -----------------------------------------------------------------------------
2062 @anchor{gnuplot_script_file}
2063 @defvr {Plot option} gnuplot_script_file [gnuplot_script_file, @var{file_name_or_function}]
2065 Creates a plot with @code{plot2d}, @code{plot3d}, @code{mandelbrot} or
2066 @code{julia} using the @code{gnuplot} @mref{plot_format} and saving
2067 the script sent to Gnuplot in the file specified by @var{file_name_or_function}.
2068 The value @var{file_name_or_function} can be a string or a Maxima function of
2069 one variable that returns a string. If that string corresponds to a
2070 complete file path (directory and file name), the script will be created in
2071 that file and will not be deleted after Maxima is closed; otherwise, the
2072 string will give the name of a file to be created in the temporary directory
2073 and deleted when Maxima is closed.
2075 In this example, the script file name is set to ``sin.gnuplot'', in the
2079 (%i1) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, "./sin.gnuplot"]);
2081 (%o1) ["./sin.gnuplot"]
2084 In this example, @code{gnuplot_maxout_prt(@var{file})} is a function
2085 that takes the default file name, @var{file}. It constructs a full file
2086 name for the data file by interpolating a random 8-digit integer with a
2087 pad of zeros into the default file name (``maxout'' followed by the id
2088 number of the Maxima process, followed by ``.gnuplot''). The temporary
2089 directory is determined by @mref{maxima_tempdir} (it is ``/tmp'' in this
2093 (%i1) gnuplot_maxout_prt(file) := block([beg,end],
2094 [beg,end] : split(file,"."),
2095 printf(false,"~a_~8,'0d.~a",beg,random(10^8-1),end)) $
2097 (%i2) plot2d( sin(x), [x,0,2*%pi], [gnuplot_script_file, gnuplot_maxout_prt]);
2099 (%o2) ["/tmp/maxout68715_09606909.gnuplot"]
2102 By default, the script would have been saved in a file named
2103 @code{maxoutXXXXX.gnuplot} (XXXXX=68715 in this example) in the temporary
2104 directory. If the print statement in function @code{gnuplot_maxout_prt}
2105 above included a directory path, the file would have been saved in that
2106 directory rather than in the temporary directory.
2108 @opencatbox{Categories:}
2113 @c -----------------------------------------------------------------------------
2114 @anchor{gnuplot_pm3d}
2115 @defvr {Plot option} gnuplot_pm3d [gnuplot_pm3d, @var{value}]
2117 With a value of @code{false}, it can be used to disable the use of PM3D
2118 mode, which is enabled by default.
2120 @opencatbox{Categories:}
2125 @c -----------------------------------------------------------------------------
2126 @anchor{gnuplot_preamble}
2127 @defvr {Plot option} gnuplot_preamble [gnuplot_preamble, @var{string}]
2129 This option inserts gnuplot commands before any other commands sent to
2130 Gnuplot. Any valid gnuplot commands may be used. Multiple commands should
2131 be separated with a semi-colon. See also @mrefdot{gnuplot_postamble}
2133 @opencatbox{Categories:}
2138 @c -----------------------------------------------------------------------------
2139 @anchor{gnuplot_postamble}
2140 @defvr {Plot option} gnuplot_postamble [gnuplot_postamble, @var{string}]
2142 This option inserts gnuplot commands after other commands sent to
2143 Gnuplot and right before the plot command is sent. Any valid gnuplot
2144 commands may be used. Multiple commands should be separated with a
2145 semi-colon. See also @mrefdot{gnuplot_preamble}
2147 @opencatbox{Categories:}
2152 @c -----------------------------------------------------------------------------
2153 @anchor{gnuplot_default_term_command}
2154 @defvr {Plot option} gnuplot_default_term_command
2155 [gnuplot_default_term_command, @var{command}]
2157 The gnuplot command to set the terminal type for the default
2158 terminal. It this option is not set, the command used will be: @code{"set term wxt size 640,480 font \",12\"; set term pop"}.
2160 @opencatbox{Categories:}
2165 @c -----------------------------------------------------------------------------
2166 @anchor{gnuplot_dumb_term_command}
2167 @defvr {Plot option} gnuplot_dumb_term_command
2168 [gnuplot_dumb_term_command, @var{command}]
2170 The gnuplot command to set the terminal type for the dumb terminal. It
2171 this option is not set, the command used will be: @code{"set term dumb
2172 79 22"}, which makes the text output 79 characters by 22 characters.
2174 @opencatbox{Categories:}
2179 @c -----------------------------------------------------------------------------
2180 @anchor{gnuplot_pdf_term_command}
2181 @defvr {Plot option} gnuplot_pdf_term_command [gnuplot_pdf_term_command, @var{command}]
2183 The gnuplot command to set the terminal type for the PDF
2184 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.
2186 @opencatbox{Categories:}
2191 @c -----------------------------------------------------------------------------
2192 @anchor{gnuplot_png_term_command}
2193 @defvr {Plot option} gnuplot_png_term_command [gnuplot_png_term_command, @var{command}]
2195 The gnuplot command to set the terminal type for the PNG terminal. If
2196 this option is not set, the command used will be:
2197 @code{"set term pngcairo font \",12\""}. See the gnuplot documentation
2198 for more information.
2200 @opencatbox{Categories:}
2205 @c -----------------------------------------------------------------------------
2206 @anchor{gnuplot_ps_term_command}
2207 @defvr {Plot option} gnuplot_ps_term_command [gnuplot_ps_term_command, @var{command}]
2209 The gnuplot command to set the terminal type for the PostScript
2210 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
2213 @opencatbox{Categories:}
2218 @c -----------------------------------------------------------------------------
2219 @anchor{gnuplot_strings}
2220 @defvr {Plot option} gnuplot_strings [gnuplot_strings, @var{value}]
2222 With a value of @code{true}, all strings used in labels and titles will
2223 be interpreted by gnuplot as ``enhanced'' text, if the terminal being used
2224 supports it. In enhanced mode, some characters such as ^ and _ are not
2225 printed, but interpreted as formatting characters. For a list of the
2226 formatting characters and their meaning, see the documentation for enhanced
2227 in Gnuplot. The default value for this option is @code{false}, which will
2228 not treat any characters as formatting characters.
2230 @opencatbox{Categories:}
2235 @c -----------------------------------------------------------------------------
2236 @anchor{gnuplot_svg_background}
2237 @defvr {Plot option} gnuplot_svg_background @*
2239 [gnuplot_svg_background, @var{color}] @*
2240 nognuplot_svg_background
2242 Specify the background color for SVG image output.
2243 @var{color} must be a string which specifies a color name recognized by Gnuplot,
2244 or an RGB triple of the form @code{"#xxxxxx"} where @code{x} is a hexadecimal digit.
2245 The default value is @code{"white"}.
2247 When the value of @code{gnuplot_svg_background} is @code{false},
2248 the background is the default determined by Gnuplot.
2249 At present (April 2023),
2250 the Gnuplot default is to specify the background in SVG output as @code{"none"}.
2252 @code{nognuplot_svg_background}, specified by itself without a value,
2253 is equivalent to @code{[gnuplot_svg_background, false]}.
2255 @opencatbox{Categories:}
2260 @c -----------------------------------------------------------------------------
2261 @anchor{gnuplot_svg_term_command}
2262 @defvr {Plot option} gnuplot_svg_term_command [gnuplot_svg_term_command, @var{command}]
2264 The gnuplot command to set the terminal type for the SVG
2265 terminal. If this option is not set, the command used will be:
2266 @code{"set term svg font \",14\""}. See the gnuplot documentation for
2269 @opencatbox{Categories:}
2274 @c -----------------------------------------------------------------------------
2275 @anchor{gnuplot_curve_titles}
2276 @defvr {Plot option} gnuplot_curve_titles
2278 This is an obsolete option that has been replaced by @mref{legend} described
2281 @opencatbox{Categories:}
2286 @c -----------------------------------------------------------------------------
2287 @anchor{gnuplot_curve_styles}
2288 @defvr {Plot option} gnuplot_curve_styles
2290 This is an obsolete option that has been replaced by @mrefdot{style}
2292 @opencatbox{Categories:}
2297 @c -----------------------------------------------------------------------------
2298 @node Gnuplot_pipes Format Functions, , Gnuplot Options, Plotting
2299 @section Gnuplot_pipes Format Functions
2300 @c -----------------------------------------------------------------------------
2302 @c -----------------------------------------------------------------------------
2303 @anchor{gnuplot_start}
2304 @deffn {Function} gnuplot_start ()
2306 Opens the pipe to gnuplot used for plotting with the @code{gnuplot_pipes}
2307 format. Is not necessary to manually open the pipe before plotting.
2309 @opencatbox{Categories:}
2314 @c -----------------------------------------------------------------------------
2315 @anchor{gnuplot_close}
2316 @deffn {Function} gnuplot_close ()
2318 Closes the pipe to gnuplot which is used with the @code{gnuplot_pipes} format.
2320 @opencatbox{Categories:}
2325 @c -----------------------------------------------------------------------------
2326 @anchor{gnuplot_send}
2327 @deffn {Function} gnuplot_send (@var{s})
2329 Sends the command @var{s} to the gnuplot pipe. If that pipe is not currently
2330 opened, it will be opened before sending the command. @var{s} must be a
2333 @opencatbox{Categories:}
2338 @c -----------------------------------------------------------------------------
2339 @anchor{gnuplot_restart}
2340 @deffn {Function} gnuplot_restart ()
2342 Closes the pipe to gnuplot which is used with the @code{gnuplot_pipes}
2343 format and opens a new pipe.
2345 @opencatbox{Categories:}
2350 @c -----------------------------------------------------------------------------
2351 @anchor{gnuplot_replot}
2352 @deffn {Function} gnuplot_replot @
2353 @fname{gnuplot_replot} () @
2354 @fname{gnuplot_replot} (@var{s})
2356 Updates the gnuplot window. If @code{gnuplot_replot} is called with a
2357 gnuplot command in a string @var{s}, then @code{s} is sent to gnuplot
2358 before reploting the window.
2360 @opencatbox{Categories:}
2365 @c -----------------------------------------------------------------------------
2366 @anchor{gnuplot_reset}
2367 @deffn {Function} gnuplot_reset ()
2369 Resets the state of gnuplot used with the @code{gnuplot_pipes} format. To
2370 update the gnuplot window call @mref{gnuplot_replot} after @code{gnuplot_reset}.
2372 @opencatbox{Categories:}