1 \input texinfo @c -*-texinfo-*-
4 @setfilename gnuplot.info
5 @settitle Gnuplot: An Interactive Plotting Program
9 @c define the command and options indeces
16 * GNUPLOT: (gnuplot). An Interactive Plotting Program
20 @node Top, gnuplot, (dir), (dir)
27 An Interactive Plotting Program
28 Thomas Williams & Colin Kelley
29 Version 4.2 organized by: Hans-Bernhard Broeker
31 Copyright (C) 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
33 Mailing list for comments: gnuplot-info@@lists.sourceforge.net
34 Mailing list for bug reports: gnuplot-bugs@@lists.sourceforge.net
36 This manual was originally prepared by Dick Crawford
37 Version 4.2 - 1 Oct 2006
40 Major contributors (alphabetic order):
43 @c ^ <h2> An Interactive Plotting Program </h2><p>
44 @c ^ <h2> Thomas Williams & Colin Kelley</h2><p>
45 @c ^ <h2> Version 4.2 organized by Hans-Bernhard Broeker and others</h2><p>
46 @c ^ <h2>Major contributors (alphabetic order):</h2>
97 @c ^<h2> Copyright (C) 1986 - 1993, 1998 - 2004 Thomas Williams, Colin Kelley<p>
98 @c ^ Mailing list for comments: gnuplot-info@@lists.sourceforge.net <p>
99 @c ^ Mailing list for bug reports: gnuplot-bugs@@lists.sourceforge.net <p>
101 @c ^<h3> This manual was prepared by Dick Crawford</h3><p>
102 @c ^<h3> Last revised: February 2007</h3><p>
109 * Graphical_User_Interfaces::
118 @node gnuplot, Commands, Top, Top
125 * Seeking-assistance::
126 * New_features_introduced_in_version_4.2::
127 * Backwards_compatibility::
128 * Features_introduced_in_version_4.0::
129 * Batch/Interactive_Operation::
130 * Command-line-editing::
141 * String_constants_and_string_variables::
142 * Substitution_and_Command_line_macros::
147 @node Copyright, Introduction, gnuplot, gnuplot
155 Copyright (C) 1986 - 1993, 1998, 2004, 2007 Thomas Williams, Colin Kelley
159 Permission to use, copy, and distribute this software and its
160 documentation for any purpose with or without fee is hereby granted,
161 provided that the above copyright notice appear in all copies and
162 that both that copyright notice and this permission notice appear
163 in supporting documentation.
165 Permission to modify the software is granted, but not the right to
166 distribute the complete modified source code. Modifications are to
167 be distributed as patches to the released version. Permission to
168 distribute binaries produced by compiling modified sources is granted,
171 1. distribute the corresponding source modifications from the
172 released version in the form of a patch file along with the binaries,
173 2. add special version identification to distinguish your version
174 in addition to the base release version number,
175 3. provide your name and address as the primary contact for the
176 support of your modified version, and
177 4. retain our contact information in regard to use of the base
181 Permission to distribute the released version of the source code along
182 with corresponding source modifications in the form of a patch file is
183 granted with same provisions 2 through 4 for binary distributions.
185 This software is provided "as is" without express or implied warranty
186 to the extent permitted by applicable law.
196 Thomas Williams, Colin Kelley.
201 Gnuplot 2.0 additions:
202 Russell Lang, Dave Kotz, John Campbell.
207 Gnuplot 3.0 additions:
208 Gershon Elber and many others.
213 Gnuplot 4.0 additions:
214 See list of contributors at head of this document.
218 @node Introduction, Seeking-assistance, Copyright, gnuplot
219 @section Introduction
224 `gnuplot` is a command-driven interactive function and data plotting program.
226 Any command-line arguments are assumed to be names of files containing
227 `gnuplot` commands, with the exception of standard X11 arguments, which are
228 processed first. Each file is loaded with the `load` command, in the order
229 specified. `gnuplot` exits after the last file is processed. The special
230 filename "-" is used to denote standard input. When no load files are named,
231 `gnuplot` enters into an interactive mode. See help for `batch/interactive`
234 `gnuplot` is case sensitive (commands and function names written in lowercase
235 are not the same as those written in CAPS). All command names may be
236 abbreviated as long as the abbreviation is not ambiguous. Any number of
237 commands may appear on a line (with the exception that `load` or @ref{call} must
238 be the final command), separated by semicolons (;). Strings are indicated
239 with quotes. They may be either single or double quotation marks, e.g.,
247 although there are some subtle differences (see `syntax` for more details).
249 Many `gnuplot` commands have multiple options. Version 4 is less sensitive
250 to the order of these options than earlier versions, but some order-dependence
251 remains. If you see error messages about unrecognized options, please try
252 again using the exact order listed in the documentation.
254 Commands may extend over several input lines by ending each line but the last
255 with a backslash (\). The backslash must be the _last_ character on each
256 line. The effect is as if the backslash and newline were not there. That
257 is, no white space is implied, nor is a comment terminated. Therefore,
258 commenting out a continued line comments out the entire command
259 (see `comments`). But note that if an error occurs somewhere on a multi-line
260 command, the parser may not be able to locate precisely where the error is
261 and in that case will not necessarily point to the correct line.
263 In this document, curly braces (@{@}) denote optional arguments and a vertical
264 bar (|) separates mutually exclusive choices. `gnuplot` keywords or @ref{help}
265 topics are indicated by backquotes or `boldface` (where available). Angle
266 brackets (<>) are used to mark replaceable tokens. In many cases, a default
267 value of the token will be taken for optional arguments if the token is
268 omitted, but these cases are not always denoted with braces around the angle
271 For on-line help on any topic, type @ref{help} followed by the name of the topic
272 or just @ref{help} or `?` to get a menu of available topics.
274 The new `gnuplot` user should begin by reading about `plotting` (if on-line,
275 type `help plotting`).
277 See the simple.dem demo, also available together with other demos on the web page
278 @uref{http://www.gnuplot.info/demo/simple.html,http://www.gnuplot.info/demo/simple.html
281 @node Seeking-assistance, New_features_introduced_in_version_4.2, Introduction, gnuplot
282 @section Seeking-assistance
284 @c ^ <a name="Seeking-assistance"></a>
287 @cindex seeking-assistance
289 There is a mailing list for `gnuplot` users. Note, however, that the
292 comp.graphics.apps.gnuplot
295 is identical to the mailing list (they both carry the same set of messages).
296 We prefer that you read the messages through the newsgroup rather than
297 subscribing to the mailing list. Instructions for subscribing to gnuplot
298 mailing lists may be found via the gnuplot development website on SourceForge
299 @uref{http://sourceforge.net/projects/gnuplot,http://sourceforge.net/projects/gnuplot
302 The address for mailing to list members is:
304 gnuplot-info@@lists.sourceforge.net
308 Bug reports and code contributions should be mailed to:
310 gnuplot-bugs@@lists.sourceforge.net
314 The list of those interested in beta-test versions is:
316 gnuplot-beta@@lists.sourceforge.net
320 There is also the canonical (if occasionally out-of-date) gnuplot web page at
322 @uref{http://www.gnuplot.info,http://www.gnuplot.info
325 Before seeking help, please check the
327 @uref{http://www.gnuplot.info/faq/,FAQ (Frequently Asked Questions) list.
330 When posting a question, please include full details of the version of
331 `gnuplot`, the machine, and operating system you are using. A _small_ script
332 demonstrating the problem may be useful. Function plots are preferable to
333 datafile plots. If email-ing to gnuplot-info, please state whether or not
334 you are subscribed to the list, so that users who use news will know to email
335 a reply to you. There is a form for such postings on the WWW site.
338 @node New_features_introduced_in_version_4.2, Backwards_compatibility, Seeking-assistance, gnuplot
339 @section New features introduced in version 4.2
343 @c ?version 4.2 features
344 Gnuplot version 4.2 offers many new features introduced since the preceding
345 official version 4.0. This section lists major additions and gives a partial
346 list of changes and minor new features. For a more exhaustive list, see the
352 * Input_from_binary_data_files::
353 * New_plot_elements::
356 * Auto-layout_of_multiple_plots_on_a_page::
357 * Internal_variables::
358 * New_or_revised_terminal_drivers::
362 @node New_plot_styles, Input_from_binary_data_files, New_features_introduced_in_version_4.2, New_features_introduced_in_version_4.2
363 @subsection New plot styles
375 @node Histogram, Label_plots, New_plot_styles, New_plot_styles
376 @subsubsection Histogram
378 Histograms, or bar charts, can be produced.
382 @node Label_plots, Image_data, Histogram, New_plot_styles
383 @subsubsection Label plots
385 In coordination with the new `datastrings` feature described below, gnuplot
386 can draw a label at each vertex of a curve.
390 @node Image_data, Filled_curves, Label_plots, New_plot_styles
391 @subsubsection Image data
393 The `image` and `rgbimage` styles allow to plot 2D images (from ascii or
394 `binary` files) and map them in a 2D or 3D plot.
395 See `image` and `rgbimage`.
398 @node Filled_curves, Vectors, Image_data, New_plot_styles
399 @subsubsection Filled curves
401 The plot style `fillstyle` has been augmented to allow to fill the area
402 between two input curves with a color or a pattern.
406 @node Vectors, , Filled_curves, New_plot_styles
407 @subsubsection Vectors
409 Gnuplot can draw plots with vectors with a small arrowhead, requiring four or
410 six columns of data for 2D or 3D, respectively.
414 @node Input_from_binary_data_files, New_plot_elements, New_plot_styles, New_features_introduced_in_version_4.2
415 @subsection Input from binary data files
417 Gnuplot can now read a generic `binary` input, including matrix binary and
418 `general binary` (until now gnuplot supported only its own `binary matrix`
419 format). Several matrix file formats are autodetected (`gpbin`, `edf`, `avs`).
420 Binary data files are mainly useful for `image` and `rgbimage` drawings.
421 See `binary` and `binary general filetype`.
424 @node New_plot_elements, String_handling, Input_from_binary_data_files, New_features_introduced_in_version_4.2
425 @subsection New plot elements
431 * Arbitrary_rectangles::
434 @node RGB_colors, Arbitrary_rectangles, New_plot_elements, New_plot_elements
435 @subsubsection RGB colors
437 Explicit RGB colors can be specified for all plot elements instead of
438 specifying a predefined linetype.
442 @node Arbitrary_rectangles, , RGB_colors, New_plot_elements
443 @subsubsection Arbitrary rectangles
445 You can place rectangles with desired fill style and border anywhere in a 2D
447 See `set object rectangle`.
450 @node String_handling, Macros, New_plot_elements, New_features_introduced_in_version_4.2
451 @subsection String handling
455 * String_and_text_data_read_from_datafiles::
456 * User-defined_string_variables::
459 @node String_and_text_data_read_from_datafiles, User-defined_string_variables, String_handling, String_handling
460 @subsubsection String and text data read from datafiles
462 Gnuplot can now read and process text fields in datafiles.
465 @node User-defined_string_variables, , String_and_text_data_read_from_datafiles, String_handling
466 @subsubsection User-defined string variables, operators, and functions
468 String variables and string functions are introduced. Most gnuplot commands
469 that previously required a string constant will now also accept a string
470 variable, a string expression, or a function that returns a string.
474 @node Macros, Auto-layout_of_multiple_plots_on_a_page, String_handling, New_features_introduced_in_version_4.2
477 Gnuplot supports command line macro expansion by '@@stringvariablename'.
481 @node Auto-layout_of_multiple_plots_on_a_page, Internal_variables, Macros, New_features_introduced_in_version_4.2
482 @subsection Auto-layout of multiple plots on a page
484 The @ref{multiplot} mode is now able to layout automatically simple
485 multiplots without having to set the size or the position for each plot.
489 @node Internal_variables, New_or_revised_terminal_drivers, Auto-layout_of_multiple_plots_on_a_page, New_features_introduced_in_version_4.2
490 @subsection Internal variables
492 Gnuplot now exports several "read-only" variables such as GPVAL_TERM,
497 @node New_or_revised_terminal_drivers, Canvas_size, Internal_variables, New_features_introduced_in_version_4.2
498 @subsection New or revised terminal drivers
511 @node `wxt`, `emf`, New_or_revised_terminal_drivers, New_or_revised_terminal_drivers
514 The `wxt` terminal is an interactive and cross-platform terminal for on-screen
515 rendering. It uses the wxWidgets library for its user interface, and Cairo
516 associated with Pango for the actual rendering, providing nice plots with
517 antialiasing on lines and text. The terminal supports the full range of
518 gnuplot capabilities, including mousing, pm3d plots, image plots and
521 @node `emf`, `gif`, `wxt`, New_or_revised_terminal_drivers
524 The `emf` terminal generates an Enhanced Metafile Format file. This file
525 format is the metafile standard on MS Win32 Systems. The emf terminal
526 supports pm3d, rgb color, and image plot modes.
528 @node `gif`, @ref{postscript}, `emf`, New_or_revised_terminal_drivers
529 @subsubsection `gif`, `jpeg`, `png`
531 The code for the terminals using the `gd` library has been consolidated.
532 The `gif` terminal also knows how to produce an animated gif from a sequence
535 @node @ref{postscript}, `ai`, `gif`, New_or_revised_terminal_drivers
536 @subsubsection @ref{postscript}
538 The @ref{postscript} terminal can load prologue files, which can contain
539 additional user-defined sections with, for example, character encodings.
540 See `postscript prologue`.
542 @node `ai`, `epslatex`, @ref{postscript}, New_or_revised_terminal_drivers
545 The Adobe Illustrator `ai` driver is outdated. Since Adobe Illustrator
546 understands PostScript files, `set terminal post level1 ...` should be used
549 @node `epslatex`, `windows`, `ai`, New_or_revised_terminal_drivers
550 @subsubsection `epslatex`, `pslatex`, `pstex`
552 The terminals supporting an output to latex augmented by PostScript commands
553 have been consolidated. Many options are the same as in the @ref{postscript}
556 @node `windows`, , `epslatex`, New_or_revised_terminal_drivers
557 @subsubsection `windows`
559 The `windows` terminal now supports the `enhanced text` mode.
562 @node Canvas_size, , New_or_revised_terminal_drivers, New_features_introduced_in_version_4.2
563 @subsection Canvas size
570 In earlier versions of gnuplot, some terminal types used the values from
571 @ref{size} to control also the size of the output canvas; others did not.
572 The use of 'set size' for this purpose was deprecated in version 4.2.
573 In version 4.3 almost all terminals now behave as follows:
575 `set term <terminal_type> size <XX>, <YY>` controls the size of the output
576 file, or "canvas". Please see individual terminal documentation for allowed
577 values of the size parameters. By default, the plot will fill this canvas.
579 `set size <XX>, <YY>` scales the plot itself relative to the size of the
580 canvas. Scale values less than 1 will cause the plot to not fill the entire
581 canvas. Scale values larger than 1 will cause only a portion of the plot to
582 fit on the canvas. Please be aware that setting scale values larger than 1
583 may cause problems on some terminal types.
585 The major exception to this convention is the PostScript driver, which
586 by default continues to act as it has in earlier versions. Be warned that
587 the next version of gnuplot may change the default behaviour of the
588 PostScript driver as well.
594 set term png size 600, 400
595 set output "figure.png"
596 plot "data" with lines
600 These commands will produce an output file "figure.png" that is 600 pixels
601 wide and 400 pixels tall. The plot will fill the lower left quarter of this
602 canvas. This is consistent with the way multiplot mode has always worked,
603 however it is a change in the way the png driver worked for single plots in
607 @node Backwards_compatibility, Features_introduced_in_version_4.0, New_features_introduced_in_version_4.2, gnuplot
608 @section Backwards compatibility
610 @c ?backwards compatibility
611 @cindex compatibility
613 Gnuplot version 4.0 deprecated certain syntax used in earlier versions, but
614 continued to recognize it. This is now under the control of a configuration
615 option, and can be disabled as follows:
618 ./configure --disable-backwards-compatibility
622 Notice: Deprecated syntax items may be disabled permanently in some future
625 One major difference is the introduction of keywords to disambiguate complex
626 commands, particularly commands containing string variables. A notable issue
627 was the use of bare numbers to specify offsets, line and point types.
628 Illustrative examples:
634 plot 1 2 4 # horizontal line at y=1
640 set title TITLE offset char 0, char -1
641 set style data linespoints
642 plot 1 linetype 2 pointtype 4
646 Another compatibility issue is the effect of the command @ref{size} outside
647 when not in multiplot mode. In earlier versions, the command
648 `set size <xx>, <yy>` caused some terminals to change both the size of the plot
649 and the size of the canvas is was drawn on; other terminatls changed only the
650 plot size. The use of @ref{size} to change the canvas size is now deprecated.
652 Please see @ref{size}, @ref{size} and also the documentation for
653 individual terminals.
656 @node Features_introduced_in_version_4.0, Batch/Interactive_Operation, Backwards_compatibility, gnuplot
657 @section Features introduced in version 4.0
659 @c ?version 4 features
660 Gnuplot version 4.0 contained many features introduced since the preceding
661 official version 3.7. These are summarized here.
665 * Mouse_and_hotkey_support_in_interactive_terminals::
667 * New_plot_style_@ref{pm3d}::
669 * New_plot_option_smooth_frequency::
670 * Improved_text_options::
671 * More_text_encodings::
675 * Other_changes_and_additions::
676 * Accompanying_documentation::
679 @node Mouse_and_hotkey_support_in_interactive_terminals, New_terminals, Features_introduced_in_version_4.0, Features_introduced_in_version_4.0
680 @subsection Mouse and hotkey support in interactive terminals
683 Interaction with the current plot via mouse and hotkeys is supported for the
684 X11, OS/2 Presentation Manager, ggi, Windows, and wxWidgets terminals. See
685 `mouse input` for more information on mousing. See help for @ref{bind} for
686 information on hotkeys. Also see the documentation for individual mousing
687 terminals `ggi`, `pm`, `windows`, `wxt` and `x11`.
689 Sample script: mousevariables.dem
692 @node New_terminals, New_plot_style_@ref{pm3d}, Mouse_and_hotkey_support_in_interactive_terminals, Features_introduced_in_version_4.0
693 @subsection New terminals
696 `aqua`: New terminal for Mac OS X. Requires AquaTerm 1.0 or later.
698 `epslatex`: New terminal. Prepares eps figures for inclusion in LaTeX
701 `gif`: Consolidated with png/jpeg terminals. Requires libgd.
703 `ggi`: New full-screen interactive terminal for Linux. Interface to the
704 General Graphics Interface Library.
706 `pdf`: New terminal exporting Adobe Portable Document Format. Requires libpdf.
708 `png` and `jpeg`: Support for GIF, PNG and JPEG image output is provided by a
709 new driver via libgd. The new driver supports many more features than the
710 old png driver, including TrueType fonts. Requires libgd.
712 `svg`: New terminal exporting Scalable Vector Graphics.
715 @node New_plot_style_@ref{pm3d}, Filled_boxes, New_terminals, Features_introduced_in_version_4.0
716 @subsection New plot style @ref{pm3d}
719 The `splot` command is now capable of plotting 2D maps and 3D surfaces
720 colored by greyscale or color palettes. See help for @ref{pm3d}, @ref{palette},
721 @ref{cbrange}, `set view map`, `set colorbox` and @ref{palette}.
723 Sample scripts: pm3d.dem pm3dcolors.dem pm3dgamma.dem
726 @node Filled_boxes, New_plot_option_smooth_frequency, New_plot_style_@ref{pm3d}, Features_introduced_in_version_4.0
727 @subsection Filled boxes
730 A solid color or patterned fill style can be set for any plot style that
731 contains boxes. See `boxes`, `boxerrorbars`, `boxxyerrorbars`,
732 `candlesticks`, `set style fill`.
734 Sample scripts: fillstyle.dem candlesticks.dem
737 @node New_plot_option_smooth_frequency, Improved_text_options, Filled_boxes, Features_introduced_in_version_4.0
738 @subsection New plot option smooth frequency
741 Input data can be filtered through several built-in routines for interpolation
742 or approximation of data. See @ref{smooth}, `frequency`, `unique`.
744 Sample scripts: steps.dem mgr.dem
747 @node Improved_text_options, More_text_encodings, New_plot_option_smooth_frequency, Features_introduced_in_version_4.0
748 @subsection Improved text options
751 Most gnuplot plot commands that produce text labels now accept modifiers to
752 specify text color, font, size, and rotation angle. See @ref{label}.
753 Not all terminal types support these options, however. The enhanced text
754 mode previously available for the postscript and pm terminals has been
755 extended to other terminal types as well. Terminal types currently supported
756 include aqua, dumb, jpeg, pdf, pm, png, postscript, x11, windows, and wxt.
759 Sample scripts: textcolor.dem textrotate.dem
762 @node More_text_encodings, Arrows, Improved_text_options, Features_introduced_in_version_4.0
763 @subsection More text encodings
766 Several terminals, including @ref{postscript}, `x11` and `pm`, support additional
767 text `encodings`: ISO 8859-1 (Latin 1), ISO 8859-2 (Latin 2), ISO 8859-15
768 (variant of 8859-1 with Euro sign), KOI8-R and KOI8-U (cyrillic), and
769 miscellaneous codepages. See @ref{encoding} for more details.
772 @node Arrows, Data_file_format, More_text_encodings, Features_introduced_in_version_4.0
776 Single- or double-ended arrows can be placed on a plot individually from the
777 command line or from a data file via the `plot with vectors` style.
778 See @ref{arrow}, `plotting styles vectors`.
780 Sample scripts: arrowstyle.dem vector.dem
783 @node Data_file_format, New_commands, Arrows, Features_introduced_in_version_4.0
784 @subsection Data file format
787 The new @ref{datafile} command can be used to specify information about the
788 format of input data files, including the characters used to separate fields,
789 to indicate comment lines, and to specify missing data. Gnuplot now attempts
790 to recognize text fields with embedded blanks as single entities based on the
791 datafile format settings. This allows input from csv (comma-separated value)
792 files such as those exported by spreadsheet programs. See @ref{datafile}.
793 See also the `binary` option (introduced in 4.2).
796 @node New_commands, Other_changes_and_additions, Data_file_format, Features_introduced_in_version_4.0
797 @subsection New commands
800 `set view map` selects a top-view 2D projection of 3D surface plot.
802 `set term push` and `set term pop` save and restore the current terminal type.
804 `load` and @ref{save} commands accept piped input and output, respectively.
807 @node Other_changes_and_additions, Accompanying_documentation, New_commands, Features_introduced_in_version_4.0
808 @subsection Other changes and additions
811 Since gnuplot 4.0, `unset <something>` is preferred to `set no<something>`.
812 The older form has been deprecated.
813 Version 4.2 continues to allow the older syntax, but such backwards
814 compatibility may be lost in future versions.
816 Commands of the form `set <something> <style>` also are deprecated in favor
817 of the more general form `set style <something> <options>`. Many more plot
818 elements now have style options of their own, including arrows, filled
819 areas, lines, and points. There are also style settings for input data and
820 formatting. Please see @ref{style}, @ref{decimalsign}, and @ref{datafile}.
822 The MS Windows package includes an additional executable `pgnuplot.exe` to
823 support piping command through standard input, which is otherwise not
824 available for graphical applications on this system.
827 @node Accompanying_documentation, , Other_changes_and_additions, Features_introduced_in_version_4.0
828 @subsection Accompanying documentation
831 In directory docs/psdocs/ you may find new information in the gnuplot output
832 postscript file guide, list of postscript symbols in different encodings.
834 Improved FAQ. Please read it before asking your question in a public forum.
836 There are plenty of new demos *.dem in the demo/ directory. Please run them,
842 before asking for help. Plots produced by the demo scripts can also be viewed
844 @uref{http://www.gnuplot.info/demo/,http://www.gnuplot.info/demo/
848 @node Batch/Interactive_Operation, Command-line-editing, Features_introduced_in_version_4.0, gnuplot
849 @section Batch/Interactive Operation
851 @cindex batch/interactive
853 `gnuplot` may be executed in either batch or interactive modes, and the two
854 may even be mixed together on many systems.
856 Any command-line arguments are assumed to be names of files containing
857 `gnuplot` commands (with the exception of standard X11 arguments, which are
858 processed first). Each file is loaded with the `load` command, in the order
859 specified. `gnuplot` exits after the last file is processed. When no load
860 files are named, `gnuplot` enters into an interactive mode. The special
861 filename "-" is used to denote standard input.
863 Both the @ref{exit} and @ref{quit} commands terminate the current command file and
864 `load` the next one, until all have been processed.
868 To launch an interactive session:
874 To launch a batch session using two command files "input1" and "input2":
876 gnuplot input1 input2
880 To launch an interactive session after an initialization file "header" and
881 followed by another command file "trailer":
883 gnuplot header - trailer
887 @node Command-line-editing, Comments, Batch/Interactive_Operation, gnuplot
888 @section Command-line-editing
894 @cindex command-line-editing
896 Command-line editing is supported by the Unix, Atari, VMS, MS-DOS and OS/2
897 versions of `gnuplot`. Also, a history mechanism allows previous commands to
898 be edited and re-executed. After the command line has been edited, a newline
899 or carriage return will enter the entire line without regard to where the
900 cursor is positioned.
902 (The readline function in `gnuplot` is not the same as the readline used in
903 GNU Bash and GNU Emacs. If the GNU version is desired, it may be selected
904 instead of the `gnuplot` version at compile time.)
907 The editing commands are as follows:
916 ^B moves back a single character.
917 ^F moves forward a single character.
918 ^A moves to the beginning of the line.
919 ^E moves to the end of the line.
920 ^H and DEL delete the previous character.
921 ^D deletes the current character.
922 ^K deletes from current position to the end of line.
923 ^L,^R redraws line in case it gets trashed.
924 ^U deletes the entire line.
925 ^W deletes from the current word to the end of line.
935 ^P moves back through history.
936 ^N moves forward through history.
941 On the IBM PC, the use of a TSR program such as DOSEDIT or CED may be desired
942 for line editing. The default makefile assumes that this is the case; by
943 default `gnuplot` will be compiled with no line-editing capability. If you
944 want to use `gnuplot`'s line editing, set READLINE in the makefile and add
945 readline.obj to the link file. The following arrow keys may be used on the
946 IBM PC and Atari versions if readline is used:
950 Left Arrow - same as ^B.
951 Right Arrow - same as ^F.
952 Ctrl Left Arrow - same as ^A.
953 Ctrl Right Arrow - same as ^E.
954 Up Arrow - same as ^P.
955 Down Arrow - same as ^N.
960 The Atari version of readline defines some additional key aliases:
966 Ctrl Home - same as ^E.
968 Help - @ref{help} plus return.
969 Ctrl Help - @ref{help}.
974 @node Comments, Coordinates, Command-line-editing, gnuplot
979 Comments are supported as follows: a `#` may appear in most places in a line
980 and `gnuplot` will ignore the rest of the line. It will not have this effect
981 inside quotes, inside numbers (including complex numbers), inside command
982 substitutions, etc. In short, it works anywhere it makes sense to work.
984 See also `set datafile commentschars` for specifying comment characters in
987 @node Coordinates, Datastrings, Comments, gnuplot
992 The commands @ref{arrow}, @ref{key}, @ref{label} and @ref{object} allow you
993 to draw something at an arbitrary position on the graph. This position is
994 specified by the syntax:
997 @{<system>@} <x>, @{<system>@} <y> @{,@{<system>@} <z>@}
1001 Each <system> can either be `first`, `second`, `graph`, `screen`, or
1004 `first` places the x, y, or z coordinate in the system defined by the left
1005 and bottom axes; `second` places it in the system defined by the second axes
1006 (top and right); `graph` specifies the area within the axes---0,0 is bottom
1007 left and 1,1 is top right (for splot, 0,0,0 is bottom left of plotting area;
1008 use negative z to get to the base---see @ref{ticslevel}); `screen`
1009 specifies the screen area (the entire area---not just the portion selected by
1010 @ref{size}), with 0,0 at bottom left and 1,1 at top right; and `character`
1011 gives the position in character widths and heights from the bottom left of
1012 the screen area (screen 0,0), `character` coordinates depend on the chosen
1015 If the coordinate system for x is not specified, `first` is used. If the
1016 system for y is not specified, the one used for x is adopted.
1018 In some cases, the given coordinate is not an absolute position but a
1019 relative value (e.g., the second position in @ref{arrow} ... `rto`). In
1020 most cases, the given value serves as difference to the first position.
1021 If the given coordinate resides in a logarithmic axis the value is
1022 interpreted as factor. For example,
1026 set arrow 100,5 rto 10,2
1030 plots an arrow from position 100,5 to position 1000,7 since the x axis is
1031 logarithmic while the y axis is linear.
1033 If one (or more) axis is timeseries, the appropriate coordinate should
1034 be given as a quoted time string according to the @ref{timefmt} format string.
1035 See @ref{xdata} and @ref{timefmt}. `gnuplot` will also accept an integer
1036 expression, which will be interpreted as seconds from 1 January 2000.
1038 @node Datastrings, Environment, Coordinates, gnuplot
1039 @section Datastrings
1043 The configuration option --enable-datastrings allows gnuplot to read and
1044 process text fields in datafiles. A text field consists of either an arbitrary
1045 string of printable characters containing no whitespace or an arbitrary string
1046 of characters, possibly including whitespace, delimited by double quotes.
1047 The following sample line from a datafile is interpreted to contain four
1048 columns, with a text field in column 3:
1051 1.000 2.000 "Third column is all of this text" 4.00
1055 Text fields can be positioned within a 2-D or 3-D plot using the commands:
1058 plot 'datafile' using 1:2:4 with labels
1059 splot 'datafile using 1:2:3:4 with labels
1063 A column of text data can also be used to label the ticmarks along one or more
1064 of the plot axes. The example below plots a line through a series of points
1065 with (X,Y) coordinates taken from columns 3 and 4 of the input datafile.
1066 However, rather than generating regularly spaced tics along the x axis
1067 labeled numerically, gnuplot will position a tic mark along the x axis at the
1068 X coordinate of each point and label the tic mark with text taken from column
1069 1 of the input datafile.
1073 plot 'datafile' using 3:4:xticlabels(1) with linespoints
1077 There is also an option that will interpret the first entry in a column of
1078 input data as a text field, and use it as the key title for data plotted from
1079 that column. The example given below will use the first entry in column 2 to
1080 generate a title in the key box, while processing the remainder of columns
1081 2 and 4 to draw the required line:
1084 plot 'datafile' using 1:(f($2)/$4) title 2 with lines
1088 See `set style labels`, `using xticlabels`, @ref{title}, @ref{using}.
1090 @node Environment, Expressions, Datastrings, gnuplot
1091 @section Environment
1095 A number of shell environment variables are understood by `gnuplot`. None of
1096 these are required, but may be useful.
1098 If GNUTERM is defined, it is used as the name of the terminal type to be
1099 used. This overrides any terminal type sensed by `gnuplot` on start-up, but
1100 is itself overridden by the .gnuplot (or equivalent) start-up file
1101 (see `start-up`) and, of course, by later explicit changes.
1103 On Unix, AmigaOS, AtariTOS, MS-DOS and OS/2, GNUHELP may be defined to be the
1104 pathname of the HELP file (gnuplot.gih).
1106 On VMS, the logical name GNUPLOT$HELP should be defined as the name of the
1107 help library for `gnuplot`. The `gnuplot` help can be put inside any system
1108 help library, allowing access to help from both within and outside `gnuplot`
1111 On Unix, HOME is used as the name of a directory to search for a .gnuplot
1112 file if none is found in the current directory. On AmigaOS, AtariTOS,
1113 MS-DOS, Windows and OS/2, GNUPLOT is used. On Windows, the NT-specific
1114 variable USERPROFILE is tried, too. VMS, SYS$LOGIN: is used. Type `help
1117 On Unix, PAGER is used as an output filter for help messages.
1119 On Unix, AtariTOS and AmigaOS, SHELL is used for the @ref{shell} command. On
1120 MS-DOS and OS/2, COMSPEC is used for the @ref{shell} command.
1122 On MS-DOS, if the BGI or Watcom interface is used, PCTRM is used to tell
1123 the maximum resolution supported by your monitor by setting it to
1124 S<max. horizontal resolution>. E.g. if your monitor's maximum resolution is
1130 If PCTRM is not set, standard VGA is used.
1132 FIT_SCRIPT may be used to specify a `gnuplot` command to be executed when a
1133 fit is interrupted---see @ref{fit}. FIT_LOG specifies the default filename of the
1134 logfile maintained by fit.
1136 GNUPLOT_LIB may be used to define additional search directories for data
1137 and command files. The variable may contain a single directory name, or
1138 a list of directories separated by a platform-specific path separator,
1139 eg. ':' on Unix, or ';' on DOS/Windows/OS/2/Amiga platforms. The contents
1140 of GNUPLOT_LIB are appended to the @ref{loadpath} variable, but not saved
1141 with the @ref{save} and `save set` commands.
1143 Several gnuplot terminal drivers access TrueType fonts via the gd library.
1144 For these drivers the font search path is controlled by the environmental
1145 variable GDFONTPATH. Furthermore, a default font for these drivers may be
1146 set via the environmental variable GNUPLOT_DEFAULT_GDFONT.
1148 The postscript terminal uses its own font search path. It is controlled by
1149 the environmental variable GNUPLOT_FONTPATH. The format is the same as for
1150 GNUPLOT_LIB. The contents of GNUPLOT_FONTPATH are appended to the @ref{fontpath}
1151 variable, but not saved with the @ref{save} and `save set` commands.
1153 GNUPLOT_PS_DIR is used by the postscript driver to use external prologue
1154 files. Depending on the build process, gnuplot contains either a builtin
1155 copy of those files or simply a default hardcoded path. Use this variable
1156 to test the postscript terminal with custom prologue files. See
1157 `postscript prologue`.
1159 @node Expressions, Glossary, Environment, gnuplot
1160 @section Expressions
1164 In general, any mathematical expression accepted by C, FORTRAN, Pascal, or
1165 BASIC is valid. The precedence of these operators is determined by the
1166 specifications of the C programming language. White space (spaces and tabs)
1167 is ignored inside expressions.
1169 Complex constants are expressed as @{<real>,<imag>@}, where <real> and <imag>
1170 must be numerical constants. For example, @{3,2@} represents 3 + 2i; @{0,1@}
1171 represents 'i' itself. The curly braces are explicitly required here.
1173 Note that gnuplot uses both "real" and "integer" arithmetic, like FORTRAN and
1174 C. Integers are entered as "1", "-10", etc; reals as "1.0", "-10.0", "1e1",
1175 3.5e-1, etc. The most important difference between the two forms is in
1176 division: division of integers truncates: 5/2 = 2; division of reals does
1177 not: 5.0/2.0 = 2.5. In mixed expressions, integers are "promoted" to reals
1178 before evaluation: 5/2e0 = 2.5. The result of division of a negative integer
1179 by a positive one may vary among compilers. Try a test like "print -5/2" to
1180 determine if your system chooses -2 or -3 as the answer.
1182 The integer expression "1/0" may be used to generate an "undefined" flag,
1183 which causes a point to ignored; the `ternary` operator gives an example.
1184 Or you can use the pre-defined variable NaN to achieve the same result.
1188 The real and imaginary parts of complex expressions are always real, whatever
1189 the form in which they are entered: in @{3,2@} the "3" and "2" are reals, not
1192 Gnuplot can also perform simple operations on strings and string variables.
1193 For example, the expression ("A" . "B" eq "AB") evaluates as true, illustrating
1194 the string concatenation operator and the string equality operator.
1196 A string which contains a numerical value is promoted to the corresponding
1197 integer or real value if used in a numerical expression. Thus ("3" + "4" == 7)
1198 and (6.78 == "6.78") both evaluate to true. An integer, but not a real or
1199 complex value, is promoted to a string if used in string concatenation.
1200 A typical case is the use of integers to construct file names or other strings;
1201 e.g. ("file" . 4 eq "file4") is true.
1203 Substrings can be specified using a postfixed range descriptor [beg:end].
1204 For example, "ABCDEF"[3:4] == "CD" and "ABCDEF"[4:*] == "DEF"
1205 The syntax "string"[beg:end] is exactly equivalent to calling the built-in
1206 string-valued function substr("string",beg,end), except that you cannot
1207 omit either beg or end from the function call.
1212 * Gnuplot-defined_variables::
1213 * User-defined_variables_and_functions::
1216 @node Functions, Operators, Expressions, Expressions
1217 @subsection Functions
1219 @c ?expressions functions
1224 The functions in `gnuplot` are the same as the corresponding functions in
1225 the Unix math library, except that all functions accept integer, real, and
1226 complex arguments, unless otherwise noted.
1228 For those functions that accept or return angles that may be given in either
1229 degrees or radians (sin(x), cos(x), tan(x), asin(x), acos(x), atan(x),
1230 atan2(x) and arg(z)), the unit may be selected by @ref{angles}, which
1231 defaults to radians.
1300 * Random_number_generator::
1303 @node abs, acos, Functions, Functions
1306 @c ?expressions functions abs
1312 The `abs(x)` function returns the absolute value of its argument. The
1313 returned value is of the same type as the argument.
1315 For complex arguments, abs(x) is defined as the length of x in the complex
1316 plane [i.e., sqrt(real(x)**2 + imag(x)**2) ].
1318 @node acos, acosh, abs, Functions
1321 @c ?expressions functions acos
1327 The `acos(x)` function returns the arc cosine (inverse cosine) of its
1328 argument. `acos` returns its argument in radians or degrees, as selected by
1331 @node acosh, arg, acos, Functions
1332 @subsubsection acosh
1334 @c ?expressions functions acosh
1340 The `acosh(x)` function returns the inverse hyperbolic cosine of its argument
1343 @node arg, asin, acosh, Functions
1346 @c ?expressions functions arg
1352 The `arg(x)` function returns the phase of a complex number in radians or
1353 degrees, as selected by @ref{angles}.
1355 @node asin, asinh, arg, Functions
1358 @c ?expressions functions asin
1364 The `asin(x)` function returns the arc sin (inverse sin) of its argument.
1365 `asin` returns its argument in radians or degrees, as selected by @ref{angles}.
1367 @node asinh, atan, asin, Functions
1368 @subsubsection asinh
1370 @c ?expressions functions asinh
1376 The `asinh(x)` function returns the inverse hyperbolic sin of its argument in
1379 @node atan, atan2, asinh, Functions
1382 @c ?expressions functions atan
1388 The `atan(x)` function returns the arc tangent (inverse tangent) of its
1389 argument. `atan` returns its argument in radians or degrees, as selected by
1392 @node atan2, atanh, atan, Functions
1393 @subsubsection atan2
1395 @c ?expressions functions atan2
1401 The `atan2(y,x)` function returns the arc tangent (inverse tangent) of the
1402 ratio of the real parts of its arguments. @ref{atan2} returns its argument in
1403 radians or degrees, as selected by @ref{angles}, in the correct quadrant.
1405 @node atanh, besj0, atan2, Functions
1406 @subsubsection atanh
1408 @c ?expressions functions atanh
1414 The `atanh(x)` function returns the inverse hyperbolic tangent of its
1415 argument in radians.
1417 @node besj0, besj1, atanh, Functions
1418 @subsubsection besj0
1420 @c ?expressions functions besj0
1426 The `besj0(x)` function returns the j0th Bessel function of its argument.
1427 @ref{besj0} expects its argument to be in radians.
1429 @node besj1, besy0, besj0, Functions
1430 @subsubsection besj1
1432 @c ?expressions functions besj1
1438 The `besj1(x)` function returns the j1st Bessel function of its argument.
1439 @ref{besj1} expects its argument to be in radians.
1441 @node besy0, besy1, besj1, Functions
1442 @subsubsection besy0
1444 @c ?expressions functions besy0
1450 The `besy0(x)` function returns the y0th Bessel function of its argument.
1451 @ref{besy0} expects its argument to be in radians.
1453 @node besy1, ceil, besy0, Functions
1454 @subsubsection besy1
1456 @c ?expressions functions besy1
1462 The `besy1(x)` function returns the y1st Bessel function of its argument.
1463 @ref{besy1} expects its argument to be in radians.
1465 @node ceil, cos, besy1, Functions
1468 @c ?expressions functions ceil
1474 The `ceil(x)` function returns the smallest integer that is not less than its
1475 argument. For complex numbers, @ref{ceil} returns the smallest integer not less
1476 than the real part of its argument.
1478 @node cos, cosh, ceil, Functions
1481 @c ?expressions functions cos
1487 The `cos(x)` function returns the cosine of its argument. `cos` accepts its
1488 argument in radians or degrees, as selected by @ref{angles}.
1490 @node cosh, erf, cos, Functions
1493 @c ?expressions functions cosh
1499 The `cosh(x)` function returns the hyperbolic cosine of its argument. @ref{cosh}
1500 expects its argument to be in radians.
1502 @node erf, erfc, cosh, Functions
1505 @c ?expressions functions erf
1511 The `erf(x)` function returns the error function of the real part of its
1512 argument. If the argument is a complex value, the imaginary component is
1513 ignored. See @ref{erfc}, @ref{inverf}, and @ref{norm}.
1515 @node erfc, exp, erf, Functions
1518 @c ?expressions functions erfc
1524 The `erfc(x)` function returns 1.0 - the error function of the real part of
1525 its argument. If the argument is a complex value, the imaginary component is
1526 ignored. See `erf`, @ref{inverf}, and @ref{norm}.
1528 @node exp, floor, erfc, Functions
1531 @c ?expressions functions exp
1537 The `exp(x)` function returns the exponential function of its argument (`e`
1538 raised to the power of its argument). On some implementations (notably
1539 suns), exp(-x) returns undefined for very large x. A user-defined function
1540 like safe(x) = x<-100 ? 0 : exp(x) might prove useful in these cases.
1542 @node floor, gamma, exp, Functions
1543 @subsubsection floor
1545 @c ?expressions functions floor
1551 The `floor(x)` function returns the largest integer not greater than its
1552 argument. For complex numbers, @ref{floor} returns the largest integer not
1553 greater than the real part of its argument.
1555 @node gamma, ibeta, floor, Functions
1556 @subsubsection gamma
1558 @c ?expressions functions gamma
1564 The `gamma(x)` function returns the gamma function of the real part of its
1565 argument. For integer n, gamma(n+1) = n!. If the argument is a complex
1566 value, the imaginary component is ignored.
1568 @node ibeta, inverf, gamma, Functions
1569 @subsubsection ibeta
1571 @c ?expressions functions ibeta
1577 The `ibeta(p,q,x)` function returns the incomplete beta function of the real
1578 parts of its arguments. p, q > 0 and x in [0:1]. If the arguments are
1579 complex, the imaginary components are ignored.
1581 @node inverf, igamma, ibeta, Functions
1582 @subsubsection inverf
1584 @c ?expressions functions inverf
1585 @c ?functions inverf
1590 The `inverf(x)` function returns the inverse error function of the real part
1591 of its argument. See `erf` and @ref{invnorm}.
1593 @node igamma, imag, inverf, Functions
1594 @subsubsection igamma
1596 @c ?expressions functions igamma
1597 @c ?functions igamma
1602 The `igamma(a,x)` function returns the normalized incomplete gamma
1603 function of the real parts of its arguments, where a > 0 and x >= 0.
1604 The standard notation is P(a,x), e.g. Abramowitz and Stegun (6.5.1),
1605 with limiting value of 1 as x approaches infinity. If the arguments
1606 are complex, the imaginary components are ignored.
1608 @node imag, invnorm, igamma, Functions
1611 @c ?expressions functions imag
1617 The `imag(x)` function returns the imaginary part of its argument as a real
1620 @node invnorm, int, imag, Functions
1621 @subsubsection invnorm
1623 @c ?expressions functions invnorm
1624 @c ?functions invnorm
1629 The `invnorm(x)` function returns the inverse cumulative normal (Gaussian)
1630 distribution function of the real part of its argument. See @ref{norm}.
1632 @node int, lambertw, invnorm, Functions
1635 @c ?expressions functions int
1641 The `int(x)` function returns the integer part of its argument, truncated
1644 @node lambertw, lgamma, int, Functions
1645 @subsubsection lambertw
1647 @c ?expressions functions lambertw
1648 @c ?functions lambertw
1653 The lambertw function returns the value of the principal branch of
1654 Lambert's W function, which is defined by the equation (W(z)*exp(W(z))=z.
1655 z must be a real number with z >= -exp(-1).
1657 @node lgamma, log, lambertw, Functions
1658 @subsubsection lgamma
1660 @c ?expressions functions lgamma
1661 @c ?functions lgamma
1666 The `lgamma(x)` function returns the natural logarithm of the gamma function
1667 of the real part of its argument. If the argument is a complex value, the
1668 imaginary component is ignored.
1670 @node log, log10, lgamma, Functions
1673 @c ?expressions functions log
1679 The `log(x)` function returns the natural logarithm (base `e`) of its
1680 argument. See @ref{log10}.
1682 @node log10, norm, log, Functions
1683 @subsubsection log10
1685 @c ?expressions functions log10
1691 The `log10(x)` function returns the logarithm (base 10) of its argument.
1693 @node norm, rand, log10, Functions
1696 @c ?expressions functions norm
1702 The `norm(x)` function returns the cumulative normal (Gaussian) distribution
1703 function of the real part of its argument. See @ref{invnorm}, `erf` and @ref{erfc}.
1705 @node rand, real, norm, Functions
1708 @c ?expressions functions rand
1714 `rand(0)` returns a pseudo random number in the interval [0:1] generated
1716 from the current value of two internal 32-bit seeds.
1719 `rand(-1)` resets both seeds to a standard value.
1720 `rand(x)` for x>0 sets both seeds to a value based on the value of x.
1721 `rand(@{x,y@})` for x>0 sets seed1 to x and seed2 to y.
1722 Note: This behavior has changed starting with gnuplot version 3.8l. Older
1723 scripts that expected rand(x>0) to produce sequential pseudo-random numbers
1724 from the same seeded sequence must be changed to call rand(0) instead.
1726 @node real, sgn, rand, Functions
1729 @c ?expressions functions real
1735 The `real(x)` function returns the real part of its argument.
1737 @node sgn, sin, real, Functions
1740 @c ?expressions functions sgn
1746 The `sgn(x)` function returns 1 if its argument is positive, -1 if its
1747 argument is negative, and 0 if its argument is 0. If the argument is a
1748 complex value, the imaginary component is ignored.
1750 @node sin, sinh, sgn, Functions
1753 @c ?expressions functions sin
1759 The `sin(x)` function returns the sine of its argument. `sin` expects its
1760 argument to be in radians or degrees, as selected by @ref{angles}.
1762 @node sinh, sqrt, sin, Functions
1765 @c ?expressions functions sinh
1771 The `sinh(x)` function returns the hyperbolic sine of its argument. @ref{sinh}
1772 expects its argument to be in radians.
1774 @node sqrt, tan, sinh, Functions
1777 @c ?expressions functions sqrt
1783 The `sqrt(x)` function returns the square root of its argument.
1785 @node tan, tanh, sqrt, Functions
1788 @c ?expressions functions tan
1794 The `tan(x)` function returns the tangent of its argument. `tan` expects
1795 its argument to be in radians or degrees, as selected by @ref{angles}.
1797 @node tanh, gprintf, tan, Functions
1800 @c ?expressions functions tanh
1806 The `tanh(x)` function returns the hyperbolic tangent of its argument. @ref{tanh}
1807 expects its argument to be in radians.
1812 @node gprintf, sprintf, tanh, Functions
1813 @subsubsection gprintf
1815 @c ?expressions functions gprintf
1816 @c ?functions gprintf
1817 `gprintf("format",x)` applies gnuplot's own format specifiers to the single
1818 variable x and returns the resulting string. If you want standard C-language
1819 format specifiers, you must instead use `sprintf("format",x)`.
1820 See `format specifiers`.
1822 @node sprintf, strlen, gprintf, Functions
1823 @subsubsection sprintf
1825 @c ?expressions functions sprintf
1826 @c ?functions sprintf
1831 `sprintf("format",var1,var2,...)` applies standard C-language format specifiers
1832 to multiple arguments (10 max) and returns the resulting string. If you want to
1833 use gnuplot's own format specifiers, you must instead call `gprintf()`.
1834 For information on sprintf format specifiers, please see standard C-language
1835 documentation or the unix sprintf man page.
1837 @node strlen, strstrt, sprintf, Functions
1838 @subsubsection strlen
1840 @c ?expressions functions strlen
1841 @c ?functions strlen
1846 `strlen("string")` returns the number of characters in the string.
1848 @node strstrt, substr, strlen, Functions
1849 @subsubsection strstrt
1851 @c ?expressions functions strstrt
1852 @c ?functions strstrt
1857 `strstrt("string","key")` searches for the character string "key" in "string"
1858 and returns the index to the first character of "key". If "key" is not found,
1859 returns 0. Similar to C library function strstr except that it returns an
1860 index rather than a string pointer. strstrt("hayneedlestack","needle") = 4.
1862 @node substr, strftime, strstrt, Functions
1863 @subsubsection substr
1865 @c ?expressions functions substr
1866 @c ?functions substr
1873 `substr("string",beg,end)` returns the substring consisting of characters
1874 beg through end of the original string. This is exactly equivalent to the
1875 expression "string"[beg:end] except that you do not have the option of
1876 ommitting beg or end.
1878 @node strftime, strptime, substr, Functions
1879 @subsubsection strftime
1881 @c ?expressions functions strftime
1882 @c ?functions strftime
1887 `strftime("timeformat",t)` applies the timeformat specifiers to the time t
1888 given in seconds since the year 2000.
1889 See `time_specifiers` and @ref{strptime}.
1891 @node strptime, system, strftime, Functions
1892 @subsubsection strptime
1894 @c ? expressions functions strptime
1895 @c ?functions strptime
1900 `strptime("timeformat",s)` reads the time from the string s using the
1901 timeformat specifiers and converts it into seconds since the year 2000.
1902 See `time_specifiers` and @ref{strftime}.
1904 @node system, word, strptime, Functions
1905 @subsubsection system
1907 @c ?expressions functions system
1908 @c ?functions system
1914 `system("command")` executes "command" using the standard shell and returns
1915 the resulting character stream from stdout as string variable.
1916 One optional trailing newline is ignored.
1918 This can be used to import external functions into gnuplot scripts using
1919 'f(x) = real(system(sprintf("somecommand %f", x)))'.
1921 @node word, words, system, Functions
1924 @c ?expressions functions word
1934 `word("string",n)` returns the nth word in string. For example,
1935 `word("one two three",2)` returns the string "two".
1937 @node words, column, word, Functions
1938 @subsubsection words
1940 @c ?expressions functions words
1950 `words("string")` returns the number of words in string. For example,
1951 `words(" a b c d")` returns the 4.
1956 @node column, defined, words, Functions
1957 @subsubsection column
1959 @c ?expressions functions column
1960 @c ?functions column
1965 `column(x)` may be used only in expressions as part of @ref{using} manipulations
1966 to fits or datafile plots. It evaluates to the numerical value of the contents
1967 of column x. See @ref{using}.
1969 @node defined, exists, column, Functions
1970 @subsubsection defined
1972 @c ?expressions functions defined
1973 @c ?functions defined
1978 `defined(X)` [DEPRECATED] returns 1 if a variable named X has been defined, otherwise
1981 @node exists, stringcolumn, defined, Functions
1982 @subsubsection exists
1984 @c ?expressions functions exists
1985 @c ?functions exists
1990 The argument to exists() is a string constant or a string variable;
1991 if the string contains the name of a defined variable, the function returns 1.
1992 Otherwise the function returns 0.
1994 @node stringcolumn, timecolumn, exists, Functions
1995 @subsubsection stringcolumn
1997 @c ?expressions functions stringcolumn
1998 @c ?functions stringcolumn
1999 @cindex stringcolumn
2000 @findex stringcolumn
2003 @c ?expressions functions strcol
2004 @c ?functions strcol
2007 `stringcolumn(x)` may be used only in expressions as part of @ref{using} manipulations
2008 to fits or datafile plots. It returns the content of column x as a string variable.
2011 @node timecolumn, tm_hour, stringcolumn, Functions
2012 @subsubsection timecolumn
2014 @c ?expressions functions timecolumn
2015 @c ?functions timecolumn
2020 `timecolumn(x)` may be used only in expressions as part of @ref{using}
2021 manipulations to fits or datafile plots. See @ref{using}.
2023 It reads the data starting at that column as a time/date value and
2024 returns its value in gnuplot's internal time representation of
2025 "seconds since the millennium".
2027 To find the right @ref{timefmt} string to use, @ref{timecolumn} searches for a
2028 @ref{using} specification with the same column number as its argument.
2029 If one is found, @ref{timefmt} pattern of the target axis for this specifier
2030 is used. Otherwise, @ref{timecolumn} chooses the x axis @ref{timefmt} per default.
2032 @node tm_hour, tm_mday, timecolumn, Functions
2033 @subsubsection tm_hour
2035 @c ?expressions tm_hour
2037 @c ?functions tm_hour
2042 The @ref{tm_hour} function interprets its argument as a time, in seconds from
2043 1 Jan 2000. It returns the hour (an integer in the range 0--23) as a real.
2045 @node tm_mday, tm_min, tm_hour, Functions
2046 @subsubsection tm_mday
2048 @c ?expressions tm_mday
2050 @c ?functions tm_mday
2055 The @ref{tm_mday} function interprets its argument as a time, in seconds from
2056 1 Jan 2000. It returns the day of the month (an integer in the range 1--31)
2059 @node tm_min, tm_mon, tm_mday, Functions
2060 @subsubsection tm_min
2062 @c ?expressions tm_min
2064 @c ?functions tm_min
2069 The @ref{tm_min} function interprets its argument as a time, in seconds from
2070 1 Jan 2000. It returns the minute (an integer in the range 0--59) as a real.
2072 @node tm_mon, tm_sec, tm_min, Functions
2073 @subsubsection tm_mon
2075 @c ?expressions tm_mon
2077 @c ?functions tm_mon
2082 The @ref{tm_mon} function interprets its argument as a time, in seconds from
2083 1 Jan 2000. It returns the month (an integer in the range 0--11) as a real.
2085 @node tm_sec, tm_wday, tm_mon, Functions
2086 @subsubsection tm_sec
2088 @c ?expressions tm_sec
2090 @c ?functions tm_sec
2095 The @ref{tm_sec} function interprets its argument as a time, in seconds from
2096 1 Jan 2000. It returns the second (an integer in the range 0--59) as a real.
2098 @node tm_wday, tm_yday, tm_sec, Functions
2099 @subsubsection tm_wday
2101 @c ?expressions tm_wday
2103 @c ?functions tm_wday
2108 The @ref{tm_wday} function interprets its argument as a time, in seconds from
2109 1 Jan 2000. It returns the day of the week (an integer in the range 0--6) as
2112 @node tm_yday, tm_year, tm_wday, Functions
2113 @subsubsection tm_yday
2115 @c ?expressions tm_yday
2117 @c ?functions tm_yday
2122 The @ref{tm_yday} function interprets its argument as a time, in seconds from
2123 1 Jan 2000. It returns the day of the year (an integer in the range 1--366)
2126 @node tm_year, valid, tm_yday, Functions
2127 @subsubsection tm_year
2129 @c ?expressions tm_year
2131 @c ?functions tm_year
2136 The @ref{tm_year} function interprets its argument as a time, in seconds from
2137 1 Jan 2000. It returns the year (an integer) as a real.
2139 @node valid, Random_number_generator, tm_year, Functions
2140 @subsubsection valid
2142 @c ?expressions functions valid
2148 `valid(x)` may be used only in expressions as part of @ref{using} manipulations
2149 to fits or datafile plots. See @ref{using}.
2152 @uref{http://www.gnuplot.info/demo/airfoil.html,airfoil.dem: use of functions and complex variables for airfoils demo.
2156 @node Random_number_generator, , valid, Functions
2157 @subsubsection Random number generator
2159 @c ?expressions random
2160 @c ?functions random
2163 The behavior of the built-in function `rand(x)` has changed as of version 3.8l.
2164 Older scripts that expected rand(x>0) to produce sequential pseudo-random
2165 numbers from the same seeded sequence must be changed to call rand(0) instead.
2166 The current behavior is as follows:
2168 `rand(0)` returns a pseudo random number in the interval [0:1] generated
2169 from the current value of two internal 32-bit seeds.
2170 `rand(-1)` resets both seeds to a standard value.
2171 `rand(x)` for x>0 sets both seeds to a value based on the value of x.
2172 `rand(@{x,y@})` for x>0 sets seed1 to x and seed2 to y.
2177 @node Operators, Gnuplot-defined_variables, Functions, Expressions
2178 @subsection Operators
2180 @c ?expressions operators
2183 The operators in `gnuplot` are the same as the corresponding operators in the
2184 C programming language, except that all operators accept integer, real, and
2185 complex arguments, unless otherwise noted. The ** operator (exponentiation)
2186 is supported, as in FORTRAN.
2188 Parentheses may be used to change order of evaluation.
2196 @node Unary, Binary, Operators, Operators
2197 @subsubsection Unary
2199 @c ?expressions operators unary
2203 The following is a list of all the unary operators and their usages:
2207 Symbol Example Explanation
2209 + +a unary plus (no-operation)
2210 ~ ~a * one's complement
2211 ! !a * logical negation
2213 $ $3 * call arg/column during @ref{using} manipulation
2220 @cindex one's complement
2222 @cindex operator precedence
2225 (*) Starred explanations indicate that the operator requires an integer
2228 Operator precedence is the same as in Fortran and C. As in those languages,
2229 parentheses may be used to change the order of operation. Thus -2**2 = -4,
2232 The factorial operator returns a real number to allow a greater range.
2234 @node Binary, Ternary, Unary, Operators
2235 @subsubsection Binary
2237 @c ?expressions operators binary
2238 @c ?operators binary
2239 The following is a list of all the binary operators and their usages:
2243 Symbol Example Explanation
2244 ** a**b exponentiation
2245 * a*b multiplication
2253 <= a<=b less than or equal to
2255 >= a>=b greater than or equal to
2257 ^ a^b * bitwise exclusive OR
2258 | a|b * bitwise inclusive OR
2259 && a&&b * logical AND
2260 || a||b * logical OR
2261 . A.B string concatenation
2262 eq A eq B string equality
2263 ne A ne B string inequality
2266 @cindex bitwise operators
2268 @cindex string operators
2272 @cindex exponentiation
2276 (*) Starred explanations indicate that the operator requires integer
2278 Capital letters A and B indicate that the operator requires string arguments.
2280 Logical AND (&&) and OR (||) short-circuit the way they do in C. That is,
2281 the second `&&` operand is not evaluated if the first is false; the second
2282 `||` operand is not evaluated if the first is true.
2284 @node Ternary, , Binary, Operators
2285 @subsubsection Ternary
2287 @c ?expressions operators ternary
2288 @c ?operators ternary
2291 There is a single ternary operator:
2295 Symbol Example Explanation
2296 ?: a?b:c ternary operation
2301 The ternary operator behaves as it does in C. The first argument (a), which
2302 must be an integer, is evaluated. If it is true (non-zero), the second
2303 argument (b) is evaluated and returned; otherwise the third argument (c) is
2304 evaluated and returned.
2306 The ternary operator is very useful both in constructing piecewise functions
2307 and in plotting points only when certain conditions are met.
2311 Plot a function that is to equal sin(x) for 0 <= x < 1, 1/x for 1 <= x < 2,
2312 and undefined elsewhere:
2314 f(x) = 0<=x && x<1 ? sin(x) : 1<=x && x<2 ? 1/x : 1/0
2318 @c ^ <img align=bottom src="http://www.gnuplot.info/doc/ternary.gif" alt="[ternary.gif]" width=640 height=480>
2319 Note that `gnuplot` quietly ignores undefined values, so the final branch of
2320 the function (1/0) will produce no plottable points. Note also that f(x)
2321 will be plotted as a continuous function across the discontinuity if a line
2322 style is used. To plot it discontinuously, create separate functions for the
2323 two pieces. (Parametric functions are also useful for this purpose.)
2325 For data in a file, plot the average of the data in columns 2 and 3 against
2326 the datum in column 1, but only if the datum in column 4 is non-negative:
2329 plot 'file' using 1:( $4<0 ? 1/0 : ($2+$3)/2 )
2333 Please see @ref{using} for an explanation of the @ref{using} syntax.
2336 @node Gnuplot-defined_variables, User-defined_variables_and_functions, Operators, Expressions
2337 @subsection Gnuplot-defined variables
2339 @c ?gnuplot-defined variables
2340 The variable `pi` is defined to be pi, see
2346 Additionally, gnuplot may define some variables under various operations.
2348 Working with interactive terminals with `mouse` functionality defines
2349 variables with names that begin "MOUSE_", see @ref{variables} for details.
2351 Further, there are several "read-only" variables that begin "GPVAL_", like
2352 GPVAL_TERM, GPVAL_X_MIN, GPVAL_X_MAX, GPVAL_Y_MIN,... Type `show variables all`
2353 to display their list and values. Values related to axes parameters (ranges, log
2354 base) are values used during the last plot, not those currently `set`.
2356 The @ref{fit} mechanism uses several variables with names that begin "FIT_". It
2357 is safest to avoid using such names. "FIT_LIMIT", however, is one that you
2358 may wish to redefine. Under `set fit errorvariables`, the error for each
2359 fitted parameter will be stored in a variable named like the parameter, but
2360 with "_err" appended. See the documentation on @ref{fit} for details.
2362 See @ref{variables}, @ref{variables}, and @ref{fit}.
2365 @node User-defined_variables_and_functions, , Gnuplot-defined_variables, Expressions
2366 @subsection User-defined variables and functions
2368 @c ?expressions user-defined
2369 @c ?user-defined variables
2370 @cindex user-defined
2376 New user-defined variables and functions of one through five variables may
2377 be declared and used anywhere, including on the `plot` command itself.
2379 User-defined function syntax:
2381 <func-name>( <dummy1> @{,<dummy2>@} ... @{,<dummy5>@} ) = <expression>
2385 where <expression> is defined in terms of <dummy1> through <dummy5>.
2387 User-defined variable syntax:
2389 <variable-name> = <constant-expression>
2396 q = floor(tan(pi/2 - 0.1))
2398 sinc(x) = sin(pi*x)/(pi*x)
2400 ramp(t) = (t > 0) ? t : 0
2401 min(a,b) = (a < b) ? a : b
2402 comb(n,k) = n!/(k!*(n-k)!)
2403 len3d(x,y,z) = sqrt(x*x+y*y+z*z)
2404 plot f(x) = sin(x*a), a = 0.2, f(x), a = 0.4, f(x)
2410 file(n) = sprintf("run_%d.dat",n)
2414 @c ^ <img align=bottom src="http://www.gnuplot.info/doc/userdefined.gif" alt="[userdefined.gif]" width=640 height=480>
2415 The final two examples illustrate a user-defined string variable and a
2416 user-defined string function.
2422 Note that the variables `pi` (3.14159...) and `NaN` (IEEE "Not a Number") are
2423 already defined. You can redefine these to something else if you really need
2424 to. The original values can be recovered by setting:
2432 Other variables may be defined under various gnuplot operations like mousing in
2433 interactive terminals or fitting; see @ref{variables} for details.
2435 You can check for existence of a given variable V by the exists("V")
2436 expression. For example
2439 if (exists("a")) print "a is defined"
2440 if (!exists("b")) print "b is not defined"
2444 Valid names are the same as in most programming languages: they must begin
2445 with a letter, but subsequent characters may be letters, digits, "$", or "_".
2447 See @ref{functions}, @ref{functions}, @ref{variables}, @ref{macros}.
2449 @node Glossary, linetype, Expressions, gnuplot
2454 Throughout this document an attempt has been made to maintain consistency of
2455 nomenclature. This cannot be wholly successful because as `gnuplot` has
2456 evolved over time, certain command and keyword names have been adopted that
2457 preclude such perfection. This section contains explanations of the way
2458 some of these terms are used.
2460 A "page" or "screen" is the entire area addressable by `gnuplot`. On a
2461 monitor, it is the full screen; on a plotter, it is a single sheet of paper.
2463 A screen may contain one or more "plots". A plot is defined by an abscissa
2464 and an ordinate, although these need not actually appear on it, as well as
2465 the margins and any text written therein.
2467 A plot contains one "graph". A graph is defined by an abscissa and an
2468 ordinate, although these need not actually appear on it.
2470 A graph may contain one or more "lines". A line is a single function or
2471 data set. "Line" is also a plotting style. The word will also be used in
2472 sense "a line of text". Presumably the context will remove any ambiguity.
2474 The lines on a graph may have individual names. These may be listed
2475 together with a sample of the plotting style used to represent them in
2476 the "key", sometimes also called the "legend".
2478 The word "title" occurs with multiple meanings in `gnuplot`. In this
2479 document, it will always be preceded by the adjective "plot", "line", or
2480 "key" to differentiate among them.
2482 A 2-d graph may have up to four labelled axes. The names of the four axes
2483 for these usages are "x" for the axis along the bottom border of the plot,
2484 "y" for the left border, "x2" for the top border, and "y2" for the right
2487 A 3-d graph may have up to three labelled axes -- "x", "y" and "z". It is
2488 not possible to say where on the graph any particular axis will fall because
2489 you can change the direction from which the graph is seen with @ref{view}.
2491 When discussing data files, the term "record" will be resurrected and used
2492 to denote a single line of text in the file, that is, the characters between
2493 newline or end-of-record characters. A "point" is the datum extracted from
2494 a single record. A "datablock" is a set of points from consecutive records,
2495 delimited by blank records. A line, when referred to in the context of a
2496 data file, is a subset of a datablock.
2498 @node linetype, mouse_input, Glossary, gnuplot
2499 @section linetype, colors, and styles
2505 Each gnuplot terminal type provides a set of distinct "linetypes". These may
2506 differ in color, in thickness, in dot/dash pattern, or in some combination of
2507 color and dot/dash. The default linetypes for a particular terminal can be
2508 previewed by issuing the @ref{test} command after setting the terminal type.
2509 The pre-defined colors and dot/dash patterns are not guaranteed to be
2510 consistent for all terminal types, but all terminals use the special linetype
2511 -1 to mean a solid line in the primary foreground color (normally black).
2512 By default, successive functions or datafiles plotted by a single command will
2513 be assigned successive linetypes. You can override this default by specifying
2514 a particular linetype for any function, datafile, or plot element.
2519 plot "foo", "bar" # plot two files using linetypes 1, 2
2520 plot sin(x) linetype 4 # terminal-specific linetype color 4
2521 plot sin(x) lt -1 # black
2527 For many terminal types it is also possible to assign user-defined colors
2528 using explicit rgb (red, green, blue) values, named colors, or color values
2529 that refer to the current PM3D palette.
2534 plot sin(x) lt rgb "violet" # one of gnuplot's named colors
2535 plot sin(x) lt rgb "#FF00FF" # explicit RGB triple in hexadecimal
2536 plot sin(x) lt palette cb -45 # whatever color corresponds to -45
2537 # in the current cbrange of the palette
2538 plot sin(x) lt palette frac 0.3 # fractional value along the palette
2542 See @ref{colornames}, @ref{palette}, @ref{cbrange}.
2544 For terminals that support dot/dash patterns, each default linetype has both
2545 a dot-dash pattern and a default color. However, you can override the default
2546 color by using the keyword `linecolor`, abbreviated `lc`. For example, the
2547 postscript terminal provides a dashed blue line as linetype 3. The plot
2548 commands below use this same dash pattern for three plots, one in blue (the
2549 default), another in red (the default for linetype 1), and a third in gold.
2554 set term postscript dashed color
2555 plot 'foo' lt 3, 'baz' lt 3 linecolor 1, 'bar' lt 3 lc rgb 'gold'
2559 Lines can have additional properties such as linewidth. You can associate
2560 these various properties, as well as equivalent properties for point symbols,
2561 into user-defined "line styles" using the command `set style line`. Once
2562 you have defined a linestyle, you can use it in a plot command to control
2563 the appearance of one or more plot elements.
2568 # define a new line style with terminal-independent color cyan,
2569 # linewidth 3, and associated point type 6 (a circle with a dot in it).
2570 set style line 5 lt rgb "cyan" lw 3 pt 6
2571 plot sin(x) with linespoints ls 5 # user-defined line style 5
2575 See `linestyle`, `set style line`.
2581 @node colorspec, , linetype, linetype
2582 @subsection colorspec
2598 Many commands allow you to specify a linetype with an explicit color.
2599 Note that not all terminals support RGB colors or pm3d palette colors.
2604 ... @{linetype | lt@} <colorspec>
2605 ... @{linecolor | lc@} <colorspec>
2606 ... @{textcolor | tc@} <colorspec>
2610 where <colorspec> has one of the following forms:
2613 rgbcolor "colorname"
2616 palette frac <val> # <val> runs from 0 to 1
2617 palette cb <value> # <val> lies within cbrange
2619 variable # color index is read from input file
2623 "colorname" refers to one of the color names built in to gnuplot. For a list
2624 of the available names, see @ref{colornames}.
2626 "#RRGGBB" is a hexadecimal constant preceded by the "#" symbol. The RRGGBB
2627 represents the red, green, and blue components of the color, each on a scale
2628 from 0 - 255. For example, magenta = full-scale red + full-scale blue would
2629 be represented by #FF00FF, which is the hexadecimal representation of
2630 (255 << 16) + (0 << 8) + (255).
2632 "rgb variable" requires an additional column in the @ref{using} specifier, and
2633 is only available in 3D plotting mode (splot). The extra column is interpreted
2634 as a 24-bit packed RGB triple. These are most easily specified in a data file
2635 as hexadecimal values (see above).
2640 rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
2641 splot "data" using 1:2:3:(rgb($1,$2,$3)) with points lc rgb variable
2645 The color palette is a linear gradient of colors that smoothly maps a
2646 single numerical value onto a particular color. Two such mappings are always
2647 in effect. `palette frac` maps a fractional value between 0 and 1 onto the
2648 full range of the color palette. `palette cb` maps the range of the color
2649 axis onto the same palette. See @ref{cbrange}. See also `set colorbox`.
2650 You can use either of these to select a constant color from the current
2653 "palette z" maps the z value of each plot segment or plot element into the
2654 cbrange mapping of the palette. This allows smoothly-varying color along a
2655 3D line or surface. It also allows coloring 2D plots by palette values read
2656 from an extra column of data.
2659 * linecolor_variable::
2662 @node linecolor_variable, , colorspec, colorspec
2663 @subsubsection linecolor variable
2665 @c ?linecolor variable
2667 @c ?textcolor variable
2669 Most plot commands assign a single color (linetype) to each element of the
2670 plot. If there are multiple plots on a single graph, the default color
2671 (linetype) is incremented sequentially. You can instead assign a separate
2672 color for each data point, line segment, or label based on additional
2673 information in the input data file. This is indicated by the colorspec
2676 `lc variable` tells the program to use the value read from one column of the
2677 input data as a linestyle index, and use the color belonging to that linestyle.
2678 This requires a corresponding additional column in the @ref{using} specifier.
2679 Text colors can be set similarly using `tc variable`.
2681 A single data file may contain multiple sets of data, separated by two blank
2682 lines. Each of these separate sets is assigned an index value (see @ref{index})
2683 that can be retrieved via the using specifier column(-2).
2684 All data in the file is drawn with the same color/linestyle/pointtype
2685 properties by default. The command `lc variable` can be used to assign
2686 different colors to each data set in the file by using the index value from
2691 # Use the third column of data to assign colors to individual points
2692 plot 'data' using 1:2:3 with points lc variable
2697 # Use the data set index to choose a linestyle color
2698 plot 'data' using 1:2:(column(-2)) with lines lc variable
2703 @node mouse_input, Plotting, linetype, gnuplot
2704 @section mouse input
2707 The `x11`, `pm`, `windows`, `ggi`, and `wxt` terminals allow interaction with
2708 the current plot using the mouse. They also support the definition of hotkeys
2709 to activate pre-defined functions by hitting a single key while the mouse
2710 focus is in the active plot window. It is even possible to combine mouse
2711 input with `batch` command scripts, by invoking the command `pause mouse`
2712 and then using the mouse variables returned by mouse clicking as parameters
2713 for subsequent scripted actions. See @ref{bind} and @ref{variables}.
2714 See also the command `set mouse`.
2721 @node bind, Mouse_variables, mouse_input, mouse_input
2727 The @ref{bind} allows defining or redefining a hotkey, i.e. a sequence of gnuplot
2728 commands which will be executed when a certain key or key sequence is pressed
2729 while the driver's window has the input focus. Note that @ref{bind} is only
2730 available if gnuplot was compiled with `mouse` support and it is used by all
2731 mouse-capable terminals. Bindings overwrite the builtin bindings (like in
2732 every real editor), except <space> and 'q' which cannot be rebound (unless
2733 one exception, see below). Mouse buttons cannot be rebound.
2735 You get the list of all hotkeys by typing @ref{bind} or by hitting 'h' in the
2738 Note that multikey-bindings with modifiers have to be quoted.
2740 Normally hotkeys are only recognized when the currently active plot window
2741 has focus. `bind allwindows <key> ...` (short form: `bind all <key> ...`)
2742 causes the binding for <key> to apply to all gnuplot plot windows, active
2743 or not. In this case gnuplot variable MOUSE_KEY_WINDOW is set to the ID
2744 of the originating window, and may be used by the bound command.
2746 By default, the <space> hotkey raises gnuplot's command window. On some
2747 terminals (e.g. x11, wx), 'q' closes the graph window. These defaults can
2748 be changed to ctrl-space and ctrl-q by starting gnuplot as 'gnuplot -ctrlq',
2749 see `x11 command-line-options`, or by the X Resource 'gnuplot*ctrlq'.
2750 Note: if <space> (or ctrl-space) does not raise the gnuplot window under X11,
2751 see discussion in @ref{raise}.
2755 bind @{allwindows@} [<key-sequence>] ["<gnuplot commands>"]
2766 bind "ctrl-a" "plot x*x"
2767 bind "ctrl-alt-a" 'print "great"'
2768 bind Home "set view 60,30; replot"
2769 bind all Home 'print "This is window ",MOUSE_KEY_WINDOW'
2775 bind "ctrl-a" # shows the binding for ctrl-a
2776 bind # shows all bindings
2782 bind "ctrl-alt-a" "" # removes binding for ctrl-alt-a
2783 (note that builtins cannot be removed)
2784 bind! # installs default (builtin) bindings
2788 - bind a key to toggle something:
2791 bind "ctrl-r" "v=v+1;if(v%2)set term x11 noraise; else set term x11 raise"
2795 Modifiers (ctrl / alt) are case insensitive, keys not:
2797 ctrl-alt-a == CtRl-alT-a
2798 ctrl-alt-a != ctrl-alt-A
2802 List of modifiers (alt == meta):
2808 List of supported special keys:
2811 "BackSpace", "Tab", "Linefeed", "Clear", "Return", "Pause", "Scroll_Lock",
2812 "Sys_Req", "Escape", "Delete", "Home", "Left", "Up", "Right", "Down",
2813 "PageUp", "PageDown", "End", "Begin",
2818 "KP_Space", "KP_Tab", "KP_Enter", "KP_F1", "KP_F2", "KP_F3", "KP_F4",
2819 "KP_Home", "KP_Left", "KP_Up", "KP_Right", "KP_Down", "KP_PageUp",
2820 "KP_PageDown", "KP_End", "KP_Begin", "KP_Insert", "KP_Delete", "KP_Equal",
2821 "KP_Multiply", "KP_Add", "KP_Separator", "KP_Subtract", "KP_Decimal",
2827 "KP_1" - "KP_9", "F1" - "F12"
2831 See also help for `mouse` and @ref{if}.
2834 @node Mouse_variables, , bind, mouse_input
2835 @subsection Mouse variables
2838 When mousing is active, clicking in the active window will set several user
2839 variables that can be accessed from the gnuplot command line. The coordinates
2840 of the mouse at the time of the click are stored in MOUSE_X MOUSE_Y MOUSE_X2
2841 and MOUSE_Y2. The mouse button clicked, and any meta-keys active at that time,
2842 are stored in MOUSE_BUTTON MOUSE_SHIFT MOUSE_ALT and MOUSE_CTRL. These
2843 variables are set to undefined at the start of every plot, and only become
2844 defined in the event of a mouse click in the active plot window. To determine
2845 from a script if the mouse has been clicked in the active plot window, it is
2846 sufficient to test for any one of these variables being defined.
2851 if (defined(MOUSE_BUTTON)) call 'something_else'; \
2852 else print "No mouse click."
2856 It is also possible to track keystrokes in the plot window using the mousing
2861 pause mouse keypress
2862 print "Keystroke ", MOUSE_KEY, " at ", MOUSE_X, " ", MOUSE_Y
2866 When `pause mouse keypress` is terminated by a keypress, then MOUSE_KEY will
2867 contain the ascii character value of the key that was pressed. MOUSE_CHAR will
2868 contain the character itself as a string variable. If the pause command is
2869 terminated abnormally (e.g. by ctrl-C or by externally closing the plot window)
2870 then MOUSE_KEY will equal -1.
2872 Note that after a zoom by mouse, you can read the new ranges as GPVAL_X_MIN,
2873 GPVAL_X_MAX, GPVAL_Y_MIN, and GPVAL_Y_MAX, see @ref{variables}.
2877 @node Plotting, Start-up, mouse_input, gnuplot
2882 There are three `gnuplot` commands which actually create a plot: `plot`,
2883 `splot` and @ref{replot}. `plot` generates 2-d plots, `splot` generates 3-d
2884 plots (actually 2-d projections, of course), and @ref{replot} appends its
2885 arguments to the previous `plot` or `splot` and executes the modified
2888 Much of the general information about plotting can be found in the discussion
2889 of `plot`; information specific to 3-d can be found in the `splot` section.
2891 `plot` operates in either rectangular or polar coordinates -- see `set polar`
2892 for details of the latter. `splot` operates only in rectangular coordinates,
2893 but the @ref{mapping} command allows for a few other coordinate systems to be
2894 treated. In addition, the @ref{using} option allows both `plot` and `splot` to
2895 treat almost any coordinate system you'd care to define.
2897 `plot` also lets you use each of the four borders -- x (bottom), x2 (top), y
2898 (left) and y2 (right) -- as an independent axis. The `axes` option lets you
2899 choose which pair of axes a given function or data set is plotted against. A
2900 full complement of `set` commands exists to give you complete control over
2901 the scales and labelling of each axis. Some commands have the name of an
2902 axis built into their names, such as @ref{xlabel}. Other commands have one
2903 or more axis names as options, such as `set logscale xy`. Commands and
2904 options controlling the z axis have no effect on 2-d graphs.
2906 `splot` can plot surfaces and contours in addition to points and/or lines.
2907 In addition to `splot`, see @ref{isosamples} for information about defining
2908 the grid for a 3-d function; @ref{datafile} for information about the
2909 requisite file structure for 3-d data values; and @ref{contour} and
2910 @ref{cntrparam} for information about contours.
2912 In `splot`, control over the scales and labels of the axes are the same as
2913 with `plot`, except that commands and options controlling the x2 and y2 axes
2914 have no effect whereas of course those controlling the z axis do take effect.
2916 @node Start-up, String_constants_and_string_variables, Plotting, gnuplot
2919 @c ^ <a name="start-up"></a>
2926 When `gnuplot` is run, it looks for an initialization file to load.
2927 This file is called `.gnuplot` on Unix and AmigaOS systems, and
2928 `GNUPLOT.INI` on other systems. If this file is not found in the
2929 current directory, the program will look for it in the HOME directory
2930 (under AmigaOS, Atari(single)TOS, MS-DOS, Windows and OS/2, the
2931 environment variable `GNUPLOT` should contain the name of this
2932 directory; on Windows NT, it will use `USERPROFILE` if GNUPLOT isn't
2933 defined). Note: if NOCWDRC is defined during the installation,
2934 `gnuplot` will not read from the current directory.
2936 If the initialization file is found, `gnuplot` executes the commands in it.
2937 These may be any legal `gnuplot` commands, but typically they are limited to
2938 setting the terminal and defining frequently-used functions or variables.
2940 @node String_constants_and_string_variables, Substitution_and_Command_line_macros, Start-up, gnuplot
2941 @section String constants and string variables
2945 @c ?string variables
2946 In addition to string constants, most gnuplot commands also accept a string
2947 variable, a string expression, or a function that returns a string.
2948 For example, the following four methods of creating a plot all result in the
2953 graph4 = "Title for plot #4"
2954 graph(n) = sprintf("Title for plot #%d",n)
2959 plot 'data.4' title "Title for plot #4"
2960 plot 'data.4' title graph4
2961 plot 'data.4' title "Title for plot #".four
2962 plot 'data.4' title graph(4)
2966 Since integers are promoted to strings when operated on by the string
2967 concatenation operator, the following method also works:
2971 plot 'data.'.N title "Title for plot #".N
2975 In general, elements on the command line will only be evaluated as possible
2976 string variables if they are not otherwise recognizable as part of the normal
2977 gnuplot syntax. So the following sequence of commands is legal, although
2978 probably should be avoided so as not to cause confusion:
2981 plot = "my_datafile.dat"
2983 plot plot title title
2987 There are three binary operators that require string operands: the string
2988 concatenation operator ".", the string equality operator "eq" and the string
2989 inequality operator "ne". The following example will print TRUE.
2992 if ("A"."B" eq "AB") print "TRUE"
2996 See also the two string formatting functions @ref{gprintf} and @ref{sprintf}.
3000 Substrings can be specified by appending a range specifier to any string,
3001 string variable, or string-valued function. The range specifier has the
3002 form [begin:end], where begin is the index of the first character of the
3003 substring and end is the index of the last character of the substring.
3004 The first character has index 1. The begin or end fields may be empty, or
3005 contain '*', to indicate the true start or end of the original string.
3006 E.g. str[:] and str[*:*] both describe the full string str.
3008 @node Substitution_and_Command_line_macros, Syntax, String_constants_and_string_variables, gnuplot
3009 @section Substitution and Command line macros
3011 @cindex substitution
3013 When a command line to gnuplot is first read, i.e. before it is interpreted
3014 or executed, two forms of lexical substitution are performed. These are
3015 triggered by the presence of text in backquotes (ascii character 96) or
3016 preceded by @@ (ascii character 64).
3019 * Substitution_of_system_commands_in_backquotes::
3020 * Substitution_of_string_variables_as_macros::
3021 * String_variables::
3024 @node Substitution_of_system_commands_in_backquotes, Substitution_of_string_variables_as_macros, Substitution_and_Command_line_macros, Substitution_and_Command_line_macros
3025 @subsection Substitution of system commands in backquotes
3027 @c ?substitution backquotes
3031 Command-line substitution is specified by a system command enclosed in
3032 backquotes. This command is spawned and the output it produces replaces
3033 the backquoted text on the command line. Some implementations also support
3034 pipes; see @ref{special-filenames}.
3036 Command-line substitution can be used anywhere on the `gnuplot` command
3037 line, except inside strings delimited by single quotes.
3041 This will run the program `leastsq` and replace `leastsq` (including
3042 backquotes) on the command line with its output:
3050 f(x) = `run leastsq`
3054 These will generate labels with the current time and userid:
3056 set label "generated on `date +%Y-%m-%d` by `whoami`" at 1,1
3057 set timestamp "generated on %Y-%m-%d by `whoami`"
3061 @node Substitution_of_string_variables_as_macros, String_variables, Substitution_of_system_commands_in_backquotes, Substitution_and_Command_line_macros
3062 @subsection Substitution of string variables as macros
3064 @c ?substitution macros
3073 Substitution of command line macros is disabled by default, but may be
3074 enabled using the @ref{macros} command. If macro substitution is enabled,
3075 the character @@ is used to trigger substitution of the current value of a
3076 string variable into the command line. The text in the string variable may
3077 contain any number of lexical elements. This allows string variables to be
3078 used as command line macros. Only string constants may be expanded using this
3079 mechanism, not string-valued expressions.
3084 style1 = "lines lt 4 lw 2"
3085 style2 = "points lt 3 pt 5 ps 2"
3086 range1 = "using 1:3"
3087 range2 = "using 1:5"
3088 plot "foo" @@range1 with @@style1, "bar" @@range2 with @@style2
3092 The line containing @@ symbols is expanded on input, so that by the time it is
3093 executed the effect is identical to having typed in full
3096 plot "foo" using 1:3 with lines lt 4 lw 2, \
3097 "bar" using 1:5 with points lt 3 pt 5 ps 2
3101 The function exists() may be useful in connection with macro evaluation.
3102 The following example checks that C can safely be expanded as the name of
3103 a user-defined variable:
3107 if (exists(C)) print C," = ", @@C
3111 Macro expansion does not occur inside either single or double quotes.
3112 However macro expansion does occur inside backquotes.
3114 @node String_variables, , Substitution_of_string_variables_as_macros, Substitution_and_Command_line_macros
3115 @subsection String variables, macros, and command line substitution
3117 @cindex mixing_macros_backquotes
3119 @c ?substitution mixing_macros_backquotes
3120 The interaction of string variables, backquotes and macro substitution is
3121 somewhat complicated. Backquotes do not block macro substitution, so
3124 filename = "mydata.inp"
3125 lines = ` wc --lines @@filename | sed "s/ .*//" `
3129 results in the number of lines in mydata.inp being stored in the integer
3130 variable lines. And double quotes do not block backquote substitution, so
3133 mycomputer = "`uname -n`"
3137 results in the string returned by the system command `uname -n` being stored
3138 in the string variable mycomputer.
3140 However, macro substitution is not performed inside double quotes, so you
3141 cannot define a system command as a macro and then use both macro and backquote
3142 substitution at the same time.
3145 machine_id = "uname -n"
3146 mycomputer = "`@@machine_id`" # doesn't work!!
3150 This fails because the double quotes prevent @@machine_id from being interpreted
3151 as a macro. To store a system command as a macro and execute it later you must
3152 instead include the backquotes as part of the macro itself. This is
3153 accomplished by defining the macro as shown below. Notice that the sprintf
3154 format nests all three types of quotes.
3157 machine_id = sprintf('"`uname -n`"')
3158 mycomputer = @@machine_id
3162 @node Syntax, Time/Date_data, Substitution_and_Command_line_macros, gnuplot
3171 Version 4 of gnuplot is much less sensitive than earlier versions to the
3172 order of keywords and suboptions. However, if you get error messages from
3173 specifying options that you think should work, please try rearranging them
3174 into the exact order listed by the documentation.
3176 Options and any accompanying parameters are separated by spaces whereas lists
3177 and coordinates are separated by commas. Ranges are separated by colons and
3178 enclosed in brackets [], text and file names are enclosed in quotes, and a
3179 few miscellaneous things are enclosed in parentheses. Braces @{@} are used for
3180 a few special purposes.
3182 Commas are used to separate coordinates on the `set` commands @ref{arrow},
3183 @ref{key}, and @ref{label}; the list of variables being fitted (the list after the
3184 `via` keyword on the @ref{fit} command); lists of discrete contours or the loop
3185 parameters which specify them on the @ref{cntrparam} command; the arguments
3186 of the `set` commands @ref{dgrid3d}, @ref{dummy}, @ref{isosamples}, @ref{offsets}, @ref{origin},
3187 @ref{samples}, @ref{size}, `time`, and @ref{view}; lists of tics or the loop parameters
3188 which specify them; the offsets for titles and axis labels; parametric
3189 functions to be used to calculate the x, y, and z coordinates on the `plot`,
3190 @ref{replot} and `splot` commands; and the complete sets of keywords specifying
3191 individual plots (data sets or functions) on the `plot`, @ref{replot} and `splot`
3194 Parentheses are used to delimit sets of explicit tics (as opposed to loop
3195 parameters) and to indicate computations in the @ref{using} filter of the @ref{fit},
3196 `plot`, @ref{replot} and `splot` commands.
3198 (Parentheses and commas are also used as usual in function notation.)
3200 Square brackets are used to delimit ranges given in `set`, `plot`
3201 or `splot` commands.
3203 Colons are used to separate extrema in `range` specifications (whether they
3204 are given on `set`, `plot` or `splot` commands) and to separate entries in
3205 the @ref{using} filter of the `plot`, @ref{replot}, `splot` and @ref{fit} commands.
3207 Semicolons are used to separate commands given on a single command line.
3209 Braces are used in text to be specially processed by some terminals, like
3210 @ref{postscript}. They are also used to denote complex numbers: @{3,2@} = 3 + 2i.
3212 At present you should not embed \n inside @{@} when using the PostScript
3213 terminal in `enhanced text` mode.
3215 The EEPIC, Imagen, Uniplex, LaTeX, and TPIC drivers allow a newline to be
3216 specified by \\ in a single-quoted string or \\\\ in a double-quoted string.
3222 @node Quote_Marks, , Syntax, Syntax
3223 @subsection Quote Marks
3228 Gnuplot uses three forms of quote marks for delimiting text strings,
3229 double-quote (ascii 34), single-quote (ascii 39), and backquote (ascii 96).
3231 Filenames may be entered with either single- or double-quotes. In this
3232 manual the command examples generally single-quote filenames and double-quote
3233 other string tokens for clarity.
3235 String constants and text strings used for labels, titles, or other plot
3236 elements may be enclosed in either single quotes or double quotes. Further
3237 processing of the quoted text depends on the choice of quote marks.
3239 Backslash processing of special characters like \n (newline) and
3240 \345 (octal character code) is performed for double-quoted strings. In
3241 single-quoted strings, backslashes are just ordinary characters. To get
3242 a single-quote (ascii 39) in a single-quoted string, it has to be doubled.
3243 Thus the strings "d\" s' b\\" and 'd" s'' b\' are completely equivalent.
3245 Text justification is the same for each line of a multi-line string.
3246 Thus the center-justified string
3248 "This is the first line of text.\nThis is the second line."
3253 This is the first line of text.
3254 This is the second line.
3259 'This is the first line of text.\nThis is the second line.'
3264 This is the first line of text.\nThis is the second line.
3268 Enhanced text processing is performed for both double-quoted text and
3269 single-quoted text, but only by terminals supporting this mode.
3270 See `enhanced text`.
3272 Back-quotes are used to enclose system commands for substitution into the
3273 command line. See `substitution`.
3275 @node Time/Date_data, , Syntax, gnuplot
3276 @section Time/Date data
3278 @c ^ <a name="Time/Date data"></a>
3279 @c ^ <a name="Time/date"></a>
3282 `gnuplot` supports the use of time and/or date information as input data.
3283 This feature is activated by the commands `set xdata time`, `set ydata time`,
3286 Internally all times and dates are converted to the number of seconds from
3287 the year 2000. The command @ref{timefmt} defines the format for all inputs:
3288 data files, ranges, tics, label positions---in short, anything that accepts a
3289 data value must receive it in this format. Since only one input format can
3290 be in force at a given time, all time/date quantities being input at the same
3291 time must be presented in the same format. Thus if both x and y data in a
3292 file are time/date, they must be in the same format.
3294 The conversion to and from seconds assumes Universal Time (which is the same
3295 as Greenwich Standard Time). There is no provision for changing the time
3296 zone or for daylight savings. If all your data refer to the same time zone
3297 (and are all either daylight or standard) you don't need to worry about these
3298 things. But if the absolute time is crucial for your application, you'll
3299 need to convert to UT yourself.
3301 Commands like @ref{xrange} will re-interpret the integer according to
3302 @ref{timefmt}. If you change @ref{timefmt}, and then `show` the quantity again, it
3303 will be displayed in the new @ref{timefmt}. For that matter, if you give the
3304 deactivation command (like @ref{xdata}), the quantity will be shown in its
3307 The commands `set format` or `set tics format` define the format that will be
3308 used for tic labels, whether or not the specified axis is time/date.
3310 If time/date information is to be plotted from a file, the @ref{using} option
3311 _must_ be used on the `plot` or `splot` command. These commands simply use
3312 white space to separate columns, but white space may be embedded within the
3313 time/date string. If you use tabs as a separator, some trial-and-error may
3314 be necessary to discover how your system treats them.
3316 The following example demonstrates time/date plotting.
3318 Suppose the file "data" contains records like
3321 03/21/95 10:00 6.02e23
3325 This file can be plotted by
3329 set timefmt "%m/%d/%y"
3330 set xrange ["03/21/95":"03/22/95"]
3331 set format x "%m/%d"
3332 set timefmt "%m/%d/%y %H:%M"
3333 plot "data" using 1:3
3337 which will produce xtic labels that look like "03/21".
3339 See the descriptions of each command for more details.
3341 @node Commands, Terminal_types, gnuplot, Top
3346 This section lists the commands acceptable to `gnuplot` in alphabetical
3347 order. Printed versions of this document contain all commands; on-line
3348 versions may not be complete. Indeed, on some systems there may be no
3349 commands at all listed under this heading.
3351 Note that in most cases unambiguous abbreviations for command names and their
3352 options are permissible, i.e., "`p f(x) w li`" instead of "`plot f(x) with
3355 In the syntax descriptions, braces (@{@}) denote optional arguments and a
3356 vertical bar (|) separates mutually exclusive choices.
3389 @node cd, call, Commands, Commands
3397 The @ref{cd} command changes the working directory.
3401 cd '<directory-name>'
3405 The directory name must be enclosed in quotes.
3414 It is recommended for DOS and Windows users to use
3415 single-quotes---backslash [\] has special significance inside
3416 double-quotes and has to be escaped. For example,
3429 @node call, clear, cd, Commands
3437 The @ref{call} command is identical to the load command with one exception: you
3438 can have up to ten additional parameters to the command (delimited according
3439 to the standard parser rules) which can be substituted into the lines read
3440 from the file. As each line is read from the @ref{call}ed input file, it is
3441 scanned for the sequence `$` (dollar-sign) followed by a digit (0--9). If
3442 found, the sequence is replaced by the corresponding parameter from the
3443 @ref{call} command line. If the parameter was specified as a string in the
3444 @ref{call} line, it is substituted without its enclosing quotes. Sequence `$#`
3445 is replaced by the number of passed parameters. `$` followed by any character
3446 will be that character; e.g. use `$$` to get a single `$`. Providing more
3447 than ten parameters on the @ref{call} command line will cause an error. A
3448 parameter that was not provided substitutes as nothing. Files being @ref{call}ed
3449 may themselves contain @ref{call} or `load` commands.
3451 The @ref{call} command _must_ be the last command on a multi-command line.
3455 call "<input-file>" <parameter-0> <parm-1> ... <parm-9>
3459 The name of the input file must be enclosed in quotes, and it is recommended
3460 that parameters are similarly enclosed in quotes (future versions of gnuplot
3461 may treat quoted and unquoted arguments differently).
3465 If the file 'calltest.gp' contains the line:
3467 print "argc=$# p0=$0 p1=$1 p2=$2 p3=$3 p4=$4 p5=$5 p6=$6 p7=x$7x"
3471 entering the command:
3473 call 'calltest.gp' "abcd" 1.2 + "'quoted'" -- "$2"
3479 argc=7 p0=abcd p1=1.2 p2=+ p3='quoted' p4=- p5=- p6=$2 p7=xx
3483 NOTE: there is a clash in syntax with the datafile @ref{using} callback
3484 operator. Use `$$n` or `column(n)` to access column n from a datafile inside
3485 a @ref{call}ed datafile plot.
3487 @node clear, exit, call, Commands
3495 The @ref{clear} command erases the current screen or output device as specified
3496 by @ref{output}. This usually generates a formfeed on hardcopy devices. Use
3497 @ref{terminal} to set the device type.
3499 For some terminals @ref{clear} erases only the portion of the plotting surface
3500 defined by @ref{size}, so for these it can be used in conjunction with @ref{multiplot} to create an inset.
3514 Please see @ref{multiplot}, @ref{size}, and @ref{origin} for details of these
3517 @node exit, fit, clear, Commands
3525 The commands @ref{exit} and @ref{quit}, as well as the END-OF-FILE character (usually
3526 Ctrl-D) terminate input from the current input stream: terminal session, pipe,
3527 and file input (pipe).
3529 If input streams are nested (inherited `load` scripts), then reading will
3530 continue in the parent stream. When the top level stream is closed, the
3531 program itself will exit.
3533 The command `exit gnuplot` will immediately and unconditionally cause gnuplot
3534 to exit even if the input stream is multiply nested. In this case any open
3535 output files may not be completed cleanly. Example of use:
3538 bind "ctrl-x" "unset output; exit gnuplot"
3542 See help for `batch/interactive` for more details.
3544 @node fit, help, exit, Commands
3552 @cindex least-squares
3556 The @ref{fit} command can fit a user-defined function to a set of data points
3557 (x,y) or (x,y,z), using an implementation of the nonlinear least-squares
3558 (NLLS) Marquardt-Levenberg algorithm. Any user-defined variable occurring in
3559 the function body may serve as a fit parameter, but the return type of the
3560 function must be real.
3564 fit @{[xrange] @{[yrange]@}@} <function> '<datafile>'
3565 @{datafile-modifiers@}
3566 via '<parameter file>' | <var1>@{,<var2>,...@}
3570 Ranges may be specified to temporarily limit the data which is to be fitted;
3571 any out-of-range data points are ignored. The syntax is
3573 [@{dummy_variable=@}@{<min>@}@{:<max>@}],
3576 analogous to `plot`; see @ref{ranges}.
3578 <function> is any valid `gnuplot` expression, although it is usual to use a
3579 previously user-defined function of the form f(x) or f(x,y).
3581 <datafile> is treated as in the `plot` command. All the @ref{datafile}
3582 modifiers (@ref{using}, @ref{every},...) except @ref{smooth} and the deprecated @ref{thru}
3583 are applicable to @ref{fit}. See @ref{datafile}.
3585 The default data formats for fitting functions with a single independent
3586 variable, y=f(x), are @{x:@}y or x:y:s; those formats can be changed with
3587 the datafile @ref{using} qualifier. The third item (a column number or an
3588 expression), if present, is interpreted as the standard deviation of the
3589 corresponding y value and is used to compute a weight for the datum, 1/s**2.
3590 Otherwise, all data points are weighted equally, with a weight of one.
3591 Note that if you don't specify a @ref{using} option at all, no y deviations are
3592 read from the datafile even if it does have a third column, so you'll
3593 always get unit weights.
3595 To fit a function with two independent variables, z=f(x,y), the required
3596 format is @ref{using} with four items, x:y:z:s. The complete format must be
3597 given---no default columns are assumed for a missing token. Weights for
3598 each data point are evaluated from 's' as above. If error estimates are
3599 not available, a constant value can be specified as a constant expression
3600 (see @ref{using}), e.g., `using 1:2:3:(1)`.
3602 Multiple datasets may be simultaneously fit with functions of one
3603 independent variable by making y a 'pseudo-variable', e.g., the dataline
3604 number, and fitting as two independent variables. See @ref{multi-branch}.
3606 The `via` qualifier specifies which parameters are to be adjusted, either
3607 directly, or by referencing a parameter file.
3611 f(x) = a*x**2 + b*x + c
3612 g(x,y) = a*x**2 + b*y**2 + c*x*y
3614 fit f(x) 'measured.dat' via 'start.par'
3615 fit f(x) 'measured.dat' using 3:($7-5) via 'start.par'
3616 fit f(x) './data/trash.dat' using 1:2:3 via a, b, c
3617 fit g(x,y) 'surface.dat' using 1:2:3:(1) via a, b, c
3621 After each iteration step, detailed information about the current state
3622 of the fit is written to the display. The same information about the
3623 initial and final states is written to a log file, "fit.log". This file
3624 is always appended to, so as to not lose any previous fit history; it
3625 should be deleted or renamed as desired. By using the command
3626 `set fit logfile`, the name of the log file can be changed.
3628 If gnuplot was built with this option, and you activated it using `set fit
3629 errorvariables`, the error for each fitted parameter will be stored in
3630 a variable named like the parameter, but with "_err" appended. Thus the
3631 errors can be used as input for further computations.
3633 The fit may be interrupted by pressing Ctrl-C (any key but Ctrl-C under
3634 MSDOS and Atari Multitasking Systems). After the current iteration
3635 completes, you have the option to (1) stop the fit and accept the current
3636 parameter values, (2) continue the fit, (3) execute a `gnuplot` command
3637 as specified by the environment variable FIT_SCRIPT. The default for
3638 FIT_SCRIPT is @ref{replot}, so if you had previously plotted both the data
3639 and the fitting function in one graph, you can display the current state
3642 Once @ref{fit} has finished, the @ref{update} command may be used to store final
3643 values in a file for subsequent use as a parameter file. See @ref{update}
3647 * adjustable_parameters::
3648 * short_introduction::
3656 @node adjustable_parameters, short_introduction, fit, fit
3657 @subsection adjustable parameters
3659 @c ?commands fit parameters
3661 @c ?commands fit adjustable_parameters
3662 @c ?fit adjustable_parameters
3663 @cindex fit_parameters
3665 There are two ways that `via` can specify the parameters to be adjusted,
3666 either directly on the command line or indirectly, by referencing a
3667 parameter file. The two use different means to set initial values.
3669 Adjustable parameters can be specified by a comma-separated list of variable
3670 names after the `via` keyword. Any variable that is not already defined
3671 is created with an initial value of 1.0. However, the fit is more likely
3672 to converge rapidly if the variables have been previously declared with more
3673 appropriate starting values.
3675 In a parameter file, each parameter to be varied and a corresponding initial
3676 value are specified, one per line, in the form
3682 Comments, marked by '#', and blank lines are permissible. The
3685 varname = value # FIXED
3689 means that the variable is treated as a 'fixed parameter', initialized by the
3690 parameter file, but not adjusted by @ref{fit}. For clarity, it may be useful to
3691 designate variables as fixed parameters so that their values are reported by
3692 @ref{fit}. The keyword `# FIXED` has to appear in exactly this form.
3695 @node short_introduction, error_estimates, adjustable_parameters, fit
3696 @subsection short introduction
3698 @c ?commands fit beginners_guide
3699 @c ?fit beginners_guide
3703 @ref{fit} is used to find a set of parameters that 'best' fits your data to your
3704 user-defined function. The fit is judged on the basis of the sum of the
3705 squared differences or 'residuals' (SSR) between the input data points and
3706 the function values, evaluated at the same places. This quantity is often
3707 called 'chisquare' (i.e., the Greek letter chi, to the power of 2). The
3708 algorithm attempts to minimize SSR, or more precisely, WSSR, as the residuals
3709 are 'weighted' by the input data errors (or 1.0) before being squared;
3710 see `fit error_estimates` for details.
3712 That's why it is called 'least-squares fitting'. Let's look at an example
3713 to see what is meant by 'non-linear', but first we had better go over some
3714 terms. Here it is convenient to use z as the dependent variable for
3715 user-defined functions of either one independent variable, z=f(x), or two
3716 independent variables, z=f(x,y). A parameter is a user-defined variable
3717 that @ref{fit} will adjust, i.e., an unknown quantity in the function
3718 declaration. Linearity/non-linearity refers to the relationship of the
3719 dependent variable, z, to the parameters which @ref{fit} is adjusting, not of
3720 z to the independent variables, x and/or y. (To be technical, the
3721 second @{and higher@} derivatives of the fitting function with respect to
3722 the parameters are zero for a linear least-squares problem).
3724 For linear least-squares (LLS), the user-defined function will be a sum of
3725 simple functions, not involving any parameters, each multiplied by one
3726 parameter. NLLS handles more complicated functions in which parameters can
3727 be used in a large number of ways. An example that illustrates the
3728 difference between linear and nonlinear least-squares is the Fourier series.
3729 One member may be written as
3731 z=a*sin(c*x) + b*cos(c*x).
3734 If a and b are the unknown parameters and c is constant, then estimating
3735 values of the parameters is a linear least-squares problem. However, if
3736 c is an unknown parameter, the problem is nonlinear.
3738 In the linear case, parameter values can be determined by comparatively
3739 simple linear algebra, in one direct step. However LLS is a special case
3740 which is also solved along with more general NLLS problems by the iterative
3741 procedure that `gnuplot` uses. @ref{fit} attempts to find the minimum by doing
3742 a search. Each step (iteration) calculates WSSR with a new set of parameter
3743 values. The Marquardt-Levenberg algorithm selects the parameter values for
3744 the next iteration. The process continues until a preset criterion is met,
3745 either (1) the fit has "converged" (the relative change in WSSR is less than
3746 FIT_LIMIT), or (2) it reaches a preset iteration count limit, FIT_MAXITER
3747 (see @ref{variables}). The fit may also be interrupted
3748 and subsequently halted from the keyboard (see @ref{fit}). The user variable
3749 FIT_CONVERGED contains 1 if the previous fit command terminated due to
3750 convergence; it contains 0 if the previous fit terminated for any other
3753 Often the function to be fitted will be based on a model (or theory) that
3754 attempts to describe or predict the behaviour of the data. Then @ref{fit} can
3755 be used to find values for the free parameters of the model, to determine
3756 how well the data fits the model, and to estimate an error range for each
3757 parameter. See `fit error_estimates`.
3759 Alternatively, in curve-fitting, functions are selected independent of
3760 a model (on the basis of experience as to which are likely to describe
3761 the trend of the data with the desired resolution and a minimum number
3762 of parameters*functions.) The @ref{fit} solution then provides an analytic
3763 representation of the curve.
3765 However, if all you really want is a smooth curve through your data points,
3766 the @ref{smooth} option to `plot` may be what you've been looking for rather
3769 @node error_estimates, control, short_introduction, fit
3770 @subsection error estimates
3772 @c ?commands fit error_estimates
3773 @c ?fit error_estimates
3775 In @ref{fit}, the term "error" is used in two different contexts, data error
3776 estimates and parameter error estimates.
3778 Data error estimates are used to calculate the relative weight of each data
3779 point when determining the weighted sum of squared residuals, WSSR or
3780 chisquare. They can affect the parameter estimates, since they determine
3781 how much influence the deviation of each data point from the fitted function
3782 has on the final values. Some of the @ref{fit} output information, including
3783 the parameter error estimates, is more meaningful if accurate data error
3784 estimates have been provided.
3786 The 'statistical overview' describes some of the @ref{fit} output and gives some
3787 background for the 'practical guidelines'.
3790 * statistical_overview::
3791 * practical_guidelines::
3794 @node statistical_overview, practical_guidelines, error_estimates, error_estimates
3795 @subsubsection statistical overview
3797 @c ?commands fit error statistical_overview
3798 @c ?fit error statistical_overview
3799 @cindex statistical_overview
3801 The theory of non-linear least-squares (NLLS) is generally described in terms
3802 of a normal distribution of errors, that is, the input data is assumed to be
3803 a sample from a population having a given mean and a Gaussian (normal)
3804 distribution about the mean with a given standard deviation. For a sample of
3805 sufficiently large size, and knowing the population standard deviation, one
3806 can use the statistics of the chisquare distribution to describe a "goodness
3807 of fit" by looking at the variable often called "chisquare". Here, it is
3808 sufficient to say that a reduced chisquare (chisquare/degrees of freedom,
3809 where degrees of freedom is the number of datapoints less the number of
3810 parameters being fitted) of 1.0 is an indication that the weighted sum of
3811 squared deviations between the fitted function and the data points is the
3812 same as that expected for a random sample from a population characterized by
3813 the function with the current value of the parameters and the given standard
3816 If the standard deviation for the population is not constant, as in counting
3817 statistics where variance = counts, then each point should be individually
3818 weighted when comparing the observed sum of deviations and the expected sum
3821 At the conclusion @ref{fit} reports 'stdfit', the standard deviation of the fit,
3822 which is the rms of the residuals, and the variance of the residuals, also
3823 called 'reduced chisquare' when the data points are weighted. The number of
3824 degrees of freedom (the number of data points minus the number of fitted
3825 parameters) is used in these estimates because the parameters used in
3826 calculating the residuals of the datapoints were obtained from the same data.
3827 These values are exported to the variables
3829 FIT_NDF = Number of degrees of freedom
3830 FIT_WSSR = Weighted sum-of-squares residual
3831 FIT_STDFIT = sqrt(WSSR/NDF)
3835 To estimate confidence levels for the parameters, one can use the minimum
3836 chisquare obtained from the fit and chisquare statistics to determine the
3837 value of chisquare corresponding to the desired confidence level, but
3838 considerably more calculation is required to determine the combinations of
3839 parameters which produce such values.
3841 Rather than determine confidence intervals, @ref{fit} reports parameter error
3842 estimates which are readily obtained from the variance-covariance matrix
3843 after the final iteration. By convention, these estimates are called
3844 "standard errors" or "asymptotic standard errors", since they are calculated
3845 in the same way as the standard errors (standard deviation of each parameter)
3846 of a linear least-squares problem, even though the statistical conditions for
3847 designating the quantity calculated to be a standard deviation are not
3848 generally valid for the NLLS problem. The asymptotic standard errors are
3849 generally over-optimistic and should not be used for determining confidence
3850 levels, but are useful for qualitative purposes.
3852 The final solution also produces a correlation matrix, which gives an
3853 indication of the correlation of parameters in the region of the solution;
3854 if one parameter is changed, increasing chisquare, does changing another
3855 compensate? The main diagonal elements, autocorrelation, are all 1; if
3856 all parameters were independent, all other elements would be nearly 0. Two
3857 variables which completely compensate each other would have an off-diagonal
3858 element of unit magnitude, with a sign depending on whether the relation is
3859 proportional or inversely proportional. The smaller the magnitudes of the
3860 off-diagonal elements, the closer the estimates of the standard deviation
3861 of each parameter would be to the asymptotic standard error.
3863 @node practical_guidelines, , statistical_overview, error_estimates
3864 @subsubsection practical guidelines
3866 @c ?commands fit error practical_guidelines
3867 @c ?fit error practical_guidelines
3868 @cindex practical_guidelines
3872 If you have a basis for assigning weights to each data point, doing so lets
3873 you make use of additional knowledge about your measurements, e.g., take into
3874 account that some points may be more reliable than others. That may affect
3875 the final values of the parameters.
3877 Weighting the data provides a basis for interpreting the additional @ref{fit}
3878 output after the last iteration. Even if you weight each point equally,
3879 estimating an average standard deviation rather than using a weight of 1
3880 makes WSSR a dimensionless variable, as chisquare is by definition.
3882 Each fit iteration will display information which can be used to evaluate
3883 the progress of the fit. (An '*' indicates that it did not find a smaller
3884 WSSR and is trying again.) The 'sum of squares of residuals', also called
3885 'chisquare', is the WSSR between the data and your fitted function; @ref{fit}
3886 has minimized that. At this stage, with weighted data, chisquare is expected
3887 to approach the number of degrees of freedom (data points minus parameters).
3888 The WSSR can be used to calculate the reduced chisquare (WSSR/ndf) or stdfit,
3889 the standard deviation of the fit, sqrt(WSSR/ndf). Both of these are
3890 reported for the final WSSR.
3892 If the data are unweighted, stdfit is the rms value of the deviation of the
3893 data from the fitted function, in user units.
3895 If you supplied valid data errors, the number of data points is large enough,
3896 and the model is correct, the reduced chisquare should be about unity. (For
3897 details, look up the 'chi-squared distribution' in your favourite statistics
3898 reference.) If so, there are additional tests, beyond the scope of this
3899 overview, for determining how well the model fits the data.
3901 A reduced chisquare much larger than 1.0 may be due to incorrect data error
3902 estimates, data errors not normally distributed, systematic measurement
3903 errors, 'outliers', or an incorrect model function. A plot of the residuals,
3904 e.g., `plot 'datafile' using 1:($2-f($1))`, may help to show any systematic
3905 trends. Plotting both the data points and the function may help to suggest
3908 Similarly, a reduced chisquare less than 1.0 indicates WSSR is less than that
3909 expected for a random sample from the function with normally distributed
3910 errors. The data error estimates may be too large, the statistical
3911 assumptions may not be justified, or the model function may be too general,
3912 fitting fluctuations in a particular sample in addition to the underlying
3913 trends. In the latter case, a simpler function may be more appropriate.
3915 You'll have to get used to both @ref{fit} and the kind of problems you apply it
3916 to before you can relate the standard errors to some more practical estimates
3917 of parameter uncertainties or evaluate the significance of the correlation
3920 Note that @ref{fit}, in common with most NLLS implementations, minimizes the
3921 weighted sum of squared distances (y-f(x))**2. It does not provide any means
3922 to account for "errors" in the values of x, only in y. Also, any "outliers"
3923 (data points outside the normal distribution of the model) will have an
3924 exaggerated effect on the solution.
3926 @node control, multi-branch, error_estimates, fit
3929 @c ?commands fit control
3931 There are a number of `gnuplot` variables that can be defined to affect
3932 @ref{fit}. Those which can be defined once `gnuplot` is running are listed
3933 under 'control_variables' while those defined before starting `gnuplot`
3934 are listed under 'environment_variables'.
3937 * control_variables::
3938 * environment_variables::
3941 @node control_variables, environment_variables, control, control
3942 @subsubsection control variables
3944 @c ?commands fit control variables
3945 @c ?fit control variables
3946 The default epsilon limit (1e-5) may be changed by declaring a value for
3951 When the sum of squared residuals changes between two iteration steps by
3952 a factor less than this number (epsilon), the fit is considered to have
3955 The maximum number of iterations may be limited by declaring a value for
3960 A value of 0 (or not defining it at all) means that there is no limit.
3962 If you need even more control about the algorithm, and know the
3963 Marquardt-Levenberg algorithm well, there are some more variables to
3964 influence it. The startup value of `lambda` is normally calculated
3965 automatically from the ML-matrix, but if you want to, you may provide
3971 Specifying FIT_START_LAMBDA as zero or less will re-enable the automatic
3972 selection. The variable
3977 gives the factor by which `lambda` is increased or decreased whenever
3978 the chi-squared target function increased or decreased significantly.
3979 Setting FIT_LAMBDA_FACTOR to zero re-enables the default factor of
3982 Other variables with the FIT_ prefix may be added to @ref{fit}, so it is safer
3983 not to use that prefix for user-defined variables.
3985 The variables FIT_SKIP and FIT_INDEX were used by earlier releases of
3986 `gnuplot` with a 'fit' patch called `gnufit` and are no longer available.
3987 The datafile @ref{every} modifier provides the functionality of FIT_SKIP.
3988 FIT_INDEX was used for multi-branch fitting, but multi-branch fitting of
3989 one independent variable is now done as a pseudo-3D fit in which the
3990 second independent variable and @ref{using} are used to specify the branch.
3991 See @ref{multi-branch}.
3993 @node environment_variables, , control_variables, control
3994 @subsubsection environment variables
3996 @c ?commands fit control environment
3997 @c ?fit control environment
3998 The environment variables must be defined before `gnuplot` is executed; how
3999 to do so depends on your operating system.
4005 changes the name (and/or path) of the file to which the fit log will be
4006 written from the default of "fit.log" in the working directory. The default
4007 value can be overwritten using the command `set fit logfile`.
4013 specifies a command that may be executed after an user interrupt. The default
4014 is @ref{replot}, but a `plot` or `load` command may be useful to display a plot
4015 customized to highlight the progress of the fit.
4017 @node multi-branch, starting_values, control, fit
4018 @subsection multi-branch
4020 @c ?commands fit multi-branch
4021 @c ?fit multi-branch
4022 @cindex multi-branch
4026 In multi-branch fitting, multiple data sets can be simultaneously fit with
4027 functions of one independent variable having common parameters by minimizing
4028 the total WSSR. The function and parameters (branch) for each data set are
4029 selected by using a 'pseudo-variable', e.g., either the dataline number (a
4030 'column' index of -1) or the datafile index (-2), as the second independent
4033 Example: Given two exponential decays of the form, z=f(x), each describing
4034 a different data set but having a common decay time, estimate the values of
4035 the parameters. If the datafile has the format x:z:s, then
4037 f(x,y) = (y==0) ? a*exp(-x/tau) : b*exp(-x/tau)
4038 fit f(x,y) 'datafile' using 1:-2:2:3 via a, b, tau
4042 For a more complicated example, see the file "hexa.fnc" used by the
4045 Appropriate weighting may be required since unit weights may cause one
4046 branch to predominate if there is a difference in the scale of the dependent
4047 variable. Fitting each branch separately, using the multi-branch solution
4048 as initial values, may give an indication as to the relative effect of each
4049 branch on the joint solution.
4051 @node starting_values, tips, multi-branch, fit
4052 @subsection starting values
4054 @c ?commands fit starting_values
4055 @c ?fit starting_values
4056 @cindex starting_values
4058 Nonlinear fitting is not guaranteed to converge to the global optimum (the
4059 solution with the smallest sum of squared residuals, SSR), and can get stuck
4060 at a local minimum. The routine has no way to determine that; it is up to
4061 you to judge whether this has happened.
4063 @ref{fit} may, and often will get "lost" if started far from a solution, where
4064 SSR is large and changing slowly as the parameters are varied, or it may
4065 reach a numerically unstable region (e.g., too large a number causing a
4066 floating point overflow) which results in an "undefined value" message
4067 or `gnuplot` halting.
4069 To improve the chances of finding the global optimum, you should set the
4070 starting values at least roughly in the vicinity of the solution, e.g.,
4071 within an order of magnitude, if possible. The closer your starting values
4072 are to the solution, the less chance of stopping at another minimum. One way
4073 to find starting values is to plot data and the fitting function on the same
4074 graph and change parameter values and @ref{replot} until reasonable similarity
4075 is reached. The same plot is also useful to check whether the fit stopped at
4076 a minimum with a poor fit.
4078 Of course, a reasonably good fit is not proof there is not a "better" fit (in
4079 either a statistical sense, characterized by an improved goodness-of-fit
4080 criterion, or a physical sense, with a solution more consistent with the
4081 model.) Depending on the problem, it may be desirable to @ref{fit} with various
4082 sets of starting values, covering a reasonable range for each parameter.
4084 @node tips, , starting_values, fit
4087 @c ?commands fit tips
4091 Here are some tips to keep in mind to get the most out of @ref{fit}. They're not
4092 very organized, so you'll have to read them several times until their essence
4095 The two forms of the `via` argument to @ref{fit} serve two largely distinct
4096 purposes. The `via "file"` form is best used for (possibly unattended) batch
4097 operation, where you just supply the startup values in a file and can later
4098 use @ref{update} to copy the results back into another (or the same) parameter
4101 The `via var1, var2, ...` form is best used interactively, where the command
4102 history mechanism may be used to edit the list of parameters to be fitted or
4103 to supply new startup values for the next try. This is particularly useful
4104 for hard problems, where a direct fit to all parameters at once won't work
4105 without good starting values. To find such, you can iterate several times,
4106 fitting only some of the parameters, until the values are close enough to the
4107 goal that the final fit to all parameters at once will work.
4109 Make sure that there is no mutual dependency among parameters of the function
4110 you are fitting. For example, don't try to fit a*exp(x+b), because
4111 a*exp(x+b)=a*exp(b)*exp(x). Instead, fit either a*exp(x) or exp(x+b).
4113 A technical issue: the parameters must not be too different in magnitude.
4114 The larger the ratio of the largest and the smallest absolute parameter
4115 values, the slower the fit will converge. If the ratio is close to or above
4116 the inverse of the machine floating point precision, it may take next to
4117 forever to converge, or refuse to converge at all. You will have to adapt
4118 your function to avoid this, e.g., replace 'parameter' by '1e9*parameter' in
4119 the function definition, and divide the starting value by 1e9.
4121 If you can write your function as a linear combination of simple functions
4122 weighted by the parameters to be fitted, by all means do so. That helps a
4123 lot, because the problem is no longer nonlinear and should converge with only
4124 a small number of iterations, perhaps just one.
4126 Some prescriptions for analysing data, given in practical experimentation
4127 courses, may have you first fit some functions to your data, perhaps in a
4128 multi-step process of accounting for several aspects of the underlying
4129 theory one by one, and then extract the information you really wanted from
4130 the fitting parameters of those functions. With @ref{fit}, this may often be
4131 done in one step by writing the model function directly in terms of the
4132 desired parameters. Transforming data can also quite often be avoided,
4133 though sometimes at the cost of a more difficult fit problem. If you think
4134 this contradicts the previous paragraph about simplifying the fit function,
4137 A "singular matrix" message indicates that this implementation of the
4138 Marquardt-Levenberg algorithm can't calculate parameter values for the next
4139 iteration. Try different starting values, writing the function in another
4140 form, or a simpler function.
4142 Finally, a nice quote from the manual of another fitting package (fudgit),
4143 that kind of summarizes all these issues: "Nonlinear fitting is an art!"
4145 @node help, history, fit, Commands
4153 The @ref{help} command displays on-line help. To specify information on a
4154 particular topic use the syntax:
4161 If <topic> is not specified, a short message is printed about `gnuplot`.
4162 After help for the requested topic is given, a menu of subtopics is given;
4163 help for a subtopic may be requested by typing its name, extending the help
4164 request. After that subtopic has been printed, the request may be extended
4165 again or you may go back one level to the previous topic. Eventually, the
4166 `gnuplot` command line will return.
4168 If a question mark (?) is given as the topic, the list of topics currently
4169 available is printed on the screen.
4171 @node history, if, help, Commands
4174 @c ?commands history
4179 `history` command lists or saves previous entries in the history of the
4180 command line editing, or executes an entry.
4182 Here you find 'usage by examples':
4185 history # show the complete history
4186 history 5 # show last 5 entries in the history
4187 history quiet 5 # show last 5 entries without entry numbers
4188 history "hist.gp" # write the complete history to file hist.gp
4189 history "hist.gp" append # append the complete history to file hist.gp
4190 history 10 "hist.gp" # write last 10 commands to file hist.gp
4191 history 10 "|head -5 >>diary.gp" # write 5 history commands using pipe
4192 history ?load # show all history entries starting with "load"
4193 history ?"set c" # like above, several words enclosed in quotes
4194 hi !reread # execute last entry starting with "reread"
4195 hist !"set xr" # like above, several words enclosed in quotes
4196 hi !hi # guess yourself :-))
4200 On systems which support a popen function (Unix), the output of history can be
4201 piped through an external program by starting the file name with a '|', as one
4202 of the above examples demonstrates.
4204 @node if, load, history, Commands
4212 The @ref{if} command allows commands to be executed conditionally.
4216 if (<condition>) <command-line> [; else if (<condition>) ...; else ...]
4220 <condition> will be evaluated. If it is true (non-zero), then the command(s)
4221 of the <command-line> will be executed. If <condition> is false (zero), then
4222 the entire <command-line> is ignored until the next occurrence of `else`.
4223 Note that use of `;` to allow multiple commands on the same line will
4224 _not_ end the conditionalized commands.
4229 if (pi!=acos(-1)) print "?Fixing pi!"; pi=acos(-1); print pi
4240 if (1==2) print "Never see this"; print "Or this either"
4243 will not display anything.
4248 v=v+1; if (v%2) print "2" ; else if (v%3) print "3"; else print "fred"
4251 (repeat the last line repeatedly!)
4253 See @ref{reread} for an example of how @ref{if} and @ref{reread} can be used together to
4256 @node load, lower, if, Commands
4264 The `load` command executes each line of the specified input file as if it
4265 had been typed in interactively. Files created by the @ref{save} command can
4266 later be `load`ed. Any text file containing valid commands can be created
4267 and then executed by the `load` command. Files being `load`ed may themselves
4268 contain `load` or @ref{call} commands. See `comments` for information about
4269 comments in commands. To `load` with arguments, see @ref{call}.
4271 The `load` command _must_ be the last command on a multi-command line.
4279 The name of the input file must be enclosed in quotes.
4281 The special filename "-" may be used to `load` commands from standard input.
4282 This allows a `gnuplot` command file to accept some commands from standard
4283 input. Please see help for `batch/interactive` for more details.
4285 On some systems which support a popen function (Unix), the load file can be
4286 read from a pipe by starting the file name with a '<'.
4292 load "< loadfile_generator.sh"
4296 The `load` command is performed implicitly on any file names given as
4297 arguments to `gnuplot`. These are loaded in the order specified, and
4298 then `gnuplot` exits.
4300 @node lower, pause, load, Commands
4310 lower @{plot_window_nb@}
4314 The @ref{lower} command lowers (opposite to @ref{raise}) plot window(s) associated
4315 with the interactive terminal of your gnuplot session, i.e. `pm`, `win`, `wxt`
4316 or `x11`. It puts the plot window to bottom in the z-order windows stack of
4317 the window manager of your desktop.
4319 As `x11` and `wxt` support multiple plot windows, then by default they lower
4320 these windows in descending order of most recently created on top to the least
4321 recently created on bottom. If a plot number is supplied as an optional
4322 parameter, only the associated plot window will be lowered if it exists.
4324 The optional parameter is ignored for single plot-window terminals, i.e. `pm`
4327 @node pause, plot, lower, Commands
4336 The @ref{pause} command displays any text associated with the command and then
4337 waits a specified amount of time or until the carriage return is pressed.
4338 @ref{pause} is especially useful in conjunction with `load` files.
4342 pause <time> @{"<string>"@}
4343 pause mouse @{<endcondition>@}@{, <endcondition>@} @{"<string>"@}
4347 <time> may be any constant or expression. Choosing -1 will wait until a
4348 carriage return is hit, zero (0) won't pause at all, and a positive number
4349 will wait the specified number of seconds. The time is rounded to an integer
4350 number of seconds if subsecond time resolution is not supported by the given
4351 platform. `pause 0` is synonymous with @ref{print}.
4353 If the current terminal supports mousing, then `pause mouse` will terminate
4354 on either a mouse click or on ctrl-C. For all other terminals, or if mousing
4355 is not active, `pause mouse` is equivalent to `pause -1`.
4357 If one or more end conditions are given after `pause mouse`, then any one of
4358 the conditions will terminate the pause. The possible end conditions are
4359 `keypress`, `button1`, `button2`, `button3`, `close`, and `any`.
4360 If the pause terminates on a keypress, then the ascii value of the key pressed
4361 is returned in MOUSE_KEY. The character itself is returned as a one character
4362 string in MOUSE_CHAR. Hotkeys (bind command) are disabled if keypress is one of
4363 the end conditions. Zooming is disabled if button3 is one of the end
4366 In all cases the coordinates of the mouse are returned in variables MOUSE_X,
4367 MOUSE_Y, MOUSE_X2, MOUSE_Y2. See @ref{variables}.
4369 Note: Since @ref{pause} communicates with the operating system rather than the
4370 graphics, it may behave differently with different device drivers (depending
4371 upon how text and graphics are mixed).
4375 pause -1 # Wait until a carriage return is hit
4376 pause 3 # Wait three seconds
4377 pause -1 "Hit return to continue"
4378 pause 10 "Isn't this pretty? It's a cubic spline."
4379 pause mouse "Click any mouse button on selected data point"
4380 pause mouse keypress "Type a letter from A-F in the active window"
4381 pause mouse button1,keypress
4382 pause mouse any "Any key or button will terminate"
4386 The variant "pause mouse key" will resume after any keypress in the active
4387 plot window. If you want to wait for a particular key to be pressed, you can
4388 use a reread loop such as:
4391 printf "I will resume after you hit the Tab key in the plot window"
4396 File "wait_for_tab" contains the lines
4400 if (MOUSE_KEY != 9) reread
4405 @node plot, print, pause, Commands
4413 `plot` is the primary command for drawing plots with `gnuplot`. It creates
4414 plots of functions and data in many, many ways. `plot` is used to draw 2-d
4415 functions and data; `splot` draws 2-d projections of 3-d surfaces and data.
4416 `plot` and `splot` contain many common features; see `splot` for differences.
4417 Note specifically that although the `binary <binary list>` variation does
4418 work for both `plot` and `splot`, there are small differences between these
4419 modes. Furthermore, `plot`'s `axes` option does not exist for `splot`.
4424 @{<function> | @{"<datafile>" @{datafile-modifiers@}@}@}
4425 @{axes <axes>@} @{<title-spec>@} @{with <style>@}
4426 @{, @{definitions,@} <function> ...@}
4430 where either a <function> or the name of a data file enclosed in quotes is
4431 supplied. A function is a mathematical expression or a pair of mathematical
4432 expressions in parametric mode. The expressions may be defined completely or
4433 in part earlier in the stream of `gnuplot` commands (see `user-defined`).
4435 It is also possible to define functions and parameters on the `plot` command
4436 itself. This is done merely by isolating them from other items with commas.
4438 There are four possible sets of axes available; the keyword <axes> is used to
4439 select the axes for which a particular line should be scaled. `x1y1` refers
4440 to the axes on the bottom and left; `x2y2` to those on the top and right;
4441 `x1y2` to those on the bottom and right; and `x2y1` to those on the top and
4442 left. Ranges specified on the `plot` command apply only to the first set of
4448 plot f(x) = sin(x*a), a = .2, f(x), a = .4, f(x)
4449 plot [t=1:10] [-pi:pi*2] tan(t), \
4450 "data.1" using (tan($2)):($3/$4) smooth csplines \
4451 axes x1y2 notitle with lines 5
4455 See also `show plot`.
4467 @node data, errorbars, plot, plot
4470 @c ?commands plot datafile
4482 Discrete data contained in a file can be displayed by specifying the name of
4483 the data file (enclosed in single or double quotes) on the `plot` command line.
4487 plot '<file_name>' @{binary <binary list>@}
4489 @{index <index list>@}
4490 @{every <every list>@}
4491 @{thru <thru expression>@}
4492 @{using <using list>@}
4497 The modifiers `binary`, @ref{index}, @ref{every}, @ref{thru}, @ref{using}, and @ref{smooth} are
4498 discussed separately. In brief, `binary` allows data entry from a binary
4499 file (default is ASCII), @ref{index} selects which data sets in a multi-data-set
4500 file are to be plotted, @ref{every} specifies which points within a single data
4501 set are to be plotted, @ref{using} determines how the columns within a single
4502 record are to be interpreted (@ref{thru} is a special case of @ref{using}), and
4503 @ref{smooth} allows for simple interpolation and approximation. (`splot` has a
4504 similar syntax, but does not support the @ref{smooth} and @ref{thru} options.)
4509 Data files should contain at least one data point per record (@ref{using}
4510 can select one data point from the record). Records beginning with `#`
4511 (and also with `!` on VMS) will be treated as comments and ignored.
4512 Each data point represents an (x,y) pair. For `plot`s with error bars or
4513 error bars with lines (see @ref{errorbars} or @ref{errorlines}),
4514 each data point is (x,y,ydelta), (x,y,ylow,yhigh),
4515 (x,y,xdelta), (x,y,xlow,xhigh), or (x,y,xlow,xhigh,ylow,yhigh).
4517 In all cases, the numbers of each record of a data file must be separated
4518 by white space (one or more blanks or tabs) unless a format specifier is
4519 provided by the @ref{using} option. This white space divides each record into
4520 columns. However, whitespace inside a pair of double quotes is ignored when
4521 counting columns, so the following datafile line has three columns:
4523 1.0 "second column" 3.0
4527 Data may be written in exponential format with the exponent preceded by the
4528 letter e or E. The fortran exponential specificiers d, D, q, and Q may also
4529 be used if the command `set datafile fortran` is in effect.
4531 Only one column (the y value) need be provided. If x is omitted, `gnuplot`
4532 provides integer values starting at 0.
4534 In datafiles, blank records (records with no characters other than blanks and
4535 a newline and/or carriage return) are significant.
4537 Single blank records designate discontinuities in a `plot`; no line will join
4538 points separated by a blank records (if they are plotted with a line style).
4540 Two blank records in a row indicate a break between separate data sets.
4543 If autoscaling has been enabled (@ref{autoscale}), the axes are automatically
4544 extended to include all datapoints, with a whole number of tic marks if tics
4545 are being drawn. This has two consequences: i) For `splot`, the corner of
4546 the surface may not coincide with the corner of the base. In this case, no
4547 vertical line is drawn. ii) When plotting data with the same x range on a
4548 dual-axis graph, the x coordinates may not coincide if the x2tics are not
4549 being drawn. This is because the x axis has been autoextended to a whole
4550 number of tics, but the x2 axis has not. The following example illustrates
4554 reset; plot '-', '-' axes x2y1
4564 To avoid this, you can use the `fixmin`/`fixmax` feature of the
4565 @ref{autoscale} command, which turns off the automatic extension of the
4566 axis range upto the next tic mark.
4571 Gnuplot can read binary data files. However, adequate information about
4572 details of the file format must be given on the command line or extracted
4573 from the file itself for a supported binary `filetype`. In particular,
4574 there are two structures for binary files, a matrix binary format and a
4575 general binary format.
4577 The matrix binary format contains a two dimensional array of 32 bit IEEE
4578 float values with an additional column and row of coordinate values. As
4579 with ASCII matrix, in the @ref{using} list, repetition of the coordinate row
4580 constitutes column 1, repetition of the coordinate column constitutes
4581 column 2, and the array of values constitutes column 3.
4583 The general binary format contains an arbitrary number of columns for which
4584 information must be specified at the command line. For example, `array`,
4585 `record`, `format` and @ref{using} can indicate the size, format and dimension
4586 of data. There are a variety of useful commands for skipping file headers
4587 and changing endianess. There are a set of commands for positioning and
4588 translating data since often coordinates are not part of the file when
4589 uniform sampling is inherent in the data. Different from matrix binary or
4590 ASCII, general binary does not treat the generated columns as 1, 2 or 3 in
4591 the @ref{using} list. Rather, column 1 begins with column 1 of the file, or as
4592 specified in the `format` list.
4594 There are global default settings for the various binary options which may
4595 be set using the same syntax as the options when used as part of the `(s)plot
4596 <filename> binary ...` command. This syntax is `set datafile binary ...`.
4597 The general rule is that common command-line specified parameters override
4598 file-extracted parameters which override default parameters.
4600 Matrix binary is the default binary format when no keywords specific to
4601 general binary are given, i.e., `array`, `record`, `format`, `filetype`.
4603 General binary data can be entered at the command line via the special file
4604 name '-'. However, this is intended for use through a pipe where programs
4605 can exchange binary data, not for keyboards. There is no "end of record"
4606 character for binary data. Gnuplot continues reading from a pipe until it
4607 has read the number of points declared in the `array` qualifier.
4609 See `datafile binary` for more details.
4615 * example_datafile::
4618 * special-filenames::
4623 @node binary, binary_general, data, data
4624 @subsubsection binary
4626 @c ?commands plot datafile binary
4627 @c ?plot datafile binary
4628 @c ?splot datafile binary
4631 @c ?data-file binary
4635 The `binary` keyword allows a data file to be binary as opposed to ASCII.
4636 There are two formats for binary--matrix binary and general binary. Matrix
4637 binary is a fixed format in which data appears in a 2D array with an extra
4638 row and column for coordinate values. General binary is a flexible format
4639 for which details about the file must be given at the command line.
4641 See `binary matrix` or `binary general` for more details.
4643 @node binary_general, every, binary, data
4644 @subsubsection binary general
4646 @c ?commands plot datafile binary general
4647 @c ?commands splot datafile binary general
4648 @c ?plot binary general
4649 @c ?splot binary general
4651 General binary data in which format information is not necessarily part of
4652 the file can be read by giving further details about the file format at the
4653 command line. Although the syntax is slightly arcane to the casual user,
4654 general binary is particularly useful for application programs using gnuplot
4655 and sending large amounts of data.
4659 plot '<file_name>' @{binary <binary list>@} ...
4660 splot '<file_name>' @{binary <binary list>@} ...
4664 General binary format is activated by keywords in <binary list> pertaining
4665 to information about file structure, i.e., `array`, `record`, `format` or
4666 `filetype`. Otherwise, matrix binary format is assumed. (See `binary matrix`
4669 There are some standard file types that may be read for which details about
4670 the binary format may be extracted automatically. (Type `show datafile
4671 binary` at the command line for a list.) Otherwise, details must be
4672 specified at the command line or set in the defaults. Keywords are described
4675 The keyword `filetype` in <binary list> controls the routine used to
4676 read the file, i.e., the format of the data. For a list of the supported
4677 file types, type `show datafile binary filetypes`. If no file type is
4678 given, the rule is that traditional gnuplot binary is assumed for `splot`
4679 if the `binary` keyword stands alone. In all other circumstances, for
4680 `plot` or when one of the <binary list> keywords appears, a raw binary
4681 file is assumed whereby the keywords specify the binary format.
4683 General binary data files fall into two basic classes, and some files may
4684 be of both classes depending upon how they are treated. There is that
4685 class for which uniform sampling is assumed and point coordinates must be
4686 generated. This is the class for which full control via the <binary
4687 list> keywords applies. For this class, the settings precedence is that
4688 command line parameters override in-file parameters, which override
4689 default settings. The other class is that set of files for which
4690 coordinate information is contained within the file or there is possibly
4691 a non-uniform sampling such as gnuplot binary.
4693 Other than for the unique data files such as gnuplot binary, one should
4694 think of binary data as conceptually the same as ASCII data. Each point
4695 has columns of information which are selected via the `<using list>`
4696 associated with @ref{using}. When no `format` string is specified, gnuplot
4697 will retrieve a number of binary variables equal to the largest column
4698 given in the `<using list>`. For example, `using 1:3` will result in
4699 three columns being read, of which the second will be ignored. There are
4700 default using lists based upon the typical number of parameters associated
4701 with a certain plot type. For example, `with image` has a default of
4702 `using 1`, while `with rgbimage` has a default of `using 1:2:3`. Note
4703 that the special characters for @ref{using} representing point/line/index
4704 generally should not be used for binary data. There are keywords in
4705 <binary list> that control this.
4708 @noindent --- ARRAY ---
4710 @c ?binary general array
4711 Describes the sampling array dimensions associated with the binary file.
4712 The coordinates will be generated by gnuplot. A number must be specified
4713 for each dimension, thereby calling out the size of the array. For example,
4714 `array=10x20` means the underlying sampling structure is two-dimensional with
4715 10 points along the first (x) dimension and 20 points along the second (y)
4716 dimension. A special "number", `Inf`, can be used to indicate that data should
4717 be read until the end of file. A colon can be used to separate the dimensions
4718 for multiple records. For example, `array=25:35` indicates there are two
4719 one-dimensional records within the file. The colon behavior applies to the
4720 remaining keywords in this list for which it makes sense to be associated with
4723 Currently, syntax allows for up to three-dimensional arrays. However, no
4724 conventions have yet been made for handling three-dimensional coordinates.
4727 @noindent --- RECORD ---
4729 @c ?binary general record
4730 This keyword serves the same function as `array`, having the same syntax.
4731 However, `record` causes gnuplot to not generate coordinate information.
4732 This is for the case where such information may be included in one of the
4733 columns of the binary data file.
4736 @noindent --- FORMAT ---
4738 @c ?binary general format
4739 The default binary format is a float. For more flexibility, the format can
4740 include details about variable sizes. For example, `format="%uchar%int%float"`
4741 associates an unsigned character with the first using column, an int with the
4742 second column and a float with the third column. If the number of size
4743 specifications is less than the greatest column number, the size is implicitly
4744 taken to be similar to the last given variable size.
4746 Furthermore, the format specification can include "discarded" terms via the `*`
4747 character. For example, to skip the middle column of the previous example, one
4748 could write `format="%uchar%*int%float"` and gnuplot will discard the middle
4749 integer. To list variable sizes, type `show datafile binary datasizes`. There
4750 are a group of names that are machine dependent along with their sizes in bytes
4751 for the particular compilation. There is also a group of names which attempt
4752 to be machine independent.
4755 @noindent --- ENDIAN ---
4757 @c ?binary general endian
4758 Often the endianess of binary data in the file does not agree with the
4759 endianess used by the platform on which gnuplot is running. Several words can
4760 direct gnuplot how to arrange bytes. For example `endian=little` means treat
4761 the binary file as having byte significance from least to greatest. The options
4765 little: least significant to greatest significance
4766 big: greatest significance to least significance
4767 default: assume file endianess is the same as compiler
4768 swap (swab): Interchange the significance. (If things
4769 don't look right, try this.)
4773 Gnuplot can support "middle" ("pdp") endian if it is compiled with that option.
4776 @noindent --- FILETYPE ---
4778 @c ?binary general filetype
4779 For some standard binary file formats gnuplot can extract all the necessary
4780 information from the file in question. As an example, "format=edf" will read
4781 ESRF Header File format files. For a list of the currently supported file
4782 formats, type `show datafile binary filetypes`.
4784 There is a special file type called `auto` for which gnuplot will check if the
4785 binary file's extension is a quasi-standard extension for a supported format.
4787 Command line keywords may be used to override settings extracted from the file.
4788 The settings from the file override any defaults. (See `set datafile binary`
4792 @noindent --- AVS ---
4794 @c ?binary general filetype avs
4798 `avs` is one of the automatically recognized binary file types for images.
4799 AVS is an extremely simple format, suitable mostly for streaming between
4800 applications. It consists of 2 longs (xwidth, ywidth) followed by a stream
4801 of pixels, each with four bytes of information alpha/red/green/blue.
4804 @noindent --- EDF ---
4806 @c ?binary general filetype edf
4813 `edf` is one of the automatically recognized binary file types for images.
4814 EDF stands for ESRF Data Format, and it supports both edf and ehf formats
4815 (the latter means ESRF Header Format). More information on specifications
4819 http://www.esrf.fr/computing/expg/subgroups/general/format/Format.html
4826 @noindent --- KEYWORDS ---
4828 @c ?binary general keywords
4829 @c ?filetype keywords
4830 The following keywords apply only when generating coordinates. That is, when
4831 the keyword `array` is used.
4834 @noindent --- SCAN ---
4836 @c ?binary general keywords scan
4837 A great deal of confusion can arise concerning the relationship between how
4838 gnuplot scans a binary file and the dimensions seen on the plot. To lessen
4839 the confusion, conceptually think of gnuplot _always_ scanning the binary file
4840 point/line/plane or fast/medium/slow. Then this keyword is used to tell
4841 gnuplot how to map this scanning convention to the Cartesian convention shown
4842 in plots, i.e., x/y/z. The qualifier for scan is a two or three letter code
4843 representing where point is assigned (first letter), line is assigned (second
4844 letter), and plane is assigned (third letter). For example, `scan=yx` means
4845 the fastest, point-by-point, increment should be mapped along the Cartesian
4846 y dimension and the middle, line-by-line, increment should be mapped along the
4849 When the plotting mode is `plot`, the qualifier code can include the two
4850 letters x and y. For `splot`, it can include the three letters x, y and z.
4852 There is nothing restricting the inherent mapping from point/line/plane to
4853 apply only to Cartesian coordinates. For this reason there are cylindrical
4854 coordinate synonyms for the qualifier codes where t (theta), r and z are
4855 analogous to the x, y and z of Cartesian coordinates.
4858 @noindent --- TRANSPOSE ---
4860 @c ?binary general keywords transpose
4861 Shorthand notation for `scan=yx` or `scan=yxz`.
4864 @noindent --- DX, DY, DZ ---
4866 @c ?binary general keywords dx
4867 When gnuplot generates coordinates, it uses the spacing described by these
4868 keywords. For example `dx=10 dy=20` would mean space samples along the
4869 x dimension by 10 and space samples along the y dimension by 20. `dy` cannot
4870 appear if `dx` does not appear. Similarly, `dz` cannot appear if `dy` does not
4871 appear. If the underlying dimensions are greater than the keywords specified,
4872 the spacing of the highest dimension given is extended to the other dimensions.
4873 For example, if an image is being read from a file and only `dx=3.5` is given
4874 gnuplot uses a delta x and delta y of 3.5.
4876 The following keywords also apply only when generating coordinates. However
4877 they may also be used with matrix binary files.
4880 @noindent --- FLIPX, FLIPY, FLIPZ ---
4882 @c ?binary general keywords flipx
4883 Sometimes the scanning directions in a binary datafile are not consistent with
4884 that assumed by gnuplot. These keywords can flip the scanning direction along
4888 @noindent --- ORIGIN ---
4890 @c ?binary general keywords origin
4891 When gnuplot generates coordinates based upon transposition and flip, it
4892 attempts to always position the lower left point in the array at the origin,
4893 i.e., the data lies in the first quadrant of a Cartesian system after transpose
4896 To position the array somewhere else on the graph, the @ref{origin} keyword directs
4897 gnuplot to position the lower left point of the array at a point specified by a
4898 tuple. The tuple should be a double for `plot` and a triple for `splot`.
4899 For example, `origin=(100,100):(100,200)` is for two records in the file and
4900 intended for plotting in two dimensions. A second example, `origin=(0,0,3.5)`,
4901 is for plotting in three dimensions.
4904 @noindent --- CENTER ---
4906 @c ?binary general keywords center
4907 Similar to @ref{origin}, this keyword will position the array such that its center
4908 lies at the point given by the tuple. For example, `center=(0,0)`. Center
4909 does not apply when the size of the array is `Inf`.
4912 @noindent --- ROTATE ---
4914 @c ?binary general keywords rotate
4915 The transpose and flip commands provide some flexibility in generating and
4916 orienting coordinates. However, for full degrees of freedom, it is possible to
4917 apply a rotational vector described by a rotational angle in two dimensions.
4919 The `rotate` keyword applies to the two-dimensional plane, whether it be `plot`
4920 or `splot`. The rotation is done with respect to the positive angle of the
4923 The angle can be expressed in radians, radians as a multiple of pi, or degrees.
4924 For example, `rotate=1.5708`, `rotate=0.5pi` and `rotate=90deg` are equivalent.
4926 If @ref{origin} is specified, the rotation is done about the lower left sample
4927 point before translation. Otherwise, the rotation is done about the array
4931 @noindent --- PERPENDICULAR ---
4933 @c ?binary general keywords perpendicular
4934 For `splot`, the concept of a rotational vector is implemented by a triple
4935 representing the vector to be oriented normal to the two-dimensional x-y plane.
4936 Naturally, the default is (0,0,1). Thus specifying both rotate and
4937 perpendicular together can orient data myriad ways in three-space.
4939 The two-dimensional rotation is done first, followed by the three-dimensional
4940 rotation. That is, if R' is the rotational 2 x 2 matrix described by an angle,
4941 and P is the 3 x 3 matrix projecting (0,0,1) to (xp,yp,zp), let R be
4942 constructed from R' at the upper left sub-matrix, 1 at element 3,3 and zeros
4943 elsewhere. Then the matrix formula for translating data is v' = P R v, where v
4944 is the 3 x 1 vector of data extracted from the data file. In cases where the
4945 data of the file is inherently not three-dimensional, logical rules are used to
4946 place the data in three-space. (E.g., usually setting the z-dimension value to
4947 zero and placing 2D data in the x-y plane.)
4950 @noindent --- BINARY EXAMPLES ---
4952 @cindex binary_examples
4955 @c ?binary general examples
4959 # Selects two float values (second one implicit) with a float value
4960 # discarded between them for an indefinite length of 1D data.
4961 plot '<file_name>' binary format="%float%*float" using 1:2 with lines
4966 # The data file header contains all details necessary for creating
4967 # coordinates from an EDF file.
4968 plot '<file_name>' binary filetype=edf with image
4969 plot '<file_name>.edf' binary filetype=auto with image
4974 # Selects three unsigned characters for components of a raw RGB image
4975 # and flips the y-dimension so that typical image orientation (start
4976 # at top left corner) translates to the Cartesian plane. Pixel
4977 # spacing is given and there are two images in the file. One of them
4978 # is translated via origin.
4979 plot '<file_name>' binary array=512x1024:1024x512 format='%uchar' \
4980 dx=2:1 dy=1:2 origin=(0,0):(1024,1024) flipy u 1:2:3 w rgbimage
4985 # Four separate records in which the coordinates are part of the
4986 # data file. The file was created with a endianess different from
4987 # the system on which gnuplot is running.
4988 splot '<file_name>' binary record=30:30:29:26 endian=swap u 1:2:3
4992 See also `binary matrix`.
4994 @node every, example_datafile, binary_general, data
4995 @subsubsection every
4997 @c ?commands plot datafile every
4998 @c ?plot datafile every
5004 The @ref{every} keyword allows a periodic sampling of a data set to be plotted.
5006 In the discussion a "point" is a datum defined by a single record in the
5007 file; "block" here will mean the same thing as "datablock" (see `glossary`).
5011 plot 'file' every @{<point_incr>@}
5013 @{:@{<start_point>@}
5014 @{:@{<start_block>@}
5016 @{:<end_block>@}@}@}@}@}
5020 The data points to be plotted are selected according to a loop from
5021 <`start_point`> to <`end_point`> with increment <`point_incr`> and the
5022 blocks according to a loop from <`start_block`> to <`end_block`> with
5023 increment <`block_incr`>.
5025 The first datum in each block is numbered '0', as is the first block in the
5028 Note that records containing unplottable information are counted.
5030 Any of the numbers can be omitted; the increments default to unity, the start
5031 values to the first point or block, and the end values to the last point or
5032 block. If @ref{every} is not specified, all points in all lines are plotted.
5036 every :::3::3 # selects just the fourth block ('0' is first)
5037 every :::::9 # selects the first 10 blocks
5038 every 2:2 # selects every other point in every other block
5039 every ::5::15 # selects points 5 through 15 in each block
5044 @uref{http://www.gnuplot.info/demo/simple.html,simple plot demos (simple.dem)
5047 @uref{http://www.gnuplot.info/demo/surface1.html,Non-parametric splot demos
5050 @uref{http://gnuplot.sourceforge.net/demo/surface2.html,Parametric splot demos
5054 @node example_datafile, index, every, data
5055 @subsubsection example datafile
5057 @c ?commands plot datafile example
5058 @c ?plot datafile example
5060 @c ?datafile example
5061 @c ?data-file example
5064 This example plots the data in the file "population.dat" and a theoretical
5068 pop(x) = 103*exp((1965-x)/10)
5069 plot [1960:1990] 'population.dat', pop(x)
5073 The file "population.dat" might contain:
5076 # Gnu population in Antarctica since 1965
5085 @c ^ <img align=bottom src="http://www.gnuplot.info/doc/population.gif" alt="[population.gif]" width=640 height=480>
5087 @node index, smooth, example_datafile, data
5088 @subsubsection index
5090 @c ?commands plot datafile index
5091 @c ?plot datafile index
5097 The @ref{index} keyword allows you to select specific data sets in a multi-data-set
5102 plot 'file' index <m>@{@{:<n>@}:<p>@}
5106 Data sets are separated by pairs of blank records. `index <m>` selects only
5107 set <m>; `index <m>:<n>` selects sets in the range <m> to <n>; and `index
5108 <m>:<n>:<p>` selects indices <m>, <m>+<p>, <m>+2<p>, etc., but stopping at
5109 <n>. Following C indexing, the index 0 is assigned to the first data set in
5110 the file. Specifying too large an index results in an error message. If
5111 @ref{index} is not specified, all sets are plotted as a single data set.
5115 plot 'file' index 4:5
5119 For each point in the file, the index value of the data set it appears in is
5120 available via the pseudo-column `column(-2)`. This leads to an alternative way
5121 of distinguishing individual data sets within a file as shown below. This is
5122 more awkward that the @ref{index} command if all you are doing is selecting one
5123 data set for plotting, but is very useful if you want to assign different
5124 properties to each data set. See `lc variable`.
5128 plot 'file' using 1:(column(-2)==4 ? $2 : NaN) # very awkward
5129 plot 'file' using 1:2:(column(-2)) linecolor variable # very useful!
5133 @c ^ See also web page
5134 @uref{http://www.gnuplot.info/demo/multimsh.html, splot with indices demo.
5137 @node smooth, special-filenames, index, data
5138 @subsubsection smooth
5140 @c ?commands plot datafile smooth
5141 @c ?plot datafile smooth
5143 @c ?data-file smooth
5147 `gnuplot` includes a few general-purpose routines for interpolation and
5148 approximation of data; these are grouped under the @ref{smooth} option. More
5149 sophisticated data processing may be performed by preprocessing the data
5150 externally or by using @ref{fit} with an appropriate model.
5154 smooth @{unique | frequency | csplines | acsplines | bezier | sbezier@}
5158 `unique` and `frequency` plot the data after making them monotonic. Each of
5159 the other routines uses the data to determine the coefficients of a
5160 continuous curve between the endpoints of the data. This curve is then
5161 plotted in the same manner as a function, that is, by finding its value at
5162 uniform intervals along the abscissa (see @ref{samples}) and connecting these
5163 points with straight line segments (if a line style is chosen).
5165 If @ref{autoscale} is in effect, the ranges will be computed such that the
5166 plotted curve lies within the borders of the graph.
5168 If @ref{autoscale} is not in effect, and the smooth option is either `acspline`
5169 or `cspline`, the sampling of the generated curve is
5170 done across the intersection of the x range covered by the input data and
5171 the fixed abscissa range as defined by @ref{xrange}.
5173 If too few points are available to allow the selected option to be applied,
5174 an error message is produced. The minimum number is one for `unique` and
5175 `frequency`, four for `acsplines`, and three for the others.
5177 The @ref{smooth} options have no effect on function plots.
5180 @noindent --- ACSPLINES ---
5182 @c ?commands plot datafile smooth acsplines
5183 @c ?plot datafile smooth acsplines
5184 @c ?data-file smooth acsplines
5185 @c ?datafile smooth acsplines
5186 @c ?plot smooth acsplines
5188 @c ?smooth acsplines
5191 The `acsplines` option approximates the data with a "natural smoothing spline".
5192 After the data are made monotonic in x (see `smooth unique`), a curve is
5193 piecewise constructed from segments of cubic polynomials whose coefficients
5194 are found by the weighting the data points; the weights are taken from the
5195 third column in the data file. That default can be modified by the third
5196 entry in the @ref{using} list, e.g.,
5198 plot 'data-file' using 1:2:(1.0) smooth acsplines
5202 Qualitatively, the absolute magnitude of the weights determines the number
5203 of segments used to construct the curve. If the weights are large, the
5204 effect of each datum is large and the curve approaches that produced by
5205 connecting consecutive points with natural cubic splines. If the weights are
5206 small, the curve is composed of fewer segments and thus is smoother; the
5207 limiting case is the single segment produced by a weighted linear least
5208 squares fit to all the data. The smoothing weight can be expressed in terms
5209 of errors as a statistical weight for a point divided by a "smoothing factor"
5210 for the curve so that (standard) errors in the file can be used as smoothing
5216 plot 'data_file' using 1:2:(sw($3,100)) smooth acsplines
5221 @noindent --- BEZIER ---
5223 @c ?commands plot datafile smooth bezier
5224 @c ?plot datafile smooth bezier
5225 @c ?plot smooth bezier
5226 @c ?data-file smooth bezier
5227 @c ?datafile smooth bezier
5232 The `bezier` option approximates the data with a Bezier curve of degree n
5233 (the number of data points) that connects the endpoints.
5236 @noindent --- CSPLINES ---
5238 @c ?commands plot datafile smooth csplines
5239 @c ?plot datafile smooth csplines
5240 @c ?plot smooth csplines
5241 @c ?data-file smooth csplines
5242 @c ?datafile smooth csplines
5247 The `csplines` option connects consecutive points by natural cubic splines
5248 after rendering the data monotonic (see `smooth unique`).
5251 @noindent --- SBEZIER ---
5253 @c ?commands plot datafile smooth sbezier
5254 @c ?plot datafile smooth sbezier
5255 @c ?plot smooth sbezier
5256 @c ?data-file smooth sbezier
5257 @c ?datafile smooth sbezier
5262 The `sbezier` option first renders the data monotonic (`unique`) and then
5263 applies the `bezier` algorithm.
5266 @noindent --- UNIQUE ---
5268 @c ?commands plot datafile smooth unique
5269 @c ?plot datafile smooth unique
5270 @c ?plot smooth unique
5271 @c ?data-file smooth unique
5272 @c ?datafile smooth unique
5277 The `unique` option makes the data monotonic in x; points with the same
5278 x-value are replaced by a single point having the average y-value. The
5279 resulting points are then connected by straight line segments.
5281 @uref{http://www.gnuplot.info/demo/mgr.html,demos
5286 @noindent --- FREQUENCY ---
5288 @c ?commands plot datafile smooth frequency
5289 @c ?plot datafile smooth frequency
5290 @c ?plot smooth frequency
5291 @c ?data-file smooth frequency
5292 @c ?datafile smooth frequency
5294 @c ?smooth frequency
5297 The `frequency` option makes the data monotonic in x; points with the same
5298 x-value are replaced by a single point having the summed y-values. The
5299 resulting points are then connected by straight line segments.
5301 @node special-filenames, thru, smooth, data
5302 @subsubsection special-filenames
5304 @c ?commands plot datafile special-filenames
5305 @c ?plot datafile special-filenames
5306 @c ?plot special-filenames
5307 @c ?datafile special-filenames
5308 @cindex special-filenames
5310 A special filename of `'-'` specifies that the data are inline; i.e., they
5311 follow the command. Only the data follow the command; `plot` options like
5312 filters, titles, and line styles remain on the `plot` command line. This is
5313 similar to << in unix shell script, and $DECK in VMS DCL. The data are
5314 entered as though they are being read from a file, one data point per record.
5315 The letter "e" at the start of the first column terminates data entry. The
5316 @ref{using} option can be applied to these data---using it to filter them through
5317 a function might make sense, but selecting columns probably doesn't!
5319 `'-'` is intended for situations where it is useful to have data and commands
5320 together, e.g., when `gnuplot` is run as a sub-process of some front-end
5321 application. Some of the demos, for example, might use this feature. While
5322 `plot` options such as @ref{index} and @ref{every} are recognized, their use forces
5323 you to enter data that won't be used. For example, while
5326 plot '-' index 0, '-' index 1
5369 is a lot easier to type.
5371 If you use `'-'` with @ref{replot}, you may need to enter the data more than once
5374 A blank filename ('') specifies that the previous filename should be reused.
5375 This can be useful with things like
5378 plot 'a/very/long/filename' using 1:2, '' using 1:3, '' using 1:4
5382 (If you use both `'-'` and `''` on the same `plot` command, you'll need to
5383 have two sets of inline data, as in the example above.)
5385 On some computer systems with a popen function (Unix), the datafile can be
5386 piped through a shell command by starting the file name with a '<'. For
5390 pop(x) = 103*exp(-x/10)
5391 plot "< awk '@{print $1-1965, $2@}' population.dat", pop(x)
5395 would plot the same information as the first population example but with
5396 years since 1965 as the x axis. If you want to execute this example, you
5397 have to delete all comments from the data file above or substitute the
5398 following command for the first part of the command above (the part up to
5402 plot "< awk '$0 !~ /^#/ @{print $1-1965, $2@}' population.dat"
5406 While this approach is most flexible, it is possible to achieve simple
5407 filtering with the @ref{using} or @ref{thru} keywords.
5409 @node thru, using, special-filenames, data
5412 @c ?commands plot datafile thru
5413 @c ?plot datafile thru
5419 The @ref{thru} function is provided for backward compatibility.
5423 plot 'file' thru f(x)
5427 It is equivalent to:
5430 plot 'file' using 1:(f($2))
5434 While the latter appears more complex, it is much more flexible. The more
5438 plot 'file' thru f(y)
5442 also works (i.e. you can use y as the dummy variable).
5444 @ref{thru} is parsed for `splot` and @ref{fit} but has no effect.
5446 @node using, , thru, data
5447 @subsubsection using
5449 @c ?commands plot datafile using
5450 @c ?plot datafile using
5456 The most common datafile modifier is @ref{using}.
5460 plot 'file' using @{<entry> @{:<entry> @{:<entry> ...@}@}@} @{'format'@}
5464 If a format is specified, each datafile record is read using the C library's
5465 'scanf' function, with the specified format string. Otherwise the record is
5466 read and broken into columns. By default the separation between columns is
5467 whitespace (spaces and/or tabs), but see `datafile separator`.
5469 Each <entry> may be a simple column number that selects the value from one
5470 field of the input fit, an expression enclosed in parentheses, or empty.
5472 If the entry is an expression in parentheses, then the function column(N) may
5473 be used to indicate the value in column N. That is, column(1) refers to the
5474 first item read, column(2) to the second, and so on. The special symbols
5475 $1, $2, ... are shorthand for column(1), column(2) ... The function `valid(N)`
5476 tests whether the value in the Nth column is a valid number.
5478 In addition to the actual columns 1...N in the input data file, gnuplot
5479 presents data from several "pseudo-columns" that hold bookkeeping information.
5480 E.g. $0 or column(0) returns the sequence number of this data record within a
5483 An empty <entry> will default to its order in the list of entries.
5484 For example, `using ::4` is interpreted as `using 1:2:4`.
5486 If the @ref{using} list has but a single entry, that <entry> will be used for y
5487 and the data point number (pseudo-column $0) is used for x; for example,
5488 "`plot 'file' using 1`" is identical to "`plot 'file' using 0:1`".
5489 If the @ref{using} list has two entries, these will be used for x and y.
5490 See @ref{style} and @ref{fit} for details about plotting styles that make use of
5491 data from additional columns of input.
5493 'scanf' accepts several numerical specifications but `gnuplot`
5494 requires all inputs to be double-precision floating-point variables,
5495 so "%lf" is essentially the only permissible specifier.
5496 A format string given by the user must contain at least one such
5497 input specifier, and no more than seven of them.
5498 'scanf' expects to see white space---a blank, tab
5499 ("\t"), newline ("\n"), or formfeed ("\f")---between numbers; anything else
5500 in the input stream must be explicitly skipped.
5502 Note that the use of "\t", "\n", or "\f" requires use of double-quotes
5503 rather than single-quotes.
5506 @noindent --- USING_EXAMPLES ---
5510 @c ?commands plot datafile using examples
5511 @c ?plot datafile using examples
5512 @c ?datafile using examples
5514 This creates a plot of the sum of the 2nd and 3rd data against the first:
5515 The format string specifies comma- rather than space-separated columns.
5516 The same result could be achieved by specifying `set datafile separator ","`.
5518 plot 'file' using 1:($2+$3) '%lf,%lf,%lf'
5522 In this example the data are read from the file "MyData" using a more
5525 plot 'MyData' using "%*lf%lf%*20[^\n]%lf"
5529 The meaning of this format is:
5532 %*lf ignore a number
5533 %lf read a double-precision number (x by default)
5534 %*20[^\n] ignore 20 non-newline characters
5535 %lf read a double-precision number (y by default)
5539 One trick is to use the ternary `?:` operator to filter data:
5542 plot 'file' using 1:($3>10 ? $2 : 1/0)
5546 which plots the datum in column two against that in column one provided
5547 the datum in column three exceeds ten. `1/0` is undefined; `gnuplot`
5548 quietly ignores undefined points, so unsuitable points are suppressed.
5549 Or you can use the pre-defined variable NaN to achieve the same result.
5553 In fact, you can use a constant expression for the column number, provided it
5554 doesn't start with an opening parenthesis; constructs like `using
5555 0+(complicated expression)` can be used. The crucial point is that the
5556 expression is evaluated once if it doesn't start with a left parenthesis, or
5557 once for each data point read if it does.
5559 If timeseries data are being used, the time can span multiple columns. The
5560 starting column should be specified. Note that the spaces within the time
5561 must be included when calculating starting columns for other data. E.g., if
5562 the first element on a line is a time with an embedded space, the y value
5563 should be specified as column three.
5565 It should be noted that `plot 'file'`, `plot 'file' using 1:2`, and `plot
5566 'file' using ($1):($2)` can be subtly different: 1) if @ref{file} has some lines
5567 with one column and some with two, the first will invent x values when they
5568 are missing, the second will quietly ignore the lines with one column, and
5569 the third will store an undefined value for lines with one point (so that in
5570 a plot with lines, no line joins points across the bad point); 2) if a line
5571 contains text at the first column, the first will abort the plot on an error,
5572 but the second and third should quietly skip the garbage.
5574 In fact, it is often possible to plot a file with lots of lines of garbage at
5575 the top simply by specifying
5578 plot 'file' using 1:2
5582 However, if you want to leave text in your data files, it is safer to put the
5583 comment character (#) in the first column of the text lines.
5584 @c ^ See also the web page
5585 @uref{http://www.gnuplot.info/demo/using.html,Feeble using demos.
5588 If gnuplot is built with configuration option --enable-datastrings, then
5589 additional modifiers to @ref{using} can specify handling of text fields in the
5590 datafile. See `datastrings`, `using xticlabels`, @ref{title}.
5593 @noindent --- USING TITLE ---
5596 @c ?plot using title
5597 If gnuplot is built with configuration option --enable-datastrings, then
5598 the first entry of a column of the input data file can be used as a string
5599 to provide the plot title in the key box. The column containing specified
5600 is independent of the column[s] used for the plot itself.
5603 plot 'data' using 1:($2/$3) title column(N)
5607 In this case the entry in the first row of column N will be used for the
5608 key entry of the plot constructed from dividing column 2 by column 3.
5609 The entry in the first row of columns 2 and 3 will be ignored.
5613 @noindent --- XTICLABELS ---
5615 @c ?using xticlabels
5616 @c ?plot using xticlabels
5617 If gnuplot is built with configuration option --enable-datastrings, then
5618 a column of the input data file can be used to label axis tic marks.
5619 The format of such a plot command is
5622 plot 'datafile' using <xcol>:<ycol>:xticlabels(<labelcol>) with <plotstyle>
5626 Tic labels may be read for any of the plot axes: x x2 y y2 z.
5627 The `ticlabels(<labelcol>)` specifiers must come after all of the data
5628 coordinate specifiers in the @ref{using} portion of the command.
5629 For each data point which has a valid set of X,Y[,Z] coordinates,
5630 the text field found in column <labelcol> is added to the list of xtic labels
5631 at the same X coordinate as the point it belongs to. `xticlabels(<labelcol>)`
5632 may be shortened to `xtic(<labelcol>)`.
5637 splot "data" using 2:4:6:xtic(1):ytic(3):ztic(6)
5641 In this example the x and y axis tic labels are taken from different columns
5642 than the x and y coordinate values. The z axis tics, however, are generated
5643 from the z coordinate of the corresponding point.
5646 @noindent --- X2TICLABELS ---
5648 @c ?using x2ticlabels
5649 @c ?plot using x2ticlabels
5650 See `plot using xticlabels`.
5653 @noindent --- YTICLABELS ---
5655 @c ?using yticlabels
5656 @c ?plot using yticlabels
5657 See `plot using xticlabels`.
5660 @noindent --- Y2TICLABELS ---
5662 @c ?using y2ticlabels
5663 @c ?plot using y2ticlabels
5664 See `plot using xticlabels`.
5667 @noindent --- ZTICLABELS ---
5669 @c ?using zticlabels
5670 @c ?plot using zticlabels
5671 See `plot using xticlabels`.
5673 @node errorbars, errorlines, data, plot
5674 @subsection errorbars
5676 @c ?commands plot errorbars
5677 @c ?commands splot errorbars
5682 Error bars are supported for 2-d data file plots by reading one to four
5683 additional columns (or @ref{using} entries); these additional values are used in
5684 different ways by the various errorbar styles.
5686 In the default situation, `gnuplot` expects to see three, four, or six
5687 numbers on each line of the data file---either
5691 (x, y, ylow, yhigh),
5693 (x, y, xlow, xhigh),
5694 (x, y, xdelta, ydelta), or
5695 (x, y, xlow, xhigh, ylow, yhigh).
5699 The x coordinate must be specified. The order of the numbers must be
5700 exactly as given above, though the @ref{using} qualifier can manipulate the order
5701 and provide values for missing columns. For example,
5704 plot 'file' with errorbars
5705 plot 'file' using 1:2:(sqrt($1)) with xerrorbars
5706 plot 'file' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars
5710 The last example is for a file containing an unsupported combination of
5711 relative x and absolute y errors. The @ref{using} entry generates absolute x min
5712 and max from the relative error.
5714 The y error bar is a vertical line plotted from (x, ylow) to (x,
5715 yhigh). If ydelta is specified instead of ylow and yhigh, ylow = y -
5716 ydelta and yhigh = y + ydelta are derived. If there are only two
5717 numbers on the record, yhigh and ylow are both set to y. The x error
5718 bar is a horizontal line computed in the same fashion. To get lines
5719 plotted between the data points, `plot` the data file twice, once with
5720 errorbars and once with lines (but remember to use the `notitle`
5721 option on one to avoid two entries in the key). Alternately, use the
5722 errorlines command (see @ref{errorlines}).
5724 The error bars have crossbars at each end unless @ref{bars} is used
5725 (see @ref{bars} for details).
5727 If autoscaling is on, the ranges will be adjusted to include the error bars.
5730 @uref{http://gnuplot.sourceforge.net/demo/mgr.html,errorbar demos.
5733 See @ref{using}, @ref{with}, and @ref{style} for more information.
5735 @node errorlines, parametric, errorbars, plot
5736 @subsection errorlines
5738 @c ?commands plot errorlines
5739 @c ?commands splot errorlines
5741 @c ?splot errorlines
5744 Lines with error bars are supported for 2-d data file plots by reading
5745 one to four additional columns (or @ref{using} entries); these additional
5746 values are used in different ways by the various errorlines styles.
5748 In the default situation, `gnuplot` expects to see three, four, or six
5749 numbers on each line of the data file---either
5753 (x, y, ylow, yhigh),
5755 (x, y, xlow, xhigh),
5756 (x, y, xdelta, ydelta), or
5757 (x, y, xlow, xhigh, ylow, yhigh).
5761 The x coordinate must be specified. The order of the numbers must be
5762 exactly as given above, though the @ref{using} qualifier can manipulate
5763 the order and provide values for missing columns. For example,
5766 plot 'file' with errorlines
5767 plot 'file' using 1:2:(sqrt($1)) with xerrorlines
5768 plot 'file' using 1:2:($1-$3):($1+$3):4:5 with xyerrorlines
5772 The last example is for a file containing an unsupported combination
5773 of relative x and absolute y errors. The @ref{using} entry generates
5774 absolute x min and max from the relative error.
5776 The y error bar is a vertical line plotted from (x, ylow) to (x,
5777 yhigh). If ydelta is specified instead of ylow and yhigh, ylow = y -
5778 ydelta and yhigh = y + ydelta are derived. If there are only two
5779 numbers on the record, yhigh and ylow are both set to y. The x error
5780 bar is a horizontal line computed in the same fashion.
5782 The error bars have crossbars at each end unless @ref{bars} is used
5783 (see @ref{bars} for details).
5785 If autoscaling is on, the ranges will be adjusted to include the error bars.
5787 See @ref{using}, @ref{with}, and @ref{style} for more information.
5789 @node parametric, ranges, errorlines, plot
5790 @subsection parametric
5792 @c ?commands plot parametric
5793 @c ?commands splot parametric
5795 @c ?splot parametric
5796 When in parametric mode (`set parametric`) mathematical expressions must be
5797 given in pairs for `plot` and in triplets for `splot`.
5802 splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
5806 Data files are plotted as before, except any preceding parametric function
5807 must be fully specified before a data file is given as a plot. In other
5808 words, the x parametric function (`sin(t)` above) and the y parametric
5809 function (`t**2` above) must not be interrupted with any modifiers or data
5810 functions; doing so will generate a syntax error stating that the parametric
5811 function is not fully specified.
5813 Other modifiers, such as @ref{with} and @ref{title}, may be specified only after the
5814 parametric function has been completed:
5817 plot sin(t),t**2 title 'Parametric example' with linespoints
5822 @uref{http://www.gnuplot.info/demo/param.html,Parametric Mode Demos.
5825 @node ranges, title, parametric, plot
5828 @c ?commands plot ranges
5829 @c ?commands splot ranges
5834 The optional ranges specify the region of the graph that will be displayed.
5838 [@{<dummy-var>=@}@{@{<min>@}:@{<max>@}@}]
5839 [@{@{<min>@}:@{<max>@}@}]
5843 The first form applies to the independent variable (@ref{xrange} or @ref{trange}, if
5844 in parametric mode). The second form applies to the dependent variable
5845 @ref{yrange} (and @ref{xrange}, too, if in parametric mode). <dummy-var> is a new
5846 name for the independent variable. (The defaults may be changed with @ref{dummy}.) The optional <min> and <max> terms can be constant expressions or *.
5848 In non-parametric mode, the order in which ranges must be given is @ref{xrange}
5851 In parametric mode, the order for the `plot` command is @ref{trange}, @ref{xrange},
5852 and @ref{yrange}. The following `plot` command shows setting the @ref{trange} to
5853 [-pi:pi], the @ref{xrange} to [-1.3:1.3] and the @ref{yrange} to [-1:1] for the
5854 duration of the graph:
5857 plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2
5861 Note that the x2range and y2range cannot be specified here---@ref{x2range}
5862 and @ref{y2range} must be used.
5864 Ranges are interpreted in the order listed above for the appropriate mode.
5865 Once all those needed are specified, no further ones must be listed, but
5866 unneeded ones cannot be skipped---use an empty range `[]` as a placeholder.
5868 `*` can be used to allow autoscaling of either of min and max. See also
5871 Ranges specified on the `plot` or `splot` command line affect only that
5872 graph; use the @ref{xrange}, @ref{yrange}, etc., commands to change the
5873 default ranges for future graphs.
5875 With time data, you must provide the range (in the same manner as the time
5876 appears in the datafile) within quotes. `gnuplot` uses the @ref{timefmt} string
5877 to read the value---see @ref{timefmt}.
5881 This uses the current ranges:
5887 This sets the x range only:
5889 plot [-10:30] sin(pi*x)/(pi*x)
5893 This is the same, but uses t as the dummy-variable:
5895 plot [t = -10 :30] sin(pi*t)/(pi*t)
5899 This sets both the x and y ranges:
5901 plot [-pi:pi] [-3:3] tan(x), 1/x
5905 This sets only the y range, and turns off autoscaling on both axes:
5907 plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)
5911 This sets xmax and ymin only:
5913 plot [:200] [-pi:] exp(sin(x))
5917 This sets the x range for a timeseries:
5919 set timefmt "%d/%m/%y %H:%M"
5920 plot ["1/6/93 12:00":"5/6/93 12:00"] 'timedata.dat'
5925 @node title, with, ranges, plot
5928 @c ?commands plot title
5929 @c ?commands splot title
5932 A line title for each function and data set appears in the key, accompanied
5933 by a sample of the line and/or symbol used to represent it. It can be
5934 changed by using the @ref{title} option.
5938 title "<title>" | notitle ["<ignored title>"]
5942 where <title> is the new title of the line and must be enclosed in quotes.
5943 The quotes will not be shown in the key. A special character may be given as
5944 a backslash followed by its octal value ("\345"). The tab character "\t" is
5945 understood. Note that backslash processing occurs only for strings enclosed
5946 in double quotes---use single quotes to prevent such processing. The newline
5947 character "\n" is not processed in key entries in either type of string.
5949 The line title and sample can be omitted from the key by using the keyword
5950 `notitle`. A null title (`title ''`) is equivalent to `notitle`. If only
5951 the sample is wanted, use one or more blanks (`title ' '`). If `notitle`
5952 is followed by a string this string is ignored.
5954 If `key autotitles` is set (which is the default) and neither @ref{title} nor
5955 `notitle` are specified the line title is the function name or the file name as
5956 it appears on the `plot` command. If it is a file name, any datafile modifiers
5957 specified will be included in the default title.
5959 The layout of the key itself (position, title justification, etc.) can be
5960 controlled by @ref{key}. Please see @ref{key} for details.
5964 This plots y=x with the title 'x':
5970 This plots x squared with title "x^2" and file "data.1" with title
5973 plot x**2 title "x^2", 'data.1' t "measured data"
5977 This puts an untitled circular border around a polar graph:
5979 set polar; plot my_function(t), 1 notitle
5983 @node with, , title, plot
5986 @c ?commands plot with
5987 @c ?commands splot with
5988 @c ?commands plot style
5989 @c ?commands splot style
6000 Functions and data may be displayed in one of a large number of styles.
6001 The @ref{with} keyword provides the means of selection.
6005 with <style> @{ @{linestyle | ls <line_style>@}
6006 | @{@{linetype | lt <line_type>@}
6007 @{linewidth | lw <line_width>@}
6008 @{linecolor | lc <colorspec>@}
6009 @{pointtype | pt <point_type>@}
6010 @{pointsize | ps <point_size>@}
6011 @{fill | fs <fillstyle>@}
6012 @{nohidden3d | nocontours@}
6018 where <style> is either `lines`, `points`, `linespoints`, `impulses`,
6019 `dots`, `steps`, `fsteps`, `histeps`, @ref{errorbars}, `labels`, `xerrorbars`,
6020 `yerrorbars`, `xyerrorbars`, @ref{errorlines}, `xerrorlines`, `yerrorlines`,
6021 `xyerrorlines`, `boxes`, `histograms`, `filledcurves`, `boxerrorbars`,
6022 `boxxyerrorbars`, `financebars`, `candlesticks`, `vectors`, `image`,
6023 `rgbimage` or @ref{pm3d}. Some of these styles require additional information.
6024 See `plotting styles` for details of each style. `fill` is relevant only
6025 to certain 2D plots (currently `boxes` `boxxyerrorbars` and `candlesticks`).
6026 Note that `filledcurves` and @ref{pm3d} can take an additional option not
6027 listed above (the latter only when used in the `splot` command)---see
6028 their help or examples below for more details.
6030 Default styles are chosen with the `set style function` and `set style data`
6033 By default, each function and data file will use a different line type and
6034 point type, up to the maximum number of available types. All terminal
6035 drivers support at least six different point types, and re-use them, in
6036 order, if more are required. The LaTeX driver supplies an additional six
6037 point types (all variants of a circle), and thus will only repeat after 12
6038 curves are plotted with points. The PostScript drivers (@ref{postscript})
6039 supplies a total of 64.
6041 If you wish to choose the line or point type for a single plot, <line_type>
6042 and <point_type> may be specified. These are positive integer constants (or
6043 expressions) that specify the line type and point type to be used for the
6044 plot. Use @ref{test} to display the types available for your terminal.
6046 You may also scale the line width and point size for a plot by using
6047 <line_width> and <point_size>, which are specified relative to the default
6048 values for each terminal. The pointsize may also be altered
6049 globally---see @ref{pointsize} for details. But note that both <point_size>
6050 as set here and as set by @ref{pointsize} multiply the default point
6051 size---their effects are not cumulative. That is,
6052 `set pointsize 2; plot x w p ps 3` will use points three times default size,
6055 It is also possible to specify `pointsize variable` either as part of a
6056 line style or for an individual plot. In this case one extra column of input
6057 is required, i.e. 3 columns for a 2D plot and 4 columns for a 3D splot. The
6058 size of each individual point is determined by multiplying the global
6059 pointsize by the value read from the data file.
6061 If you have defined specific line type/width and point type/size combinations
6062 with `set style line`, one of these may be selected by setting <line_style> to
6063 the index of the desired style.
6065 If gnuplot was built with @ref{pm3d} support, the special keyword @ref{palette} is
6066 allowed for smooth color change of lines, points and dots in `splots`. The
6067 color is chosen from a smooth palette which was set previously with the
6068 command @ref{palette}. The color value corresponds to the z-value of the
6069 point coordinates or to the color coordinate if specified by the 4th parameter
6070 in @ref{using}. Both 2d and 3d plots (`plot` and `splot` commands) can use palette
6071 colors as specified by either their fractional value or the corresponding value
6072 mapped to the colorbox range. A palette color value can also be read from an
6073 explicitly specified column in the @ref{using} specifier.
6074 Z value. See `colors`, @ref{palette}, `linetype`.
6076 The keyword `nohidden3d` applies only to plots made with the `splot` command.
6077 Normally the global option @ref{hidden3d} applies to all plots in the graph.
6078 You can attach the `nohidden3d` option to any individual plots that you want
6079 to exclude from the hidden3d processing. The individual elements other than
6080 surfaces (i.e. lines, dots, labels, ...) of a plot marked `nohidden3d` will all
6081 be drawn, even if they would normally be obscured by other plot elements.
6083 Similarly, the keyword `nocontours` will turn off contouring for an individual
6084 plot even if the global property "set contour" is active.
6086 The keywords may be abbreviated as indicated.
6088 Note that the `linewidth`, @ref{pointsize} and @ref{palette} options are not supported
6093 This plots sin(x) with impulses:
6095 plot sin(x) with impulses
6099 This plots x with points, x**2 with the default:
6101 plot x w points, x**2
6105 This plots tan(x) with the default function style, file "data.1" with lines:
6107 plot [ ] [-2:5] tan(x), 'data.1' with l
6111 This plots "leastsq.dat" with impulses:
6113 plot 'leastsq.dat' w i
6117 This plots the data file "population" with boxes:
6119 plot 'population' with boxes
6123 This plots "exper.dat" with errorbars and lines connecting the points
6124 (errorbars require three or four columns):
6126 plot 'exper.dat' w lines, 'exper.dat' notitle w errorbars
6130 Another way to plot "exper.dat" with errorlines (errorbars require three
6133 plot 'exper.dat' w errorlines
6137 This plots sin(x) and cos(x) with linespoints, using the same line type but
6138 different point types:
6140 plot sin(x) with linesp lt 1 pt 3, cos(x) with linesp lt 1 pt 4
6144 This plots file "data" with points of type 3 and twice usual size:
6146 plot 'data' with points pointtype 3 pointsize 2
6150 This plots file "data" with variable pointsize read from column 4
6152 plot 'data' using 1:2:4 with points pt 5 pointsize variable
6156 This plots two data sets with lines differing only by weight:
6158 plot 'd1' t "good" w l lt 2 lw 3, 'd2' t "bad" w l lt 2 lw 1
6162 This plots filled curve of x*x and a color stripe:
6164 plot x*x with filledcurve closed, 40 with filledcurve y1=10
6168 This plots x*x and a color box:
6170 plot x*x, (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y1=10 lt 8
6174 This plots a surface with color lines:
6176 splot x*x-y*y with line palette
6180 This plots two color surfaces at different altitudes:
6182 splot x*x-y*y with pm3d, x*x+y*y with pm3d at t
6187 @node print, pwd, plot, Commands
6195 The @ref{print} command prints the value of <expression> to the screen. It is
6196 synonymous with `pause 0`. <expression> may be anything that `gnuplot` can
6197 evaluate that produces a number, or it can be a string.
6201 print <expression> @{, <expression>, ...@}
6205 See `expressions`. The output file can be set with @ref{print}.
6207 @node pwd, quit, print, Commands
6215 The @ref{pwd} command prints the name of the working directory to the screen.
6217 @node quit, raise, pwd, Commands
6225 The @ref{exit} and @ref{quit} commands and END-OF-FILE character will exit `gnuplot`.
6226 Each of these commands will clear the output device (as does the @ref{clear}
6227 command) before exiting.
6229 @node raise, replot, quit, Commands
6239 raise @{plot_window_nb@}
6243 The @ref{raise} command raises (opposite to @ref{lower}) plot window(s) associated
6244 with the interactive terminal of your gnuplot session, i.e. `pm`, `win`, `wxt`
6245 or `x11`. It puts the plot window to front (top) in the z-order windows stack
6246 of the window manager of your desktop.
6248 As `x11` and `wxt` support multiple plot windows, then by default they raise
6249 these windows in descending order of most recently created on top to the least
6250 recently created on bottom. If a plot number is supplied as an optional
6251 parameter, only the associated plot window will be raised if it exists.
6253 The optional parameter is ignored for single plot-windows terminal, i.e. `pm`
6257 If the window is not raised under X11, then (1) they don't run in the same
6258 X11 session (telnet or ssh session, for example), or (2) raising is blocked
6259 by your window manager. On KDE, you may like to go to the KDE Control Center
6260 => Desktop => Window Behaviour => Advanced and set the "Focus stealing
6261 prevention level" to None (default is Low).
6265 @node replot, reread, raise, Commands
6273 The @ref{replot} command without arguments repeats the last `plot` or `splot`
6274 command. This can be useful for viewing a plot with different `set` options,
6275 or when generating the same plot for several devices.
6277 Arguments specified after a @ref{replot} command will be added onto the last
6278 `plot` or `splot` command (with an implied ',' separator) before it is
6279 repeated. @ref{replot} accepts the same arguments as the `plot` and `splot`
6280 commands except that ranges cannot be specified. Thus you can use @ref{replot}
6281 to plot a function against the second axes if the previous command was `plot`
6282 but not if it was `splot`.
6287 plot '-' ; ... ; replot
6291 is not recommended. `gnuplot` does not store the inline data internally, so
6292 since @ref{replot} appends new information to the previous `plot` and then
6293 executes the modified command, the `'-'` from the initial `plot` will expect
6294 to read inline data again.
6296 Note that @ref{replot} does not work in @ref{multiplot} mode, since it reproduces
6297 only the last plot rather than the entire screen.
6299 See also `command-line-editing` for ways to edit the last `plot` (`splot`)
6302 See also `show plot` to show the whole current plotting command, and the
6303 possibility to copy it into the `history`.
6305 @node reread, reset, replot, Commands
6313 The @ref{reread} command causes the current `gnuplot` command file, as specified
6314 by a `load` command or on the command line, to be reset to its starting
6315 point before further commands are read from it. This essentially implements
6316 an endless loop of the commands from the beginning of the command file to
6317 the @ref{reread} command. (But this is not necessarily a disaster---@ref{reread} can
6318 be very useful when used in conjunction with @ref{if}. See @ref{if} for details.)
6319 The @ref{reread} command has no effect if input from standard input.
6323 Suppose the file "looper" contains the commands
6331 and from within `gnuplot` you submit the commands
6337 The result will be five plots (separated by the @ref{pause} message).
6339 Suppose the file "data" contains six columns of numbers with a total yrange
6340 from 0 to 10; the first is x and the next are five different functions of x.
6341 Suppose also that the file "plotter" contains the commands
6344 plot "$0" using 1:c_p with lines linetype c_p
6345 if(c_p < n_p) reread
6348 and from within `gnuplot` you submit the commands
6355 call 'plotter' 'data'
6359 The result is a single graph consisting of five plots. The yrange must be
6360 set explicitly to guarantee that the five separate graphs (drawn on top of
6361 each other in multiplot mode) will have exactly the same axes. The linetype
6362 must be specified; otherwise all the plots would be drawn with the same type.
6363 See animate.dem in demo directory for an animated example.
6366 @node reset, save, reread, Commands
6374 The @ref{reset} command causes all graph-related options that can be set with the
6375 `set` command to take on their default values. This command is useful, e.g.,
6376 to restore the default graph settings at the end of a command file, or to
6377 return to a defined state after lots of settings have been changed within a
6378 command file. Please refer to the `set` command to see the default values
6379 that the various options take.
6381 The following `set` commands do not change the graph status and are thus left
6382 unchanged: the terminal set with `set term`, the output file set with @ref{output} and directory paths set with @ref{loadpath} and @ref{fontpath}.
6384 @node save, set-show, reset, Commands
6387 @c ^ <a name="save set"></a>
6393 The @ref{save} command saves user-defined functions, variables, the `set
6394 term` status, all `set` options, or all of these, plus the last `plot`
6395 (`splot`) command to the specified file.
6399 save @{<option>@} '<filename>'
6403 where <option> is @ref{functions}, @ref{variables}, @ref{terminal} or `set`. If
6404 no option is used, `gnuplot` saves functions, variables, `set`
6405 options and the last `plot` (`splot`) command.
6407 @ref{save}d files are written in text format and may be read by the
6408 `load` command. For @ref{save} with the `set` option or without any
6409 option, the @ref{terminal} choice and the @ref{output} filename are written
6410 out as a comment, to get an output file that works in other
6411 installations of gnuplot, without changes and without risk of
6412 unwillingly overwriting files.
6414 @ref{terminal} will write out just the @ref{terminal} status, without
6415 the comment marker in front of it. This is mainly useful for
6416 switching the @ref{terminal} setting for a short while, and getting back
6417 to the previously set terminal, afterwards, by loading the saved
6418 @ref{terminal} status. Note that for a single gnuplot session you may
6419 rather use the other method of saving and restoring current terminal
6420 by the commands `set term push` and `set term pop`, see `set term`.
6422 The filename must be enclosed in quotes.
6424 The special filename "-" may be used to @ref{save} commands to standard output.
6425 On systems which support a popen function (Unix), the output of save can be
6426 piped through an external program by starting the file name with a '|'.
6427 This provides a consistent interface to `gnuplot`'s internal settings to
6428 programs which communicate with `gnuplot` through a pipe. Please see
6429 help for `batch/interactive` for more details.
6434 save functions 'func.dat'
6436 save set 'options.dat'
6437 save term 'myterm.gnu'
6439 save '|grep title >t.gp'
6443 @node set-show, shell, save, Commands
6453 The `set` command can be used to set _lots_ of options. No screen is
6454 drawn, however, until a `plot`, `splot`, or @ref{replot} command is given.
6456 The `show` command shows their settings; `show all` shows all the
6459 Options changed using `set` can be returned to the default state by giving the
6460 corresponding @ref{unset} command. See also the @ref{reset} command, which returns
6461 all settable parameters to default values.
6463 If a variable contains time/date data, `show` will display it according to
6464 the format currently defined by @ref{timefmt}, even if that was not in effect
6465 when the variable was initially defined.
6590 @node angles, arrow, set-show, set-show
6593 @c ?commands set angles
6594 @c ?commands show angles
6601 @c ?commands set angles degrees
6602 @c ?set angles degrees
6606 By default, `gnuplot` assumes the independent variable in polar graphs is in
6607 units of radians. If `set angles degrees` is specified before `set polar`,
6608 then the default range is [0:360] and the independent variable has units of
6609 degrees. This is particularly useful for plots of data files. The angle
6610 setting also applies to 3-d mapping as set via the @ref{mapping} command.
6614 set angles @{degrees | radians@}
6619 The angle specified in `set grid polar` is also read and displayed in the
6620 units specified by @ref{angles}.
6622 @ref{angles} also affects the arguments of the machine-defined functions
6623 sin(x), cos(x) and tan(x), and the outputs of asin(x), acos(x), atan(x),
6624 atan2(x), and arg(x). It has no effect on the arguments of hyperbolic
6625 functions or Bessel functions. However, the output arguments of inverse
6626 hyperbolic functions of complex arguments are affected; if these functions
6627 are used, `set angles radians` must be in effect to maintain consistency
6628 between input and output arguments.
6634 print y #prints @{1.16933, 0.154051@}
6635 print asinh(y) #prints @{1.0, 0.1@}
6642 print y #prints @{1.16933, 0.154051@}
6643 print asinh(y) #prints @{57.29578, 5.729578@}
6647 @uref{http://www.gnuplot.info/demo/poldat.html,poldat.dem: polar plot using @ref{angles} demo.
6650 @node arrow, autoscale, angles, set-show
6653 @c ?commands set arrow
6654 @c ?commands unset arrow
6655 @c ?commands show arrow
6665 Arbitrary arrows can be placed on a plot using the @ref{arrow} command.
6669 set arrow @{<tag>@} @{from <position>@} @{to|rto <position>@}
6670 @{ @{arrowstyle | as <arrow_style>@}
6671 | @{ @{nohead | head | backhead | heads@}
6672 @{size <length>,<angle>@{,<backangle>@}@}
6673 @{filled | empty | nofilled@}
6675 @{ @{linestyle | ls <line_style>@}
6676 | @{linetype | lt <line_type>@}
6677 @{linewidth | lw <line_width@} @} @} @}
6682 unset arrow @{<tag>@}
6683 show arrow @{<tag>@}
6687 <tag> is an integer that identifies the arrow. If no tag is given, the
6688 lowest unused tag value is assigned automatically. The tag can be used to
6689 delete or change a specific arrow. To change any attribute of an existing
6690 arrow, use the @ref{arrow} command with the appropriate tag and specify the
6691 parts of the arrow to be changed.
6693 The <position>s are specified by either x,y or x,y,z, and may be preceded by
6694 `first`, `second`, `graph`, `screen`, or `character` to select the coordinate
6695 system. Unspecified coordinates default to 0. The end points can be
6696 specified in one of five coordinate systems---`first` or `second` axes,
6697 `graph`, `screen`, or `character`. See `coordinates` for details. A
6698 coordinate system specifier does not carry over from the "from" position to
6699 the "to" position. Arrows outside the screen boundaries are permitted but
6700 may cause device errors. If the end point is specified by "rto" instead of
6701 "to" it is drawn relatively to the start point. For linear axes, `graph`
6702 and `screen` coordinates, the distance between the start and the end point
6703 corresponds to the given relative coordinate. For logarithmic axes, the
6704 relative given coordinate corresponds to the factor of the coordinate
6705 between start and end point. Thus, a negative relative value or zero are
6706 not allowed for logarithmic axes.
6708 Specifying `nohead` produces an arrow drawn without a head---a line segment.
6709 This gives you yet another way to draw a line segment on the plot. By
6710 default, an arrow has a head at its end. Specifying `backhead` draws an arrow
6711 head at the start point of the arrow while `heads` draws arrow heads on both
6712 ends of the line. Not all terminal types support double-ended arrows.
6714 Head size can be controlled by `size <length>,<angle>` or
6715 `size <length>,<angle>,<backangle>`, where `<length>` defines length of each
6716 branch of the arrow head and `<angle>` the angle (in degrees) they make with
6717 the arrow. `<Length>` is in x-axis units; this can be changed by `first`,
6718 `second`, `graph`, `screen`, or `character` before the <length>; see
6719 `coordinates` for details. `<Backangle>` only takes effect when `filled`
6720 or `empty` is also used. Then, `<backangle>` is the angle (in degrees) the
6721 back branches make with the arrow (in the same direction as `<angle>`).
6722 The `fig` terminal has a restricted backangle function. It supports three
6723 different angles. There are two thresholds: Below 70 degrees, the arrow head
6724 gets an indented back angle. Above 110 degrees, the arrow head has an acute
6725 back angle. Between these thresholds, the back line is straight.
6727 Specifying `filled` produces filled arrow heads (if heads are used).
6728 Filling is supported on filled-polygon capable terminals, see help of @ref{pm3d}
6729 for their list, otherwise the arrow heads are closed but not filled.
6730 The same result (closed but not filled arrow head) is reached by specifying
6731 `empty`. Further, filling and outline is obviously not supported on
6732 terminals drawing arrows by their own specific routines, like `metafont`,
6733 `metapost`, `latex` or `tgif`.
6735 The line style may be selected from a user-defined list of line styles
6736 (see `set style line`) or may be defined here by providing values for
6737 <line_type> (an index from the default list of styles) and/or <line_width>
6738 (which is a multiplier for the default width).
6740 Note, however, that if a user-defined line style has been selected, its
6741 properties (type and width) cannot be altered merely by issuing another
6742 @ref{arrow} command with the appropriate index and `lt` or `lw`.
6744 If `front` is given, the arrow is written on top of the graphed data. If
6745 `back` is given (the default), the arrow is written underneath the graphed
6746 data. Using `front` will prevent an arrow from being obscured by dense data.
6750 To set an arrow pointing from the origin to (1,2) with user-defined style 5,
6753 set arrow to 1,2 ls 5
6757 To set an arrow from bottom left of plotting area to (-5,5,3), and tag the
6758 arrow number 3, use:
6760 set arrow 3 from graph 0,0 to -5,5,3
6764 To change the preceding arrow to end at 1,1,1, without an arrow head and
6765 double its width, use:
6767 set arrow 3 to 1,1,1 nohead lw 2
6771 To draw a vertical line from the bottom to the top of the graph at x=3, use:
6773 set arrow from 3, graph 0 to 3, graph 1 nohead
6777 To draw a vertical arrow with T-shape ends, use:
6779 set arrow 3 from 0,-5 to 0,5 heads size screen 0.1,90
6783 To draw an arrow relatively to the start point, where the relative distances
6784 are given in graph coordinates, use:
6786 set arrow from 0,-5 rto graph 0.1,0.1
6790 To draw an arrow with relative end point in logarithmic x axis, use:
6793 set arrow from 100,-5 rto 10,10
6796 This draws an arrow from 100,-5 to 1000,5. For the logarithmic x axis, the
6797 relative coordinate 10 means "factor 10" while for the linear y axis, the
6798 relative coordinate 10 means "difference 10".
6800 To delete arrow number 2, use:
6806 To delete all arrows, use:
6812 To show all arrows (in tag order), use:
6818 @uref{http://gnuplot.sourceforge.net/demo/arrowstyle.html,arrows demos.
6822 @node autoscale, bars, arrow, set-show
6823 @subsection autoscale
6825 @c ?commands set autoscale
6826 @c ?commands unset autoscale
6827 @c ?commands show autoscale
6837 Autoscaling may be set individually on the x, y or z axis or globally on all
6838 axes. The default is to autoscale all axes.
6842 set autoscale @{<axes>@{|min|max|fixmin|fixmax|fix@} | fix | keepfix@}
6843 unset autoscale @{<axes>@}
6848 where <axes> is either `x`, `y`, `z`, `cb`, `x2`, `y2` or `xy`. A keyword with
6849 `min` or `max` appended (this cannot be done with `xy`) tells `gnuplot` to
6850 autoscale just the minimum or maximum of that axis. If no keyword is given,
6851 all axes are autoscaled.
6853 A keyword with `fixmin`, `fixmax` or `fix` appended tells gnuplot to disable
6854 extension of the axis range to the next tic mark position, for autoscaled
6855 axes using equidistant tics; `set autoscale fix` sets this for all axes.
6856 Command `set autoscale keepfix` autoscales all axes while keeping the fix
6859 When autoscaling, the axis range is automatically computed and the dependent
6860 axis (y for a `plot` and z for `splot`) is scaled to include the range of the
6861 function or data being plotted.
6863 If autoscaling of the dependent axis (y or z) is not set, the current y or z
6866 Autoscaling the independent variables (x for `plot` and x,y for `splot`) is a
6867 request to set the domain to match any data file being plotted. If there are
6868 no data files, autoscaling an independent variable has no effect. In other
6869 words, in the absence of a data file, functions alone do not affect the x
6870 range (or the y range if plotting z = f(x,y)).
6872 Please see @ref{xrange} for additional information about ranges.
6874 The behavior of autoscaling remains consistent in parametric mode, (see
6875 `set parametric`). However, there are more dependent variables and hence more
6876 control over x, y, and z axis scales. In parametric mode, the independent or
6877 dummy variable is t for `plot`s and u,v for `splot`s. @ref{autoscale} in
6878 parametric mode, then, controls all ranges (t, u, v, x, y, and z) and allows
6879 x, y, and z to be fully autoscaled.
6881 Autoscaling works the same way for polar mode as it does for parametric mode
6882 for `plot`, with the extension that in polar mode @ref{dummy} can be used to
6883 change the independent variable from t (see @ref{dummy}).
6885 When tics are displayed on second axes but no plot has been specified for
6886 those axes, x2range and y2range are inherited from xrange and yrange. This
6887 is done _before_ xrange and yrange are autoextended to a whole number of
6888 tics, which can cause unexpected results. You can use the `fixmin`
6889 or `fixmax` options to avoid this.
6893 This sets autoscaling of the y axis (other axes are not affected):
6899 This sets autoscaling only for the minimum of the y axis (the maximum of the
6900 y axis and the other axes are not affected):
6906 This disables extension of the x2 axis tics to the next tic mark,
6907 thus keeping the exact range as found in the plotted data and functions:
6909 set autoscale x2fixmin
6910 set autoscale x2fixmax
6914 This sets autoscaling of the x and y axes:
6920 This sets autoscaling of the x, y, z, x2 and y2 axes:
6926 This disables autoscaling of the x, y, z, x2 and y2 axes:
6932 This disables autoscaling of the z axis only:
6943 @node parametric_mode, polar_mode, autoscale, autoscale
6944 @subsubsection parametric mode
6946 @c ?commands set autoscale parametric
6947 @c ?set autoscale parametric
6949 When in parametric mode (`set parametric`), the xrange is as fully scalable
6950 as the y range. In other words, in parametric mode the x axis can be
6951 automatically scaled to fit the range of the parametric function that is
6952 being plotted. Of course, the y axis can also be automatically scaled just
6953 as in the non-parametric case. If autoscaling on the x axis is not set, the
6954 current x range is used.
6956 Data files are plotted the same in parametric and non-parametric mode.
6957 However, there is a difference in mixed function and data plots: in
6958 non-parametric mode with autoscaled x, the x range of the datafile controls
6959 the x range of the functions; in parametric mode it has no influence.
6961 For completeness a last command `set autoscale t` is accepted. However, the
6962 effect of this "scaling" is very minor. When `gnuplot` determines that the
6963 t range would be empty, it makes a small adjustment if autoscaling is true.
6964 Otherwise, `gnuplot` gives an error. Such behavior may, in fact, not be very
6965 useful and the command `set autoscale t` is certainly questionable.
6967 `splot` extends the above ideas as you would expect. If autoscaling is set,
6968 then x, y, and z ranges are computed and each axis scaled to fit the
6971 @node polar_mode, , parametric_mode, autoscale
6972 @subsubsection polar mode
6974 @c ?commands set autoscale polar
6975 @c ?set autoscale polar
6976 When in polar mode (`set polar`), the xrange and the yrange are both found
6977 from the polar coordinates, and thus they can both be automatically scaled.
6978 In other words, in polar mode both the x and y axes can be automatically
6979 scaled to fit the ranges of the polar function that is being plotted.
6981 When plotting functions in polar mode, the rrange may be autoscaled. When
6982 plotting data files in polar mode, the trange may also be autoscaled. Note
6983 that if the trange is contained within one quadrant, autoscaling will produce
6984 a polar plot of only that single quadrant.
6986 Explicitly setting one or two ranges but not others may lead to unexpected
6989 @uref{http://www.gnuplot.info/demo/poldat.html,polar demos.
6992 @node bars, bmargin, autoscale, set-show
6995 @c ?commands set bars
6996 @c ?commands show bars
7003 The @ref{bars} command controls the tics at the ends of error bars,
7004 and also the width of the boxes in plot styles candlesticks and
7009 set bars @{small | large | fullwidth | <size>@}
7015 `small` is a synonym for 0.0, and `large` for 1.0.
7016 The default is 1.0 if no size is given.
7018 The keyword `fullwidth` is relevant only to histograms with errorbars.
7019 It sets the width of the errorbar ends to be the same as the width of the
7020 associated box in the histogram. It does not change the width of the box
7023 @node bmargin, border, bars, set-show
7026 @c ?commands set bmargin
7032 The command @ref{bmargin} sets the size of the bottom margin.
7033 Please see @ref{margin} for details.
7035 @node border, boxwidth, bmargin, set-show
7038 @c ?commands set border
7039 @c ?commands unset border
7040 @c ?commands show border
7050 The @ref{border} and @ref{border} commands control the display of the graph
7051 borders for the `plot` and `splot` commands. Note that the borders do not
7052 necessarily coincide with the axes; with `plot` they often do, but with
7053 `splot` they usually do not.
7057 set border @{<integer>@} @{front | back@} @{linewidth | lw <line_width>@}
7058 @{@{linestyle | ls <line_style>@} | @{linetype | lt <line_type>@}@}
7064 With a `splot` displayed in an arbitrary orientation, like `set view 56,103`,
7065 the four corners of the x-y plane can be referred to as "front", "back",
7066 "left" and "right". A similar set of four corners exist for the top surface,
7067 of course. Thus the border connecting, say, the back and right corners of the
7068 x-y plane is the "bottom right back" border, and the border connecting the top
7069 and bottom front corners is the "front vertical". (This nomenclature is
7070 defined solely to allow the reader to figure out the table that follows.)
7072 The borders are encoded in a 12-bit integer: the bottom four bits control the
7073 border for `plot` and the sides of the base for `splot`; the next four bits
7074 control the verticals in `splot`; the top four bits control the edges on top
7075 of the `splot`. In detail, `<integer>` should be the sum of the appropriate
7076 entries from the following table:
7081 1 bottom bottom left front
7082 2 left bottom left back
7083 4 top bottom right front
7084 8 right bottom right back
7085 16 no effect left vertical
7086 32 no effect back vertical
7087 64 no effect right vertical
7088 128 no effect front vertical
7089 256 no effect top left back
7090 512 no effect top right back
7091 1024 no effect top left front
7092 2048 no effect top right front
7097 Various bits or combinations of bits may be added together in the command.
7099 The default is 31, which is all four sides for `plot`, and base and z axis
7102 In 2D plots the border is normally drawn on top of all plots elements
7103 (`front`). If you want the border to be drawn behind the plot elements,
7104 use `set border back`.
7106 Using the optional <line_style>, <line_type> and <line_width> specifiers, the
7107 way the border lines are drawn can be influenced (limited by what the current
7108 terminal driver supports).
7110 For `plot`, tics may be drawn on edges other than bottom and left by enabling
7111 the second axes -- see `set xtics` for details.
7113 If a `splot` draws only on the base, as is the case with "`unset surface; set
7114 contour base`", then the verticals and the top are not drawn even if they are
7117 The `set grid` options 'back', 'front' and 'layerdefault' also
7118 control the order in which the border lines are drawn with respect to
7119 the output of the plotted data.
7123 Draw default borders:
7129 Draw only the left and bottom (`plot`) or both front and back bottom left
7136 Draw a complete box around a `splot`:
7142 Draw a topless box around a `splot`, omitting the front vertical:
7144 set border 127+256+512 # or set border 1023-128
7148 Draw only the top and right borders for a `plot` and label them as axes:
7150 unset xtics; unset ytics; set x2tics; set y2tics; set border 12
7155 @node boxwidth, clabel, border, set-show
7156 @subsection boxwidth
7158 @c ?commands set boxwidth
7159 @c ?commands show boxwidth
7166 The @ref{boxwidth} command is used to set the default width of boxes in the
7167 `boxes`, `boxerrorbars`, `candlesticks` and `histograms` styles.
7171 set boxwidth @{<width>@} @{absolute|relative@}
7176 By default, adjacent boxes are extended in width until they touch each other.
7177 A different default width may be specified using the @ref{boxwidth} command.
7178 `Relative` widths are interpreted as being a fraction of this default width.
7180 An explicit value for the boxwidth is interpreted as being a number of units
7181 along the current x axis (`absolute`) unless the modifier `relative` is given.
7182 If the x axis is a log-scale (see `set log`) then the value of boxwidth is
7183 truly "absolute" only at x=1; this physical width is maintained everywhere
7184 along the axis (i.e. the boxes do not become narrower the value of x
7185 increases). If the range spanned by a log scale x axis is far from x=1,
7186 some experimentation may be required to find a useful value of boxwidth.
7188 The default is superseded by explicit width information taken from an extra
7189 data column in styles `boxes` or `boxerrorbars`. In a four-column data set,
7190 the fourth column will be interpreted as the box width unless the width is set
7191 to -2.0, in which case the width will be calculated automatically.
7192 See `style boxes` and `style boxerrorbars` for more details.
7194 To set the box width to automatic use the command
7200 or, for four-column data,
7206 The same effect can be achieved with the @ref{using} keyword in `plot`:
7208 plot 'file' using 1:2:3:4:(-2)
7212 To set the box width to half of the automatic size use
7214 set boxwidth 0.5 relative
7218 To set the box width to an absolute value of 2 use
7220 set boxwidth 2 absolute
7224 @node clabel, clip, boxwidth, set-show
7227 @c ?commands set clabel
7228 @c ?commands unset clabel
7229 @c ?commands show clabel
7237 `gnuplot` will vary the linetype used for each contour level when clabel is
7238 set. When this option on (the default), a legend labels each linestyle with
7239 the z level it represents. It is not possible at present to separate the
7240 contour labels from the surface key.
7244 set clabel @{'<format>'@}
7250 The default for the format string is %8.3g, which gives three decimal places.
7251 This may produce poor label alignment if the key is altered from its default
7254 The first contour linetype, or only contour linetype when clabel is off, is
7255 the surface linetype +1; contour points are the same style as surface points.
7257 See also @ref{contour}.
7259 @node clip, cntrparam, clabel, set-show
7262 @c ?commands set clip
7263 @c ?commands unset clip
7264 @c ?commands show clip
7274 `gnuplot` can clip data points and lines that are near the boundaries of a
7279 set clip <clip-type>
7280 unset clip <clip-type>
7285 Three clip types for points and lines are supported by `gnuplot`: `points`,
7286 `one`, and `two`. One, two, or all three clip types may be active for a
7288 Note that clipping of color filled quadrangles drawn by @ref{pm3d} maps and
7289 surfaces is not controlled by this command, but by `set pm3d clip1in` and
7292 The `points` clip type forces `gnuplot` to clip (actually, not plot at all)
7293 data points that fall within but too close to the boundaries. This is done
7294 so that large symbols used for points will not extend outside the boundary
7295 lines. Without clipping points near the boundaries, the plot may look bad.
7296 Adjusting the x and y ranges may give similar results.
7298 Setting the `one` clip type causes `gnuplot` to draw a line segment which has
7299 only one of its two endpoints within the graph. Only the in-range portion of
7300 the line is drawn. The alternative is to not draw any portion of the line
7303 Some lines may have both endpoints out of range, but pass through the graph.
7304 Setting the `two` clip-type allows the visible portion of these lines to be
7307 In no case is a line drawn outside the graph.
7309 The defaults are `noclip points`, `clip one`, and `noclip two`.
7311 To check the state of all forms of clipping, use
7317 For backward compatibility with older versions, the following forms are also
7325 @ref{clip} is synonymous with `set clip points`; @ref{clip} turns off all
7326 three types of clipping.
7328 @node cntrparam, color_box, clip, set-show
7329 @subsection cntrparam
7331 @c ?commands set cntrparam
7332 @c ?commands show cntrparam
7339 @ref{cntrparam} controls the generation of contours and their smoothness for
7340 a contour plot. @ref{contour} displays current settings of @ref{cntrparam} as
7341 well as @ref{contour}.
7345 set cntrparam @{ @{ linear
7350 | levels @{ auto @{<n>@} | <n>
7351 | discrete <z1> @{,<z2>@{,<z3>...@}@}
7352 | incremental <start>, <incr> @{,<end>@}
7360 This command has two functions. First, it sets the values of z for which
7361 contour points are to be determined (by linear interpolation between data
7362 points or function isosamples.) Second, it controls the way contours are
7363 drawn between the points determined to be of equal z. <n> should be an
7364 integral constant expression and <z1>, <z2> ... any constant expressions.
7367 `linear`, `cubicspline`, `bspline`---Controls type of approximation or
7368 interpolation. If `linear`, then straight line segments connect points of
7369 equal z magnitude. If `cubicspline`, then piecewise-linear contours are
7370 interpolated between the same equal z points to form somewhat smoother
7371 contours, but which may undulate. If `bspline`, a guaranteed-smoother curve
7372 is drawn, which only approximates the position of the points of equal-z.
7374 `points`---Eventually all drawings are done with piecewise-linear strokes.
7375 This number controls the number of line segments used to approximate the
7376 `bspline` or `cubicspline` curve. Number of cubicspline or bspline
7377 segments (strokes) = `points` * number of linear segments.
7379 `order`---Order of the bspline approximation to be used. The bigger this
7380 order is, the smoother the resulting contour. (Of course, higher order
7381 bspline curves will move further away from the original piecewise linear
7382 data.) This option is relevant for `bspline` mode only. Allowed values are
7383 integers in the range from 2 (linear) to 10.
7385 `levels`--- Selection of contour levels, controlled by `auto` (default),
7386 `discrete`, `incremental`, and <n>, number of contour levels.
7388 For `auto`, <n> specifies a nominal number of levels; the actual number will
7389 be adjusted to give simple labels. If the surface is bounded by zmin and zmax,
7390 contours will be generated at integer multiples of dz between zmin and zmax,
7391 where dz is 1, 2, or 5 times some power of ten (like the step between two
7394 For `levels discrete`, contours will be generated at z = <z1>, <z2> ... as
7395 specified; the number of discrete levels sets the number of contour levels.
7396 In `discrete` mode, any `set cntrparam levels <n>` are ignored.
7398 For `incremental`, contours are generated at values of z beginning at <start>
7399 and increasing by <increment>, until the number of contours is reached. <end>
7400 is used to determine the number of contour levels, which will be changed by
7401 any subsequent `set cntrparam levels <n>`. If the z axis is logarithmic,
7402 <increment> will be interpreted as a factor, just like in @ref{ztics}.
7404 If the command @ref{cntrparam} is given without any arguments specified, the
7405 defaults are used: linear, 5 points, order 4, 5 auto levels.
7409 set cntrparam bspline
7410 set cntrparam points 7
7411 set cntrparam order 10
7415 To select levels automatically, 5 if the level increment criteria are met:
7417 set cntrparam levels auto 5
7421 To specify discrete levels at .1, .37, and .9:
7423 set cntrparam levels discrete .1,1/exp(1),.9
7427 To specify levels from 0 to 4 with increment 1:
7429 set cntrparam levels incremental 0,1,4
7433 To set the number of levels to 10 (changing an incremental end or possibly
7434 the number of auto levels):
7436 set cntrparam levels 10
7440 To set the start and increment while retaining the number of levels:
7442 set cntrparam levels incremental 100,50
7446 See also @ref{contour} for control of where the contours are drawn, and
7447 @ref{clabel} for control of the format of the contour labels and linetypes.
7450 @uref{http://www.gnuplot.info/demo/contours.html,contours demo (contours.dem)
7453 @uref{http://www.gnuplot.info/demo/discrete.html,contours with user defined levels demo (discrete.dem).
7456 @node color_box, contour, cntrparam, set-show
7457 @subsection color box
7459 @c ?commands set colorbox
7460 @c ?commands show colorbox
7461 @c ?commands unset colorbox
7468 The color scheme, i.e. the gradient of the smooth color with min_z and
7469 max_z values of @ref{pm3d}'s @ref{palette}, is drawn in a color box unless `unset
7475 @{ vertical | horizontal @}
7476 @{ default | user @}
7480 @{ noborder | bdefault | border [line style] @}
7487 Color box position can be `default` or `user`. If the latter is specified the
7488 values as given with the @ref{origin} and @ref{size} subcommands are used. The box
7489 can be drawn after (`front`) or before (`back`) the graph or the surface.
7491 The orientation of the color gradient can be switched by options `vertical`
7494 `origin x, y` and `size x, y` are used only in combination with the `user`
7495 option. The x and y values are interpreted as screen coordinates by default,
7496 and this is the only legal option for 3D plots. 2D plots, including splot with
7497 `set view map`, allow any coordinate system to be specified. Try for example:
7499 set colorbox horiz user origin .1,.02 size .8,.04
7502 which will draw a horizontal gradient somewhere at the bottom of the graph.
7504 @ref{border} turns the border on (this is the default). `noborder` turns the border
7505 off. If an positive integer argument is given after @ref{border}, it is used as a
7506 line style tag which is used for drawing the border, e.g.:
7508 set style line 2604 linetype -1 linewidth .4
7509 set colorbox border 2604
7512 will use line style `2604`, a thin line with the default border color (-1)
7513 for drawing the border. `bdefault` (which is the default) will use the default
7514 border line style for drawing the border of the color box.
7516 The axis of the color box is called `cb` and it is controlled by means of the
7517 usual axes commands, i.e. `set/unset/show` with @ref{cbrange}, `[m]cbtics`,
7518 `format cb`, `grid [m]cb`, @ref{cblabel}, and perhaps even @ref{cbdata}, `[no]cbdtics`,
7521 `set colorbox` without any parameter switches the position to default.
7522 `unset colorbox` resets the default parameters for the colorbox and switches
7525 See also help for @ref{pm3d}, @ref{palette}, @ref{pm3d}, and `set style line`.
7528 @node contour, data_style, color_box, set-show
7531 @c ?commands set contour
7532 @c ?commands unset contour
7533 @c ?commands show contour
7543 @ref{contour} enables contour drawing for surfaces. This option is available
7544 for `splot` only. It requires grid data, see `grid_data` for more details.
7545 If contours are desired from non-grid data, @ref{dgrid3d} can be used to
7546 create an appropriate grid.
7550 set contour @{base | surface | both@}
7556 The three options specify where to draw the contours: `base` draws the
7557 contours on the grid base where the x/ytics are placed, @ref{surface} draws the
7558 contours on the surfaces themselves, and `both` draws the contours on both
7559 the base and the surface. If no option is provided, the default is `base`.
7561 See also @ref{cntrparam} for the parameters that affect the drawing of
7562 contours, and @ref{clabel} for control of labelling of the contours.
7564 The surface can be switched off (see @ref{surface}), giving a contour-only
7565 graph. Though it is possible to use @ref{size} to enlarge the plot to fill
7566 the screen, more control over the output format can be obtained by writing
7567 the contour information to a file, and rereading it as a 2-d datafile plot:
7573 set table 'filename'
7576 # contour info now in filename
7582 In order to draw contours, the data should be organized as "grid data". In
7583 such a file all the points for a single y-isoline are listed, then all the
7584 points for the next y-isoline, and so on. A single blank line (a line
7585 containing no characters other than blank spaces and a carriage return and/or
7586 a line feed) separates one y-isoline from the next.
7587 See also @ref{datafile}.
7590 @uref{http://www.gnuplot.info/demo/contours.html,contours demo (contours.dem)
7593 @uref{http://www.gnuplot.info/demo/discrete.html,contours with user defined levels demo (discrete.dem).
7596 @node data_style, datafile, contour, set-show
7597 @subsection data style
7599 @c ?DUMMYLABEL set style data
7600 This form of the command is deprecated. Please see `set style data`.
7602 @node datafile, decimalsign, data_style, set-show
7603 @subsection datafile
7607 The @ref{datafile} command options control interpretation of fields read from
7608 input data files by the `plot`, `splot`, and @ref{fit} commands. Four such
7609 options are currently implemented.
7612 * set_datafile_fortran::
7613 * set_datafile_missing::
7614 * set_datafile_separator::
7615 * set_datafile_commentschars::
7616 * set_datafile_binary::
7619 @node set_datafile_fortran, set_datafile_missing, datafile, datafile
7620 @subsubsection set datafile fortran
7622 @c ?set datafile fortran
7625 The `set datafile fortran` command enables a special check for values in the
7626 input file expressed as Fortran D or Q constants. This extra check slows down
7627 the input process, and should only be selected if you do in fact have datafiles
7628 containing Fortran D or Q constants. The option can be disabled again using
7629 `unset datafile fortran`.
7631 @node set_datafile_missing, set_datafile_separator, set_datafile_fortran, datafile
7632 @subsubsection set datafile missing
7634 @c ?set datafile missing
7638 The `set datafile missing` command allows you to tell `gnuplot` what character
7639 string is used in a data file to denote missing data. Exactly how this missing
7640 value will be treated depends on the @ref{using} specifier of the `plot` or `splot`
7645 set datafile missing @{"<string>"@}
7646 show datafile missing
7653 # Ignore entries containing IEEE NaN ("Not a Number") code
7654 set datafile missing "NaN"
7660 set datafile missing "?"
7661 set style data lines
7676 plot '-' using 1:($2)
7686 The first `plot` will recognize only the first datum in the "3 ?" line. It
7687 will use the single-datum-on-a-line convention that the line number is "x"
7688 and the datum is "y", so the point will be plotted (in this case erroneously)
7691 The second `plot` will correctly ignore the middle line. The plotted line
7692 will connect the points at (2,20) and (4,40).
7694 The third `plot` will also correctly ignore the middle line, but the plotted
7695 line will not connect the points at (2,20) and (4,40).
7697 There is no default character for `missing`, but in many cases any
7698 non-parsible string of characters found where a numerical value is expected
7699 will be treated as missing data.
7702 @node set_datafile_separator, set_datafile_commentschars, set_datafile_missing, datafile
7703 @subsubsection set datafile separator
7705 @c ?set datafile separator
7706 @c ?show datafile separator
7707 @c ?datafile separator
7710 The command `set datafile separator "<char>"` tells `gnuplot` that data fields
7711 in subsequent input files are separated by <char> rather than by whitespace.
7712 The most common use is to read in csv (comma-separated value) files written
7713 by spreadsheet or database programs. By default data fields are separated by
7718 set datafile separator @{"<char>" | whitespace@}
7724 # Input file contains tab-separated fields
7725 set datafile separator "\t"
7730 # Input file contains comma-separated values fields
7731 set datafile separator ","
7735 @node set_datafile_commentschars, set_datafile_binary, set_datafile_separator, datafile
7736 @subsubsection set datafile commentschars
7738 @c ?set datafile commentschars
7739 @cindex commentschars
7741 The `set datafile commentschars` command allows you to tell `gnuplot` what
7742 characters are used in a data file to denote comments. Gnuplot will ignore
7743 rest of the line behind the specified characters if either of them is the
7744 first non-blank character on the line.
7748 set datafile commentschars @{"<string>"@}
7749 show datafile commentschars
7754 Default value of the string is "#!" on VMS and "#" otherwise.
7756 Then, the following line in a data file is completely ignored
7766 produces rather unexpected plot unless
7768 set datafile missing '#'
7771 is specified as well.
7775 set datafile commentschars "#!%"
7779 @node set_datafile_binary, , set_datafile_commentschars, datafile
7780 @subsubsection set datafile binary
7782 @c ?set datafile binary
7783 The `set datafile binary` command is used to set the defaults when reading
7784 binary data files. The syntax matches precisely that used for commands
7785 `plot` and `splot`. See `binary` for details about <binary list>.
7789 set datafile binary <binary list>
7790 show datafile binary
7798 set datafile binary filetype=auto
7799 set datafile binary array=512x512 format="%uchar"
7803 @node decimalsign, dgrid3d, datafile, set-show
7804 @subsection decimalsign
7806 @c ?commands set decimalsign
7807 @c ?commands show decimalsign
7808 @c ?commands unset decimalsign
7810 @c ?show decimalsign
7811 @c ?unset decimalsign
7813 @opindex decimalsign
7820 The @ref{decimalsign} command selects a decimal sign for numbers printed
7821 into tic labels or @ref{label} strings.
7825 set decimalsign @{<value> | locale @{"<locale>"@}@}
7831 The argument <value> is a string to be used in place of the usual
7832 decimal point. Typical choices include the period, '.', and the comma,
7833 ',', but others may be useful, too. If you omit the <value> argument,
7834 the decimal separator is not modified from the usual default, which is
7835 a period. Unsetting decimalsign has the same effect as omitting <value>.
7839 Correct typesetting in most European countries requires:
7845 Please note: If you set an explicit string, this affects only numbers that
7846 are printed using gnuplot's gprintf() formatting routine, include axis tics.
7847 It does not affect the format expected for input data, and it does not affect
7848 numbers printed with the sprintf() formatting routine. To change the behavior
7849 of both input and output formatting, instead use the form
7852 set decimalsign locale
7856 This instructs the program to use both input and output formats in accordance
7857 with the current setting of the LC_ALL, LC_NUMERIC, or LANG environmental
7861 set decimalsign locale "foo"
7865 This instructs the program to format all input and output in accordance with
7866 locale "foo", which must be installed. If locale "foo" is not found then an
7867 error message is printed and the decimal sign setting is unchanged.
7868 On linux systems you can get a list of the locales installed on your machine by
7869 typing "locale -a". A typical linux locale string is of the form "sl_SI.UTF-8".
7870 A typical Windows locale string is of the form "Slovenian_Slovenia.1250" or
7871 "slovenian". Please note that interpretation of the locale settings is done by
7872 the C library at runtime. Older C libraries may offer only partial support for
7873 locale settings such as the thousands grouping separator character.
7876 set decimalsign locale; set decimalsign "."
7880 This sets all input and output to use whatever decimal sign is correct for
7881 the current locale, but over-rides this with an explicit '.' in numbers
7882 formatted using gnuplot's internal gprintf() function.
7884 @node dgrid3d, dummy, decimalsign, set-show
7887 @c ?commands set dgrid3d
7888 @c ?commands unset dgrid3d
7889 @c ?commands show dgrid3d
7899 The @ref{dgrid3d} command enables, and can set parameters for, non-grid to
7900 grid data mapping. See `splot grid_data` for more details about the grid data
7905 set dgrid3d @{<row_size>@} @{,@{<col_size>@} @{,<norm>@}@}
7911 By default @ref{dgrid3d} is disabled. When enabled, 3-d data read from a file
7912 are always treated as a scattered data set. A grid with dimensions derived
7913 from a bounding box of the scattered data and size as specified by the
7914 row/col_size parameters is created for plotting and contouring. The grid
7915 is equally spaced in x (rows) and in y (columns); the z values are computed
7916 as weighted averages of the scattered points' z values.
7918 The third parameter, norm, controls the weighting: Each data point is
7919 weighted inversely by its distance from the grid point raised to the norm
7920 power. (Actually, the weights are given by the inverse of dx^norm + dy^norm,
7921 where dx and dy are the components of the separation of the grid point from
7922 each data point. For some norms that are powers of two, specifically 4, 8,
7923 and 16, the computation is optimized by using the Euclidean distance in the
7924 weight calculation, (dx^2+dy^2)^norm/2. However, any non-negative integer
7927 The closer the data point is to a grid point, the more effect it has on
7928 that grid point and the larger the value of norm the less effect more
7929 distant data points have on that grid point.
7931 The @ref{dgrid3d} option is a simple low pass filter that converts scattered
7932 data to a grid data set. More sophisticated approaches to this problem
7933 exist and should be used to preprocess the data outside `gnuplot` if this
7934 simple solution is found inadequate.
7936 (The z values are found by weighting all data points, not by interpolating
7937 between nearby data points; also edge effects may produce unexpected and/or
7938 undesired results. In some cases, small norm values produce a grid point
7939 reflecting the average of distant data points rather than a local average,
7940 while large values of norm may produce "steps" with several grid points
7941 having the same value as the closest data point, rather than making a smooth
7942 transition between adjacent data points. Some areas of a grid may be filled
7943 by extrapolation, to an arbitrary boundary condition. The variables are
7944 not normalized; consequently the units used for x and y will affect the
7945 relative weights of points in the x and y directions.)
7949 set dgrid3d 10,10,1 # defaults
7954 The first specifies that a grid of size 10 by 10 is to be constructed using
7955 a norm value of 1 in the weight computation. The second only modifies the
7956 norm, changing it to 4.
7958 @uref{http://www.gnuplot.info/demo/scatter.html,scatter.dem: dgrid3d demo.
7962 @node dummy, encoding, dgrid3d, set-show
7965 @c ?commands set dummy
7966 @c ?commands show dummy
7973 The @ref{dummy} command changes the default dummy variable names.
7977 set dummy @{<dummy-var>@} @{,<dummy-var>@}
7982 By default, `gnuplot` assumes that the independent, or "dummy", variable for
7983 the `plot` command is "t" if in parametric or polar mode, or "x" otherwise.
7984 Similarly the independent variables for the `splot` command are "u" and "v"
7985 in parametric mode (`splot` cannot be used in polar mode), or "x" and "y"
7988 It may be more convenient to call a dummy variable by a more physically
7989 meaningful or conventional name. For example, when plotting time functions:
7997 At least one dummy variable must be set on the command; @ref{dummy} by itself
7998 will generate an error message.
8007 The second example sets the second variable to s.
8009 @node encoding, fit_, dummy, set-show
8010 @subsection encoding
8012 @c ?commands set encoding
8013 @c ?commands show encoding
8022 The @ref{encoding} command selects a character encoding.
8025 set encoding @{<value>@}
8032 default - tells a terminal to use its default encoding
8033 iso_8859_1 - the most common Western European font used by many
8034 Unix workstations and by MS-Windows. This encoding is
8035 known in the PostScript world as 'ISO-Latin1'.
8036 iso_8859_2 - used in Central and Eastern Europe
8037 iso_8859_15 - a variant of iso_8859_1 that includes the Euro symbol
8038 koi8r - popular Unix cyrillic encoding
8039 koi8u - ukrainian Unix cyrillic encoding
8040 cp437 - codepage for MS-DOS
8041 cp850 - codepage for OS/2, Western Europe
8042 cp852 - codepage for OS/2, Central and Eastern Europe
8043 cp1250 - codepage for MS Windows, Central and Eastern Europe
8047 Generally you must set the encoding before setting the terminal type.
8048 Note that encoding is not supported by all terminal drivers and that
8049 the device must be able to produce the desired non-standard characters.
8050 The PostScript, X11 and wxt terminals support all encodings. OS/2 Presentation
8051 Manager switches automatically to codepage 912 for `iso_8859_2`.
8053 @node fit_, fontpath, encoding, set-show
8056 @c ?commands set fit
8057 @c ?commands show fit
8060 The @ref{fit} setting defines where the @ref{fit} command writes its output.
8061 If this option was built into your version of gnuplot, it also controls
8062 whether parameter errors from the fit will be written into variables.
8066 set fit @{logfile @{"<filename>"@}@} @{@{no@}errorvariables@}
8072 The <filename> argument must be enclosed in single or double quotes.
8074 If no filename is given or @ref{fit} is used the log file is
8075 reset to its default value "fit.log" or the value of the environmental
8078 Users of DOS-like platforms should note that the \ character has
8079 special significance in double-quoted strings, so single-quotes
8080 should be used for filenames in different directories, or you have
8081 to write \\ for each \. Or you can just use forward slashes,
8082 even though this is DOS.
8084 If the given logfile name ends with a / or \, it is interpreted to be
8085 a directory name, and the actual filename will be "fit.log" in that
8088 If the `errorvariables` option is turned on, the error of each fitted
8089 parameter computed by @ref{fit} will be copied to a user-defined variable
8090 whose name is formed by appending "_err" to the name of the parameter
8091 itself. This is useful mainly to put the parameter and its error onto
8092 a plot of the data and the fitted function, for reference, as in:
8095 set fit errorvariables
8096 fit f(x) 'datafile' using 1:2 via a, b
8097 print "error of a is:", a_err
8098 set label 'a=%6.2f', a, '+/- %6.2f', a_err
8099 plot 'datafile' using 1:2, f(x)
8103 @node fontpath, format_, fit_, set-show
8104 @subsection fontpath
8106 @c ?commands set fontpath
8107 @c ?commands show fontpath
8114 The @ref{fontpath} setting defines additional locations for font files
8115 searched when including font files. Currently only the postscript terminal
8116 supports @ref{fontpath}. If a file cannot be found in the current directory,
8117 the directories in @ref{fontpath} are tried. Further documentation concerning
8118 the supported file formats is included in the @ref{postscript} section
8119 of the documentation.
8123 set fontpath @{"pathlist1" @{"pathlist2"...@}@}
8128 Path names may be entered as single directory names, or as a list of
8129 path names separated by a platform-specific path separator, eg. colon
8130 (':') on Unix, semicolon (';') on DOS/Windows/OS/2/Amiga platforms.
8131 The @ref{fontpath}, @ref{save} and `save set` commands replace the
8132 platform-specific separator with a space character (' ') for maximum
8133 portability. If a directory name ends with an exclamation mark ('!') also
8134 the subdirectories of this directory are searched for font files.
8136 If the environmental variable GNUPLOT_FONTPATH is set, its contents are
8137 appended to @ref{fontpath}. If it is not set, a system dependent default value
8138 is used. It is set by testing several directories for existence when using
8139 the fontpath the first time. Thus, the first call of @ref{fontpath},
8140 @ref{fontpath}, @ref{fontpath}, `plot`, or `splot` with embedded font
8141 files takes a little more time. If you want to save this time you may
8142 set the environmental variable GNUPLOT_FONTPATH since probing is switched
8143 off, then. You can find out which is the default fontpath by using
8146 However, @ref{fontpath} prints the contents of user defined fontpath and
8147 system fontpath separately. Also, the @ref{save} and `save set` commands save
8148 only the user specified parts of @ref{fontpath}, for portability reasons.
8150 Many other terminal drivers access TrueType fonts via the gd library.
8151 For these drivers the font search path is controlled by the environmental
8152 variable GDFONTPATH.
8154 @node format_, function_style, fontpath, set-show
8157 @c ?commands set format
8158 @c ?commands show format
8166 The format of the tic-mark labels can be set with the `set format` command
8167 or with the `set tics format` or individual `set @{axis@}tics format` commands.
8171 set format @{<axes>@} @{"<format-string>"@}
8172 set format @{<axes>@} @{'<format-string>'@}
8177 where <axes> is either `x`, `y`, `xy`, `x2`, `y2`, `z`, `cb` or
8178 nothing (which refers to all axes at once). The length of the string
8179 representing a tic mark (after formatting with 'printf') is restricted
8180 to 100 characters. If the format string is omitted, the format will
8181 be returned to the default "% g". For LaTeX users, the format "$%g$"
8182 is often desirable. If the empty string "" is used, no label will be
8183 plotted with each tic, though the tic mark will still be plotted. To
8184 eliminate all tic marks, use `unset xtics` or @ref{ytics}.
8186 Newline (\n) is accepted in the format string. Use double-quotes rather than
8187 single-quotes to enable such interpretation. See also `syntax`.
8189 The default format for both axes is "% g", but other formats such as "%.2f" or
8190 "%3.0em" are often desirable. Anything accepted by 'printf' when given a
8191 double precision number, and accepted by the terminal, will work. Some other
8192 options have been added. If the format string looks like a floating point
8193 format, then `gnuplot` tries to construct a reasonable format.
8195 Characters not preceded by "%" are printed verbatim. Thus you can include
8196 spaces and labels in your format string, such as "%g m", which will put " m"
8197 after each number. If you want "%" itself, double it: "%g %%".
8199 See also `set xtics` for more information about tic labels, and
8200 @ref{decimalsign} for how to use non-default decimal separators in numbers
8203 @uref{http://www.gnuplot.info/demo/electron.html,electron demo (electron.dem).
8208 * format_specifiers::
8209 * time/date_specifiers::
8212 @node gprintf_, format_specifiers, format_, format_
8213 @subsubsection gprintf
8219 The string function gprintf("format",x) uses gnuplot's own format specifiers,
8220 as do the gnuplot commands `set format`, @ref{timestamp}, and others. These
8221 format specifiers are not the same as those used by the standard C-language
8222 routine sprintf(). Gnuplot also provides an sprintf("format",x,...) routine
8223 if you prefer. For a list of gnuplot's format options, see `format specifiers`.
8225 @node format_specifiers, time/date_specifiers, gprintf_, format_
8226 @subsubsection format specifiers
8228 @c ?commands set format specifiers
8229 @c ?set format specifiers
8230 @c ?format specifiers
8231 @cindex format_specifiers
8233 The acceptable formats (if not in time/date mode) are:
8238 %f floating point notation
8239 %e or %E exponential notation; an "e" or "E" before the power
8240 %g or %G the shorter of %e (or %E) and %f
8243 %t mantissa to base 10
8244 %l mantissa to base of current logscale
8245 %s mantissa to base of current logscale; scientific power
8247 %L power to base of current logscale
8249 %c character replacement for scientific power
8255 A 'scientific' power is one such that the exponent is a multiple of three.
8256 Character replacement of scientific powers (`"%c"`) has been implemented
8257 for powers in the range -18 to +18. For numbers outside of this range the
8258 format reverts to exponential.
8260 Other acceptable modifiers (which come after the "%" but before the format
8261 specifier) are "-", which left-justifies the number; "+", which forces all
8262 numbers to be explicitly signed; " " (a space), which makes positive numbers
8263 have a space in front of them where negative numbers have "-";
8264 "#", which places a decimal point after
8265 floats that have only zeroes following the decimal point; a positive integer,
8266 which defines the field width; "0" (the digit, not the letter) immediately
8267 preceding the field width, which indicates that leading zeroes are to be used
8268 instead of leading blanks; and a decimal point followed by a non-negative
8269 integer, which defines the precision (the minimum number of digits of an
8270 integer, or the number of digits following the decimal point of a float).
8272 Some systems may not support all of these modifiers but may also support
8273 others; in case of doubt, check the appropriate documentation and
8278 set format y "%t"; set ytics (5,10) # "5.0" and "1.0"
8279 set format y "%s"; set ytics (500,1000) # "500" and "1.0"
8280 set format y "%+-12.3f"; set ytics(12345) # "+12345.000 "
8281 set format y "%.2t*10^%+03T"; set ytic(12345)# "1.23*10^+04"
8282 set format y "%s*10^@{%S@}"; set ytic(12345) # "12.345*10^@{3@}"
8283 set format y "%s %cg"; set ytic(12345) # "12.345 kg"
8284 set format y "%.0P pi"; set ytic(6.283185) # "2 pi"
8285 set format y "%.0f%%"; set ytic(50) # "50%"
8290 set log y 2; set format y '%l'; set ytics (1,2,3)
8291 #displays "1.0", "1.0" and "1.5" (since 3 is 1.5 * 2^1)
8295 There are some problem cases that arise when numbers like 9.999 are printed
8296 with a format that requires both rounding and a power.
8298 If the data type for the axis is time/date, the format string must contain
8299 valid codes for the 'strftime' function (outside of `gnuplot`, type "man
8300 strftime"). See @ref{timefmt} for a list of the allowed input format codes.
8302 @node time/date_specifiers, , format_specifiers, format_
8303 @subsubsection time/date specifiers
8305 @c ?commands set format date_specifiers
8306 @c ?commands set format time_specifiers
8307 @c ?set format date_specifiers
8308 @c ?set format time_specifiers
8309 @c ?set date_specifiers
8310 @c ?set time_specifiers
8311 @cindex date_specifiers
8313 @cindex time_specifiers
8315 In time/date mode, the acceptable formats are:
8320 %a abbreviated name of day of the week
8321 %A full name of day of the week
8322 %b or %h abbreviated name of the month
8323 %B full name of the month
8324 %d day of the month, 01--31
8325 %D shorthand for "%m/%d/%y" (only output)
8326 %F shorthand for "%Y-%m-%d" (only output)
8327 %k hour, 0--23 (one or two digits)
8328 %H hour, 00--23 (always two digits)
8329 %l hour, 1--12 (one or two digits)
8330 %I hour, 01--12 (always two digits)
8331 %j day of the year, 1--366
8335 %r shorthand for "%I:%M:%S %p" (only output)
8336 %R shorthand for "%H:%M" (only output)
8338 %T shorthand for "%H:%M:%S" (only output)
8339 %U week of the year (week starts on Sunday)
8340 %w day of the week, 0--6 (Sunday = 0)
8341 %W week of the year (week starts on Monday)
8348 Except for the non-numerical formats, these may be preceded by a "0" ("zero",
8349 not "oh") to pad the field length with leading zeroes, and a positive digit,
8350 to define the minimum field width (which will be overridden if the specified
8351 width is not large enough to contain the number). There is a 24-character
8352 limit to the length of the printed text; longer strings will be truncated.
8356 Suppose the text is "76/12/25 23:11:11". Then
8358 set format x # defaults to "12/25/76" \n "23:11"
8359 set format x "%A, %d %b %Y" # "Saturday, 25 Dec 1976"
8360 set format x "%r %D" # "11:11:11 pm 12/25/76"
8364 Suppose the text is "98/07/06 05:04:03". Then
8366 set format x "%1y/%2m/%3d %01H:%02M:%03S" # "98/ 7/ 6 5:04:003"
8370 @node function_style, functions, format_, set-show
8371 @subsection function style
8373 This form of the command is deprecated. Please see `set style function`.
8375 @node functions, grid, function_style, set-show
8376 @subsection functions
8378 @c ?commands show functions
8380 The @ref{functions} command lists all user-defined functions and their
8389 For information about the definition and usage of functions in `gnuplot`,
8390 please see `expressions`.
8392 @uref{http://www.gnuplot.info/demo/spline.html,splines as user defined functions (spline.dem)
8395 @uref{http://www.gnuplot.info/demo/airfoil.html,use of functions and complex variables for airfoils (airfoil.dem).
8398 @node grid, hidden3d, functions, set-show
8401 @c ?commands set grid
8402 @c ?commands unset grid
8403 @c ?commands show grid
8413 The `set grid` command allows grid lines to be drawn on the plot.
8417 set grid @{@{no@}@{m@}xtics@} @{@{no@}@{m@}ytics@} @{@{no@}@{m@}ztics@}
8418 @{@{no@}@{m@}x2tics@} @{@{no@}@{m@}y2tics@}
8419 @{@{no@}@{m@}cbtics@}
8420 @{polar @{<angle>@}@}
8421 @{layerdefault | front | back@}
8422 @{ @{linestyle <major_linestyle>@}
8423 | @{linetype | lt <major_linetype>@}
8424 @{linewidth | lw <major_linewidth>@}
8425 @{ , @{linestyle | ls <minor_linestyle>@}
8426 | @{linetype | lt <minor_linetype>@}
8427 @{linewidth | lw <minor_linewidth>@} @} @}
8433 The grid can be enabled and disabled for the major and/or minor tic
8434 marks on any axis, and the linetype and linewidth can be specified
8435 for major and minor grid lines, also via a predefined linestyle, as
8436 far as the active terminal driver supports this.
8438 Additionally, a polar grid can be selected for 2-d plots---circles are drawn
8439 to intersect the selected tics, and radial lines are drawn at definable
8440 intervals. (The interval is given in degrees or radians, depending on the
8441 @ref{angles} setting.) Note that a polar grid is no longer automatically
8442 generated in polar mode.
8444 The pertinent tics must be enabled before `set grid` can draw them; `gnuplot`
8445 will quietly ignore instructions to draw grid lines at non-existent tics, but
8446 they will appear if the tics are subsequently enabled.
8448 If no linetype is specified for the minor gridlines, the same linetype as the
8449 major gridlines is used. The default polar angle is 30 degrees.
8451 If `front` is given, the grid is drawn on top of the graphed data. If
8452 `back` is given, the grid is drawn underneath the graphed data. Using
8453 `front` will prevent the grid from being obscured by dense data. The
8454 default setup, `layerdefault`, is equivalent to `back` for 2d plots.
8455 In 3D plots the default is to split up the grid and the graph box into
8456 two layers: one behind, the other in front of the plotted data and
8457 functions. Since @ref{hidden3d} mode does its own sorting, it ignores
8458 all grid drawing order options and passes the grid lines through the
8459 hidden line removal machinery instead. These options actually affect
8460 not only the grid, but also the lines output by @ref{border} and the
8461 various ticmarks (see `set xtics`).
8463 Z grid lines are drawn on the bottom of the plot. This looks better if a
8464 partial box is drawn around the plot---see @ref{border}.
8466 @node hidden3d, historysize, grid, set-show
8467 @subsection hidden3d
8469 @c ?commands set hidden3d
8470 @c ?commands unset hidden3d
8471 @c ?commands show hidden3d
8481 The @ref{hidden3d} command enables hidden line removal for surface plotting
8482 (see `splot`). Some optional features of the underlying algorithm can also
8483 be controlled using this command.
8487 set hidden3d @{defaults@} |
8488 @{ @{@{offset <offset>@} | @{nooffset@}@}
8489 @{trianglepattern <bitpattern>@}
8490 @{@{undefined <level>@} | @{noundefined@}@}
8491 @{@{no@}altdiagonal@}
8492 @{@{no@}bentover@} @}
8498 In contrast to the usual display in gnuplot, hidden line removal actually
8499 treats the given function or data grids as real surfaces that can't be seen
8500 through, so parts behind the surface will be hidden by it. For this to be
8501 possible, the surface needs to have 'grid structure' (see @ref{datafile}
8502 about this), and it has to be drawn `with lines` or `with linespoints`.
8504 When @ref{hidden3d} is set, both the hidden portion of the surface and possibly
8505 its contours drawn on the base (see @ref{contour}) as well as the grid will
8506 be hidden. Each surface has its hidden parts removed with respect to itself
8507 and to other surfaces, if more than one surface is plotted. Contours drawn
8508 on the surface (@ref{surface}) don't work.
8510 Labels and arrows are always visible and are unaffected. The key box is
8511 never hidden by the surface. As of gnuplot version 4.2, @ref{hidden3d} also
8512 affects 3D plotting styles `with points`, `with labels`, and `with vectors`,
8513 even if no surface is present in the graph. Individual plots within the
8514 graph may be explicitly excluded from this processing by appending the extra
8515 option `nohidden3d` to the @ref{with} specifier.
8517 Hidden3d does not affect solid surfaces drawn using the pm3d mode. To
8518 achieve a similar effect for pm3d surfaces, use instead set @ref{depthorder}.
8520 Functions are evaluated at isoline intersections. The algorithm interpolates
8521 linearly between function points or data points when determining the visible
8522 line segments. This means that the appearance of a function may be different
8523 when plotted with @ref{hidden3d} than when plotted with `nohidden3d` because in
8524 the latter case functions are evaluated at each sample. Please see
8525 @ref{samples} and @ref{isosamples} for discussion of the difference.
8527 The algorithm used to remove the hidden parts of the surfaces has some
8528 additional features controllable by this command. Specifying `defaults` will
8529 set them all to their default settings, as detailed below. If `defaults` is
8530 not given, only explicitly specified options will be influenced: all others
8531 will keep their previous values, so you can turn on/off hidden line removal
8532 via `set @{no@}hidden3d`, without modifying the set of options you chose.
8534 The first option, `offset`, influences the linestyle used for lines on the
8535 'back' side. Normally, they are drawn in a linestyle one index number higher
8536 than the one used for the front, to make the two sides of the surface
8537 distinguishable. You can specify a different line style offset to add
8538 instead of the default 1, by `offset <offset>`. Option `nooffset` stands for
8539 `offset 0`, making the two sides of the surface use the same linestyle.
8541 Next comes the option `trianglepattern <bitpattern>`. <bitpattern> must be
8542 a number between 0 and 7, interpreted as a bit pattern. Each bit determines
8543 the visibility of one edge of the triangles each surface is split up into.
8544 Bit 0 is for the 'horizontal' edges of the grid, Bit 1 for the 'vertical'
8545 ones, and Bit 2 for the diagonals that split each cell of the original grid
8546 into two triangles. The default pattern is 3, making all horizontal and
8547 vertical lines visible, but not the diagonals. You may want to choose 7 to
8548 see those diagonals as well.
8550 The `undefined <level>` option lets you decide what the algorithm is to do
8551 with data points that are undefined (missing data, or undefined function
8552 values), or exceed the given x-, y- or z-ranges. Such points can either be
8553 plotted nevertheless, or taken out of the input data set. All surface
8554 elements touching a point that is taken out will be taken out as well, thus
8555 creating a hole in the surface. If <level> = 3, equivalent to option
8556 `noundefined`, no points will be thrown away at all. This may produce all
8557 kinds of problems elsewhere, so you should avoid this. <level> = 2 will
8558 throw away undefined points, but keep the out-of-range ones. <level> = 1,
8559 the default, will get rid of out-of-range points as well.
8561 By specifying `noaltdiagonal`, you can override the default handling of a
8562 special case can occur if `undefined` is active (i.e. <level> is not 3).
8563 Each cell of the grid-structured input surface will be divided in two
8564 triangles along one of its diagonals. Normally, all these diagonals have
8565 the same orientation relative to the grid. If exactly one of the four cell
8566 corners is excluded by the `undefined` handler, and this is on the usual
8567 diagonal, both triangles will be excluded. However if the default setting
8568 of `altdiagonal` is active, the other diagonal will be chosen for this cell
8569 instead, minimizing the size of the hole in the surface.
8571 The `bentover` option controls what happens to another special case, this
8572 time in conjunction with the `trianglepattern`. For rather crumply surfaces,
8573 it can happen that the two triangles a surface cell is divided into are seen
8574 from opposite sides (i.e. the original quadrangle is 'bent over'), as
8575 illustrated in the following ASCII art:
8579 original quadrangle: A--B displayed quadrangle: |\ |
8580 ("set view 0,0") | /| ("set view 75,75" perhaps) | \ |
8587 If the diagonal edges of the surface cells aren't generally made visible by
8588 bit 2 of the <bitpattern> there, the edge CB above wouldn't be drawn at all,
8589 normally, making the resulting display hard to understand. Therefore, the
8590 default option of `bentover` will turn it visible in this case. If you don't
8591 want that, you may choose `nobentover` instead.
8593 @uref{http://www.gnuplot.info/demo/hidden.html,hidden line removal demo (hidden.dem)
8596 @uref{http://www.gnuplot.info/demo/singulr.html,complex hidden line demo (singulr.dem).
8599 @node historysize, isosamples, hidden3d, set-show
8600 @subsection historysize
8602 @c ?commands set historysize
8604 @c ?unset historysize
8606 @opindex historysize
8609 @cindex nohistorysize
8611 Note: the command @ref{historysize} is only available when
8612 gnuplot has been configured with the GNU readline.
8616 set historysize <int>
8621 When leaving gnuplot, the value of historysize is used for
8622 truncating the history to at most that much lines. The default
8624 @ref{historysize} will disable history truncation and thus
8625 allow an infinite number of lines to be written to the history
8628 @node isosamples, key, historysize, set-show
8629 @subsection isosamples
8631 @c ?commands set isosamples
8632 @c ?commands show isosamples
8639 The isoline density (grid) for plotting functions as surfaces may be changed
8640 by the @ref{isosamples} command.
8644 set isosamples <iso_1> @{,<iso_2>@}
8649 Each function surface plot will have <iso_1> iso-u lines and <iso_2> iso-v
8650 lines. If you only specify <iso_1>, <iso_2> will be set to the same value
8651 as <iso_1>. By default, sampling is set to 10 isolines per u or v axis.
8652 A higher sampling rate will produce more accurate plots, but will take longer.
8653 These parameters have no effect on data file plotting.
8655 An isoline is a curve parameterized by one of the surface parameters while
8656 the other surface parameter is fixed. Isolines provide a simple means to
8657 display a surface. By fixing the u parameter of surface s(u,v), the iso-u
8658 lines of the form c(v) = s(u0,v) are produced, and by fixing the v parameter,
8659 the iso-v lines of the form c(u) = s(u,v0) are produced.
8661 When a function surface plot is being done without the removal of hidden
8662 lines, @ref{samples} controls the number of points sampled along each
8663 isoline; see @ref{samples} and @ref{hidden3d}. The contour algorithm
8664 assumes that a function sample occurs at each isoline intersection, so
8665 change in @ref{samples} as well as @ref{isosamples} may be desired when changing
8666 the resolution of a function surface/contour.
8668 @node key, label, isosamples, set-show
8671 @c ?commands set key
8672 @c ?commands unset key
8673 @c ?commands show key
8685 The @ref{key} command enables a key (or legend) describing plots on a plot.
8687 The contents of the key, i.e., the names given to each plotted data set and
8688 function and samples of the lines and/or symbols used to represent them, are
8689 determined by the @ref{title} and @ref{with} options of the @{`s`@}`plot` command.
8690 Please see @ref{title} and @ref{with} for more information.
8694 set key @{on|off@} @{default@}
8695 @{@{inside | outside@} | @{lmargin | rmargin | tmargin | bmargin@}
8696 | @{at <position>@}@}
8697 @{left | right | center@} @{top | bottom | center@}
8698 @{vertical | horizontal@} @{Left | Right@}
8699 @{@{no@}reverse@} @{@{no@}invert@}
8700 @{samplen <sample_length>@} @{spacing <vertical_spacing>@}
8701 @{width <width_increment>@}
8702 @{height <height_increment>@}
8703 @{@{no@}autotitle @{columnheader@}@}
8704 @{title "<text>"@} @{@{no@}enhanced@}
8705 @{@{no@}box @{ @{linestyle | ls <line_style>@}
8706 | @{linetype | lt <line_type>@}
8707 @{linewidth | lw <line_width>@}@}@}
8713 Plots may be drawn with no visible key by requesting `set key off` or
8716 Elements within the key are stacked according to `vertical` or `horizontal`.
8717 In the case of `vertical`, the key occupies as few columns as possible. That
8718 is, elements are aligned in a column until running out of vertical space at
8719 which point a new column is started. In the case of `horizontal`, the key
8720 occupies as few rows as possible.
8722 By default the key is placed in the upper right inside corner of the graph.
8723 The keywords `left`, `right`, `top`, `bottom`, `center`, `inside`, `outside`,
8724 @ref{lmargin}, @ref{rmargin}, @ref{tmargin}, @ref{bmargin} (, `above`, `over`, `below` and
8725 `under`) may be used to automatically place the key in other positions of the
8726 graph. Also an `at <position>` may be given to indicate precisely where the
8727 plot should be placed. In this case, the keywords `left`, `right`, `top`,
8728 `bottom` and `center` serve an analogous purpose for alignment.
8730 To understand positioning, the best concept is to think of a region, i.e.,
8731 inside/outside, or one of the margins. Along with the region, keywords
8732 `left/center/right` (l/c/r) and `top/center/bottom` (t/c/b) control where
8733 within the particular region the key should be placed.
8735 When in `inside` mode, the keywords `left` (l), `right` (r), `top` (t),
8736 `bottom` (b), and `center` (c) push the key out toward the plot boundary as
8755 When in `outside` mode, automatic placement is similar to the above
8756 illustration, but with respect to the view, rather than the graph boundary.
8757 That is, a border is moved inward to make room for the key outside of
8758 the plotting area, although this may interfere with other labels and may
8759 cause an error on some devices. The particular plot border that is moved
8760 depends upon the position described above and the stacking direction. For
8761 options centered in one of the dimensions, there is no ambiguity about which
8762 border to move. For the corners, when the stack direction is `vertical`, the
8763 left or right border is moved inward appropriately. When the stack direction
8764 is `horizontal`, the top or bottom border is moved inward appropriately.
8766 The margin syntax allows automatic placement of key regardless of stack
8767 direction. When one of the margins @ref{lmargin} (lm), @ref{rmargin} (rm),
8768 @ref{tmargin} (tm), and @ref{bmargin} (bm) is combined with a single, non-conflicting
8769 direction keyword, the following illustrated positions may contain the key:
8797 Keywords `above` and `over` are synonymous with @ref{tmargin}. For version
8798 compatibility, `above` or `over` without an additional l/c/r or stack direction
8799 keyword uses `center` and `horizontal`. Keywords `below` and `under` are
8800 synonymous with @ref{bmargin}. For compatibility, `below` or `under` without an
8801 additional l/c/r or stack direction keyword uses `center` and `horizontal`. A
8802 further compatibility issue is that `outside` appearing without an additional
8803 t/b/c or stack direction keyword uses `top`, `right` and `vertical` (i.e., the
8804 same as t/rm above).
8806 The <position> can be a simple x,y,z as in previous versions, but these can
8807 be preceded by one of five keywords (`first`, `second`, `graph`, `screen`,
8808 `character`) which selects the coordinate system in which the position of
8809 the first sample line is specified. See `coordinates` for more details.
8810 The effect of `left`, `right`, `top`, `bottom`, and `center` when <position>
8811 is given is to align the key as though it were text positioned using the
8812 label command, i.e., `left` means left align with key to the right of
8815 Justification of the labels within the key is controlled by `Left` or `Right`
8816 (default is `Right`). The text and sample can be reversed (`reverse`) and a
8817 box can be drawn around the key (`box @{...@}`) in a specified `linetype`
8818 and `linewidth`, or a user-defined `linestyle`. Note that not all
8819 terminal drivers support linewidth selection, though.
8821 By default the first plot label is at the top of the key and successive labels
8822 are entered below it. The `invert` option causes the first label to be placed
8823 at the bottom of the key, with successive labels entered above it. This option
8824 is useful to force the vertical ordering of labels in the key to match the
8825 order of box types in a stacked histogram.
8827 The length of the sample line can be controlled by `samplen`. The sample
8828 length is computed as the sum of the tic length and <sample_length> times the
8829 character width. `samplen` also affects the positions of point samples in
8830 the key since these are drawn at the midpoint of the sample line, even if
8831 the sample line itself is not drawn.
8833 The vertical spacing between lines is controlled by `spacing`. The spacing
8834 is set equal to the product of the pointsize, the vertical tic size, and
8835 <vertical_spacing>. The program will guarantee that the vertical spacing is
8836 no smaller than the character height.
8838 The <width_increment> is a number of character widths to be added to or
8839 subtracted from the length of the string. This is useful only when you are
8840 putting a box around the key and you are using control characters in the text.
8841 `gnuplot` simply counts the number of characters in the string when computing
8842 the box width; this allows you to correct it.
8844 The <height_increment> is a number of character heights to be added to or
8845 subtracted from the height of the key box. This is useful mainly when you are
8846 putting a box around the key, otherwise it can be used to adjust the vertical
8847 shift of automatically chosen key position by <height_increment>/2.
8849 All plotted curves of `plot`s and `splot`s are titled according to the
8850 default option `autotitles`. The automatic generation of titles can be
8851 suppressed by `noautotitles`; then only those titles explicitly defined
8852 by `(s)plot ... title ...` will be drawn.
8854 The `set key autotitle columnheader` option is available if gnuplot was built
8855 with --enable-datastrings. This command causes the first entry in each column
8856 of plotted data to be interpreted as a text string and used as a title for
8857 the corresponding plot. If the quantity being plotted is a function of data
8858 from several columns, gnuplot may be confused as to which column to draw the
8859 title from. In this case it is necessary to specify the column explicitly in
8860 the plot command, e.g. `plot "datafile" using (($2+$3)/$4) title 3 with lines`.
8862 A title can be put on the key (`title "<text>"`)---see also `syntax` for the
8863 distinction between text in single- or double-quotes. The key title uses the
8864 same justification as do the plot titles.
8866 An explicitly given title is typeset using enhanced text properties on
8867 terminals supporting this, see `enhanced text` for more details.
8868 This default behavior can be switched off by the `noenhanced` option.
8870 The defaults for @ref{key} are `on`, `right`, `top`, `vertical`, `Right`,
8871 `noreverse`, `noinvert`, `samplen 4`, `spacing 1.25`, `title ""`, and
8872 `nobox`. The default <linetype> is the same as that used for the plot
8873 borders. Entering `set key default` returns the key to its default
8876 The key is drawn as a sequence of lines, with one plot described on each
8877 line. On the right-hand side (or the left-hand side, if `reverse` is
8878 selected) of each line is a representation that attempts to mimic the way the
8879 curve is plotted. On the other side of each line is the text description
8880 (the line title), obtained from the `plot` command. The lines are vertically
8881 arranged so that an imaginary straight line divides the left- and right-hand
8882 sides of the key. It is the coordinates of the top of this line that are
8883 specified with the @ref{key} command. In a `plot`, only the x and y
8884 coordinates are used to specify the line position. For a `splot`, x, y and
8885 z are all used as a 3-d location mapped using the same mapping as the graph
8886 itself to form the required 2-d screen position of the imaginary line.
8888 When using the TeX or PostScript drivers, or similar drivers where formatting
8889 information is embedded in the string, `gnuplot` is unable to calculate
8890 correctly the width of the string for key positioning. If the key is to be
8891 positioned at the left, it may be convenient to use the combination `set key
8892 left Left reverse`. The box and gap in the grid will be the width of the
8895 If `splot` is being used to draw contours, the contour labels will be listed
8896 in the key. If the alignment of these labels is poor or a different number
8897 of decimal places is desired, the label format can be specified. See
8898 @ref{clabel} for details.
8902 This places the key at the default location:
8908 This disables the key:
8914 This places a key at coordinates 2,3.5,2 in the default (first) coordinate
8921 This places the key below the graph:
8927 This places the key in the bottom left corner, left-justifies the text,
8928 gives it a title, and draws a box around it in linetype 3:
8930 set key left bottom Left title 'Legend' box 3
8934 @node label, lmargin, key, set-show
8937 @c ?commands set label
8938 @c ?commands unset label
8939 @c ?commands show label
8949 Arbitrary labels can be placed on the plot using the @ref{label} command.
8953 set label @{<tag>@} @{"<label text>"@} @{at <position>@}
8954 @{left | center | right@}
8955 @{norotate | rotate @{by <degrees>@}@}
8956 @{font "<name>@{,<size>@}"@}
8959 @{textcolor <colorspec>@}
8960 @{point <pointstyle> | nopoint@}
8962 unset label @{<tag>@}
8967 The <position> is specified by either x,y or x,y,z, and may be preceded by
8968 `first`, `second`, `graph`, `screen`, or `character` to select the coordinate
8969 system. See `coordinates` for details.
8971 The tag is an integer that is used to identify the label. If no <tag>
8972 is given, the lowest unused tag value is assigned automatically. The
8973 tag can be used to delete or modify a specific label. To change any
8974 attribute of an existing label, use the @ref{label} command with the
8975 appropriate tag, and specify the parts of the label to be changed.
8977 The <label text> can be a string constant, a string variable, or a string-
8978 valued expression. See `strings`, @ref{sprintf}, and @ref{gprintf}.
8980 By default, the text is placed flush left against the point x,y,z. To adjust
8981 the way the label is positioned with respect to the point x,y,z, add the
8982 justification parameter, which may be `left`, `right` or `center`,
8983 indicating that the point is to be at the left, right or center of the text.
8984 Labels outside the plotted boundaries are permitted but may interfere with
8985 axis labels or other text.
8987 If `rotate` is given, the label is written vertically (if the terminal can do
8988 so, of course). If `rotate by <degrees>` is given, conforming terminals will
8989 try to write the text at the specified angle; non-conforming terminals will
8990 treat this as vertical text.
8992 Font and its size can be chosen explicitly by `font "<name>@{,<size>@}"` if the
8993 terminal supports font settings. Otherwise the default font of the terminal
8996 Normally the enhanced text mode string interpretation, if enabled for the
8997 current terminal, is applied to all text strings including label text.
8998 The `noenhanced` property can be used to exempt a specific label from the
8999 enhanced text mode processing. The can be useful if the label contains
9000 underscores, for example. See `enhanced text`.
9002 If `front` is given, the label is written on top of the graphed data. If
9003 `back` is given (the default), the label is written underneath the graphed
9004 data. Using `front` will prevent a label from being obscured by dense data.
9006 `textcolor <colorspec>` changes the color of the label text. <colorspec> can be
9007 a linetype, an rgb color, or a palette mapping. See help for @ref{colorspec} and
9008 @ref{palette}. `textcolor` may be abbreviated `tc`.
9010 `tc default` resets the text color to its default state.
9011 `tc lt <n>` sets the text color to that of line type <n>.
9012 `tc ls <n>` sets the text color to that of line style <n>.
9013 `tc palette z` selects a palette color corresponding to the label z position.
9014 `tc palette cb <val>` selects a color corresponding to <val> on the colorbar.
9015 `tc palette fraction <val>`, with 0<=val<=1, selects a color corresponding to
9016 the mapping [0:1] to grays/colors of the @ref{palette}.
9017 `tc rgb "#RRGGBB"` selects an arbitrary 24-bit RGB color.
9021 If a <pointstyle> is given, using keywords `lt`, `pt` and `ps`, see @ref{style},
9022 a point with the given style and color of the given line type is plotted at
9023 the label position and the text of the label is displaced slightly.
9024 This option is used by default for placing labels in `mouse` enhanced
9025 terminals. Use `nopoint` to turn off the drawing of a point near
9026 the label (this is the default).
9028 The displacement defaults to 1,1 in @ref{pointsize} units if a <pointstyle> is
9029 given, 0,0 if no <pointstyle> is given. The displacement can be controlled
9030 by the optional `offset <offset>` where <offset> is specified by either x,y
9031 or x,y,z, and may be preceded by `first`, `second`, `graph`, `screen`, or
9032 `character` to select the coordinate system. See `coordinates` for details.
9034 If one (or more) axis is timeseries, the appropriate coordinate should be
9035 given as a quoted time string according to the @ref{timefmt} format string.
9036 See @ref{xdata} and @ref{timefmt}.
9038 The EEPIC, Imagen, LaTeX, and TPIC drivers allow \\ in a string to specify
9043 To set a label at (1,2) to "y=x", use:
9045 set label "y=x" at 1,2
9049 To set a Sigma of size 24, from the Symbol font set, at the center of
9052 set label "S" at graph 0.5,0.5 center font "Symbol,24"
9056 To set a label "y=x^2" with the right of the text at (2,3,4), and tag the
9057 label as number 3, use:
9059 set label 3 "y=x^2" at 2,3,4 right
9063 To change the preceding label to center justification, use:
9069 To delete label number 2, use:
9075 To delete all labels, use:
9081 To show all labels (in tag order), use:
9087 To set a label on a graph with a timeseries on the x axis, use, for example:
9089 set timefmt "%d/%m/%y,%H:%M"
9090 set label "Harvest" at "25/8/93",1
9094 To display a freshly fitted parameter on the plot with the data and the
9095 fitted function, do this after the @ref{fit}, but before the `plot`:
9097 set label sprintf("a = %3.5g",par_a) at 30,15
9098 bfit = gprintf("b = %s*10^%S",par_b)
9099 set label bfit at 30,20
9103 To set a label displaced a little bit from a small point:
9105 set label 'origin' at 0,0 point lt 1 pt 2 ps 3 offset 1,-1
9109 To set a label whose color matches the z value (in this case 5.5) of some
9110 point on a 3D splot colored using pm3d:
9112 set label 'text' at 0,0,5.5 tc palette z
9117 @node lmargin, loadpath, label, set-show
9120 @c ?commands set lmargin
9126 The command @ref{lmargin} sets the size of the left margin.
9127 Please see @ref{margin} for details.
9129 @node loadpath, locale, lmargin, set-show
9130 @subsection loadpath
9132 @c ?commands set loadpath
9133 @c ?commands show loadpath
9140 The @ref{loadpath} setting defines additional locations for data and command
9141 files searched by the @ref{call}, `load`, `plot` and `splot` commands. If a
9142 file cannot be found in the current directory, the directories in
9143 @ref{loadpath} are tried.
9147 set loadpath @{"pathlist1" @{"pathlist2"...@}@}
9152 Path names may be entered as single directory names, or as a list of
9153 path names separated by a platform-specific path separator, eg. colon
9154 (':') on Unix, semicolon (';') on DOS/Windows/OS/2/Amiga platforms.
9155 The @ref{loadpath}, @ref{save} and `save set` commands replace the
9156 platform-specific separator with a space character (' ') for maximum
9159 If the environment variable GNUPLOT_LIB is set, its contents are
9160 appended to @ref{loadpath}. However, @ref{loadpath} prints the contents
9161 of user defined loadpath and system loadpath separately. Also, the
9162 @ref{save} and `save set` commands save only the user specified parts of
9163 @ref{loadpath}, for portability reasons.
9165 @node locale, logscale, loadpath, set-show
9168 @c ?commands set locale
9174 The @ref{locale} setting determines the language with which `@{x,y,z@}@{d,m@}tics`
9175 will write the days and months.
9179 set locale @{"<locale>"@}
9183 <locale> may be any language designation acceptable to your installation.
9184 See your system documentation for the available options. The default value
9185 is determined from the LC_TIME, LC_ALL, or LANG environment variables.
9187 To change the decimal point locale, see @ref{decimalsign}.
9189 @node logscale, macros, locale, set-show
9190 @subsection logscale
9192 @c ?commands set logscale
9193 @c ?commands unset logscale
9194 @c ?commands show logscale
9207 set logscale <axes> <base>
9208 unset logscale <axes>
9213 where <axes> may be any combination of `x`, `x2`, `y`, `y2`, `z`, and `cb` in
9214 any order, and where <base> is the base of the log scaling. If <base> is not
9215 given, then 10 is assumed. If <axes> is not given, then all axes are assumed.
9216 @ref{logscale} turns off log scaling for the specified axes.
9220 To enable log scaling in both x and z axes:
9226 To enable scaling log base 2 of the y axis:
9232 To enable z and color log axes for a pm3d plot:
9238 To disable z axis log scaling:
9244 @node macros, mapping, logscale, set-show
9247 @c ?commands set macros
9248 @c ?commands show macros
9251 If command line macro substitution is enabled, then tokens in the command line
9252 of the form @@<stringvariablename> will be replaced by the text string contained
9253 in <stringvariablename>. See `substitution`.
9262 @node mapping, margin, macros, set-show
9265 @c ?commands set mapping
9266 @c ?commands show mapping
9273 If data are provided to `splot` in spherical or cylindrical coordinates,
9274 the @ref{mapping} command should be used to instruct `gnuplot` how to
9279 set mapping @{cartesian | spherical | cylindrical@}
9283 A cartesian coordinate system is used by default.
9285 For a spherical coordinate system, the data occupy two or three columns
9286 (or @ref{using} entries). The first two are interpreted as the azimuthal
9287 and polar angles theta and phi (or "longitude" and "latitude"), in the
9288 units specified by @ref{angles}. The radius r is taken from the third
9289 column if there is one, or is set to unity if there is no third column.
9293 x = r * cos(theta) * cos(phi)
9294 y = r * sin(theta) * cos(phi)
9299 Note that this is a "geographic" spherical system, rather than a "polar"
9300 one (that is, phi is measured from the equator, rather than the pole).
9302 For a cylindrical coordinate system, the data again occupy two or three
9303 columns. The first two are interpreted as theta (in the units specified by
9304 @ref{angles}) and z. The radius is either taken from the third column or set
9305 to unity, as in the spherical case. The mapping is:
9314 The effects of @ref{mapping} can be duplicated with the @ref{using} filter on the
9315 `splot` command, but @ref{mapping} may be more convenient if many data files are
9316 to be processed. However even if @ref{mapping} is used, @ref{using} may still be
9317 necessary if the data in the file are not in the required order.
9319 @ref{mapping} has no effect on `plot`.
9321 @uref{http://www.gnuplot.info/demo/world.html,world.dem: mapping demos.
9324 @node margin, mouse, mapping, set-show
9327 @c ?commands set margin
9328 @c ?commands show margin
9335 The computed margins can be overridden by the @ref{margin} commands. @ref{margin} shows the current settings.
9339 set bmargin @{@{at screen@} <margin>@}
9340 set lmargin @{@{at screen@} <margin>@}
9341 set rmargin @{@{at screen@} <margin>@}
9342 set tmargin @{@{at screen@} <margin>@}
9347 The default units of <margin> are character heights or widths, as appropriate.
9348 A positive value defines the absolute size of the margin. A negative value
9349 (or none) causes `gnuplot` to revert to the computed value. For 3D plots,
9350 only the left margin can be set using character units.
9352 The keywords `at screen` indicates that the margin is specified as a fraction
9353 of the full drawing area. This can be used to precisely line up the corners of
9354 individual 2D and 3D graphs in a multiplot. This placement ignores the current
9355 values of @ref{origin} and @ref{size}, and is intended as an alternative
9356 method for positioning graphs within a multiplot.
9358 Normally the margins of a plot are automatically calculated based on tics,
9359 tic labels, axis labels, the plot title, the timestamp and the size of the
9360 key if it is outside the borders. If, however, tics are attached to the
9361 axes (`set xtics axis`, for example), neither the tics themselves nor their
9362 labels will be included in either the margin calculation or the calculation
9363 of the positions of other text to be written in the margin. This can lead
9364 to tic labels overwriting other text if the axis is very close to the border.
9366 @node mouse, multiplot, margin, set-show
9369 @c ?commands set mouse
9370 @c ?commands unset mouse
9379 The command `set mouse` enables mouse actions. Currently the pm, x11, ggi,
9380 windows and wxt terminals are mouse enhanced. There are two mouse modes. The
9381 2d-graph mode works for 2d graphs and for maps (i.e. splots with @ref{view}
9382 having z-rotation 0, 90, 180, 270 or 360 degrees, including `set view map`)
9383 and it allows tracing the position over graph, zooming, annotating graph etc.
9384 For 3d graphs `splot`, the view and scaling of the graph can be changed with
9385 mouse buttons 1 and 2. If additionally to these buttons the modifier <ctrl> is
9386 hold down, the coordinate system only is rotated which is useful for large
9387 data sets. A vertical motion of Button 2 with the shift key hold down changes
9388 the @ref{ticslevel}.
9390 Mousing is not available in multiplot mode. When multiplot is finished using
9391 @ref{multiplot}, then the mouse will be turned on again and acts on the
9392 last plot (like replot does).
9396 set mouse @{doubleclick <ms>@} @{nodoubleclick@} \
9397 @{@{no@}zoomcoordinates@} \
9398 @{noruler | ruler @{at x,y@}@} \
9399 @{polardistance@{deg|tan@} | nopolardistance@} \
9400 @{format <string>@} \
9401 @{clipboardformat <int>/<string>@} \
9402 @{mouseformat <int>/<string>@} \
9403 @{@{no@}labels@} @{labeloptions <string>@} \
9404 @{@{no@}zoomjump@} @{@{no@}verbose@}
9409 The doubleclick resolution is given in milliseconds and used for Button 1
9410 which copies the current mouse position to the `clipboard`. If you want that
9411 to be done by single clicking a value of 0 ms can be used. The default value
9414 The option `zoomcoordinates` determines if the coordinates of the zoom box are
9415 drawn at the edges while zooming. This is on by default.
9417 The options `noruler` and `ruler` switch the ruler off and on, the latter
9418 optionally at given `coordinates`. This corresponds to the default key binding
9421 The option `polardistance` determines if the distance between the mouse cursor
9422 and the ruler is also shown in polar coordinates (distance and angle in
9423 degrees or tangent (slope)). This corresponds to the default key binding '5'.
9425 The `format` option takes a fprintf like format string which determines how
9426 floating point numbers are printed to the drivers window and the clipboard.
9427 The default is "% #g".
9429 `clipboardformat` and `mouseformat` are used for formatting the text on
9430 Button1 and Button2 actions -- copying the coordinates to the clipboard and
9431 temporarily annotating the mouse position. This corresponds to the key
9432 bindings '1', '2', '3', '4' (see the drivers's help window). If the argument
9433 is a string this string is used as c format specifier and should contain two
9434 float specifiers, e.g. `set mouse mouseformat "mouse = %5.2g, %10.2f"`. Use
9435 `set mouse mouseformat ""` to turn this string off again.
9437 The following formats are available (format 6 may only be selected if the
9438 format string was specified already):
9441 0 real coordinates in brackets e.g. [1.23, 2.45]
9442 1 real coordinates w/o brackets e.g. 1.23, 2.45
9443 2 x == timefmt [(as set by @ref{timefmt}), 2.45]
9444 3 x == date [31. 12. 1999, 2.45]
9445 4 x == time [23:59, 2.45]
9446 5 x == date / time [31. 12. 1999 23:59, 2.45]
9447 6 alt. format, specified as string ""
9451 Choose the option `labels` to get real gnuplot labels on Button 2. (The
9452 default is `nolabels` which makes Button 2 drawing only temporary annotations
9453 at the mouse positions). The labels are drawn with the current setting of
9454 `mouseformat`. `labeloptions` controls which options are passed to the
9455 @ref{label} command. The default is "pointstyle 1" which will plot a small
9456 plus at the label position. Note that the pointsize is taken from the
9457 @ref{pointsize} command.
9458 Labels can be removed by holding the Ctrl-Key down while clicking with
9459 Button 2 on the label's point. The threshold for how close you must be to the
9460 label is also determined by the @ref{pointsize}.
9462 If the option `zoomjump` is on, the mouse pointer will be automatically
9463 offset a small distance after starting a zoom region with button 3. This can
9464 be useful to avoid a tiny (or even empty) zoom region. `zoomjump` is off by
9467 If the option `verbose` is turned on the communication commands are shown
9468 during execution. This option can also be toggled by hitting `6` in the
9469 driver's window. `verbose` is off by default.
9471 Press 'h' in the driver's window for a short summary of the mouse and key
9472 bindings. This will also display user defined bindings or `hotkeys` which
9473 can be defined using the @ref{bind} command, see help for @ref{bind}. Note, that user
9474 defined `hotkeys` may override the default bindings.
9476 Press 'q' in the driver's window to close the window. This key cannot be
9477 overridden with the @ref{bind} command.
9479 See also help for @ref{bind} and @ref{label}.
9485 @node X11_mouse, , mouse, mouse
9486 @subsubsection X11 mouse
9492 If multiple X11 plot windows have been opened using the `set term x11 <n>`
9493 terminal option, then only the current plot window supports the entire
9494 range of mouse commands and hotkeys. The other windows will, however,
9495 continue to display mouse coordinates at the lower left.
9497 For consistency with other screen terminals, X11 mouse support is turned on by
9498 default, wherever the standard input comes from. However, on some UNIX
9499 flavors, special input devices as /dev/null might not be `select-able`; using
9500 such devices with the mouse turned on will hang gnuplot. Please turn off
9501 mousing with `unset mouse` if you are in this situation.
9503 @node multiplot, mx2tics, mouse, set-show
9504 @subsection multiplot
9506 @c ?commands set multiplot
9507 @c ?commands unset multiplot
9516 The command @ref{multiplot} places `gnuplot` in the multiplot mode, in which
9517 several plots are placed on the same page, window, or screen.
9521 set multiplot @{ layout <rows>,<cols>
9522 @{rowsfirst|columnsfirst@} @{downwards|upwards@}
9523 @{title <page title>@}
9524 @{scale <xscale>@{,<yscale>@}@} @{offset <xoff>@{,<yoff>@}@}
9530 For some terminals, no plot is displayed until the command @ref{multiplot}
9531 is given, which causes the entire page to be drawn and then returns gnuplot
9532 to its normal single-plot mode. For other terminals, each separate `plot`
9533 command produces an updated display, either by redrawing all previous ones
9534 and the newly added plot, or by just adding the new plot to the existing
9537 The area to be used by the next plot is not erased before doing the
9538 new plot. The @ref{clear} command can be used to do this if wanted, as is
9539 typically the case for "inset" plots.
9541 Any labels or arrows that have been defined will be drawn for each plot
9542 according to the current size and origin (unless their coordinates are
9543 defined in the `screen` system). Just about everything else that can be
9544 `set` is applied to each plot, too. If you want something to appear only
9545 once on the page, for instance a single time stamp, you'll need to put a `set
9546 time`/`unset time` pair around one of the `plot`, `splot` or @ref{replot}
9547 commands within the @ref{multiplot}/@ref{multiplot} block.
9549 The multiplot title is separate from the individual plot titles, if any.
9550 Space is reserved for it at the top of the page, spanning the full width
9553 The commands @ref{origin} and @ref{size} must be used to correctly position
9554 each plot if no layout is specified or if fine tuning is desired. See
9555 @ref{origin} and @ref{size} for details of their usage.
9570 This displays a plot of cos(x) stacked above a plot of sin(x).
9572 @ref{size} and @ref{origin} refer to the entire plotting area used for each
9573 plot. Please also see @ref{size}. If you want to have the axes
9574 themselves line up, you can guarantee that the margins are the same size with
9575 the @ref{margin} commands. See @ref{margin} for their use. Note that the
9576 margin settings are absolute, in character units, so the appearance of the
9577 graph in the remaining space will depend on the screen size of the display
9578 device, e.g., perhaps quite different on a video display and a printer.
9580 With the `layout` option you can generate simple multiplots without having
9581 to give the @ref{size} and @ref{origin} commands before each plot: Those
9582 are generated automatically, but can be overridden at any time. With
9583 `layout` the display will be divided by a grid with <rows> rows and
9584 <cols> columns. This grid is filled rows first or columns first depending on
9585 whether the corresponding option is given in the multiplot command. The stack
9586 of plots can grow `downwards` or `upwards`.
9587 Default is `rowsfirst` and `downwards`.
9589 Each plot can be scaled by `scale` and shifted with `offset`; if the y-values
9590 for scale or offset are omitted, the x-value will be used. @ref{multiplot}
9591 will turn off the automatic layout and restore the values of @ref{size} and
9592 @ref{origin} as they were before `set multiplot layout`.
9598 set multiplot layout 3,2 columnsfirst scale 1.1,0.9
9599 [ up to 6 plot commands here ]
9604 The above example will produce 6 plots in 2 columns filled top to bottom,
9605 left to right. Each plot will have a horizontal size of 1.1/2 and a vertical
9609 @uref{http://gnuplot.sourceforge.net/demo/multiplt.html,multiplot demo (multiplt.dem)
9612 @node mx2tics, mxtics, multiplot, set-show
9615 @c ?commands set mx2tics
9616 @c ?commands unset mx2tics
9617 @c ?commands show mx2tics
9627 Minor tic marks along the x2 (top) axis are controlled by @ref{mx2tics}.
9628 Please see @ref{mxtics}.
9630 @node mxtics, my2tics, mx2tics, set-show
9633 @c ?commands set mxtics
9634 @c ?commands unset mxtics
9635 @c ?commands show mxtics
9645 Minor tic marks along the x axis are controlled by @ref{mxtics}. They can be
9646 turned off with @ref{mxtics}. Similar commands control minor tics along
9651 set mxtics @{<freq> | default@}
9657 The same syntax applies to @ref{mytics}, @ref{mztics}, @ref{mx2tics}, @ref{my2tics} and
9660 <freq> is the number of sub-intervals (NOT the number of minor tics) between
9661 major tics (the default for a linear axis is either two or five
9662 depending on the major tics, so there are one or four minor
9663 tics between major tics). Selecting `default` will return the number of minor
9664 ticks to its default value.
9666 If the axis is logarithmic, the number of sub-intervals will be set to a
9667 reasonable number by default (based upon the length of a decade). This will
9668 be overridden if <freq> is given. However the usual minor tics (2, 3, ...,
9669 8, 9 between 1 and 10, for example) are obtained by setting <freq> to 10,
9670 even though there are but nine sub-intervals.
9672 To set minor tics at arbitrary positions, use the ("<label>" <pos> <level>,
9673 ...) form of `set @{x|x2|y|y2|z@}tics` with <label> empty and <level> set to 1.
9675 The `set m@{x|x2|y|y2|z@}tics` commands work only when there are uniformly
9676 spaced major tics. If all major tics were placed explicitly by
9677 `set @{x|x2|y|y2|z@}tics`, then minor tic commands are ignored. Implicit
9678 major tics and explicit minor tics can be combined using
9679 `set @{x|x2|y|y2|z@}tics` and `set @{x|x2|y|y2|z@}tics add`.
9688 Major tics at 0,5,7.5,10, minor tics at 1,2,3,4,6,7,8,9
9692 set ytics 1e-6, 10, 1
9693 set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
9698 Major tics with special formatting, minor tics at log positions
9700 By default, minor tics are off for linear axes and on for logarithmic axes.
9701 They inherit the settings for `axis|border` and `@{no@}mirror` specified for
9702 the major tics. Please see `set xtics` for information about these.
9704 @node my2tics, mytics, mxtics, set-show
9707 @c ?commands set my2tics
9708 @c ?commands unset my2tics
9709 @c ?commands show my2tics
9719 Minor tic marks along the y2 (right-hand) axis are controlled by @ref{my2tics}. Please see @ref{mxtics}.
9721 @node mytics, mztics, my2tics, set-show
9724 @c ?commands set mytics
9725 @c ?commands unset mytics
9726 @c ?commands show mytics
9736 Minor tic marks along the y axis are controlled by @ref{mytics}. Please
9739 @node mztics, offsets, mytics, set-show
9742 @c ?commands set mztics
9743 @c ?commands unset mztics
9744 @c ?commands show mztics
9754 Minor tic marks along the z axis are controlled by @ref{mztics}. Please
9757 @node offsets, origin, mztics, set-show
9760 @c ?commands set offsets
9761 @c ?commands unset offsets
9762 @c ?commands show offsets
9772 Offsets provide a mechanism to put a boundary around the data inside of an
9777 set offsets <left>, <right>, <top>, <bottom>
9783 Each offset may be a constant or an expression. Each defaults to 0. Left
9784 and right offsets are given in units of the x axis, top and bottom offsets in
9785 units of the y axis. A positive offset expands the graph in the specified
9786 direction, e.g., a positive bottom offset makes ymin more negative. Negative
9787 offsets, while permitted, can have unexpected interactions with autoscaling
9790 Offsets are ignored in `splot`s.
9794 set offsets 0, 0, 2, 2
9799 This graph of sin(x) will have a y range [-3:3] because the function
9800 will be autoscaled to [-1:1] and the vertical offsets are each two.
9802 @node origin, output, offsets, set-show
9805 @c ?commands set origin
9806 @c ?commands show origin
9813 The @ref{origin} command is used to specify the origin of a plotting surface
9814 (i.e., the graph and its margins) on the screen. The coordinates are given
9815 in the `screen` coordinate system (see `coordinates` for information about
9820 set origin <x-origin>,<y-origin>
9824 @node output, parametric_, origin, set-show
9827 @c ?commands set output
9828 @c ?commands show output
9836 By default, screens are displayed to the standard output. The @ref{output}
9837 command redirects the display to the specified file or device.
9841 set output @{"<filename>"@}
9846 The filename must be enclosed in quotes. If the filename is omitted, any
9847 output file opened by a previous invocation of @ref{output} will be closed
9848 and new output will be sent to STDOUT. (If you give the command `set output
9849 "STDOUT"`, your output may be sent to a file named "STDOUT"! ["May be", not
9850 "will be", because some terminals, like `x11` or `wxt`, ignore @ref{output}.])
9852 MSDOS users should note that the \ character has special significance in
9853 double-quoted strings, so single-quotes should be used for filenames in
9854 different directories.
9856 When both @ref{terminal} and @ref{output} are used together, it is safest to
9857 give @ref{terminal} first, because some terminals set a flag which is needed
9858 in some operating systems. This would be the case, for example, if the
9859 operating system needs to know whether or not a file is to be formatted in
9860 order to open it properly.
9862 On machines with popen functions (Unix), output can be piped through a shell
9863 command if the first non-whitespace character of the filename is '|'.
9867 set output "|lpr -Plaser filename"
9868 set output "|lp -dlaser filename"
9872 On MSDOS machines, `set output "PRN"` will direct the output to the default
9873 printer. On VMS, output can be sent directly to any spooled device. It is
9874 also possible to send the output to DECnet transparent tasks, which allows
9877 @node parametric_, plot_, output, set-show
9878 @subsection parametric
9880 @c ?commands set parametric
9881 @c ?commands unset parametric
9882 @c ?commands show parametric
9884 @c ?unset parametric
9890 @cindex noparametric
9892 The `set parametric` command changes the meaning of `plot` (`splot`) from
9893 normal functions to parametric functions. The command `unset parametric`
9894 restores the plotting style to normal, single-valued expression plotting.
9904 For 2-d plotting, a parametric function is determined by a pair of parametric
9905 functions operating on a parameter. An example of a 2-d parametric function
9906 would be `plot sin(t),cos(t)`, which draws a circle (if the aspect ratio is
9907 set correctly---see @ref{size}). `gnuplot` will display an error message if
9908 both functions are not provided for a parametric `plot`.
9910 For 3-d plotting, the surface is described as x=f(u,v), y=g(u,v), z=h(u,v).
9911 Therefore a triplet of functions is required. An example of a 3-d parametric
9912 function would be `cos(u)*cos(v),cos(u)*sin(v),sin(u)`, which draws a sphere.
9913 `gnuplot` will display an error message if all three functions are not
9914 provided for a parametric `splot`.
9916 The total set of possible plots is a superset of the simple f(x) style plots,
9917 since the two functions can describe the x and y values to be computed
9918 separately. In fact, plots of the type t,f(t) are equivalent to those
9919 produced with f(x) because the x values are computed using the identity
9920 function. Similarly, 3-d plots of the type u,v,f(u,v) are equivalent to
9923 Note that the order the parametric functions are specified is xfunction,
9924 yfunction (and zfunction) and that each operates over the common parametric
9927 Also, the `set parametric` function implies a new range of values. Whereas
9928 the normal f(x) and f(x,y) style plotting assume an xrange and yrange (and
9929 zrange), the parametric mode additionally specifies a trange, urange, and
9930 vrange. These ranges may be set directly with @ref{trange}, @ref{urange},
9931 and @ref{vrange}, or by specifying the range on the `plot` or `splot`
9932 commands. Currently the default range for these parametric variables is
9933 [-5:5]. Setting the ranges to something more meaningful is expected.
9935 @node plot_, pm3d, parametric_, set-show
9938 @c ?commands show plot
9940 The `show plot` command shows the current plotting command as it results
9941 from the last `plot` and/or `splot` and possible subsequent @ref{replot} commands.
9943 In addition, the `show plot add2history` command adds this current plot
9944 command into the `history`. It is useful if you have used @ref{replot} to add
9945 more curves to the current plot and you want to edit the whole command now.
9947 @node pm3d, palette, plot_, set-show
9950 @c ?commands set pm3d
9951 @c ?commands show pm3d
9958 pm3d is an `splot` style for drawing palette-mapped 3d and 4d data as
9959 color/gray maps and surfaces. It uses a pm3d algorithm which allows plotting
9960 gridded as well as non-gridded data without preprocessing, even when the data
9961 scans do not have the same number of points.
9963 Drawing of color surfaces is available on terminals supporting filled colored
9964 polygons with color mapping specified by @ref{palette}. Currently supported
9969 OS/2 Presentation Manager
9978 pslatex, pstex, epslatex
9989 Let us first describe how a map/surface is drawn. The input data come from an
9990 evaluated function or from an @ref{file}. Each surface consists of a
9991 sequence of separate scans (isolines). The pm3d algorithm fills the region
9992 between two neighbouring points in one scan with another two points in the
9993 next scan by a gray (or color) according to z-values (or according to an
9994 additional 'color' column, see help for @ref{using}) of these 4 corners; by default
9995 the 4 corner values are averaged, but this can be changed by the option
9996 `corners2color`. In order to get a reasonable surface, the neighbouring scans
9997 should not cross and the number of points in the neighbouring scans should not
9998 differ too much; of course, the best plot is with scans having same number of
9999 points. There are no other requirements (e.g. the data need not be gridded).
10000 Another advantage is that the pm3d algorithm does not draw anything outside of
10001 the input (measured or calculated) region.
10003 Surface coloring works with the following input data:
10005 1. splot of function or of data file with one or three data columns: The
10006 gray/color scale is obtained by mapping the averaged (or `corners2color`)
10007 z-coordinate of the four corners of the above-specified quadrangle into the
10008 range [min_color_z,max_color_z] of @ref{zrange} or @ref{cbrange} providing a gray value
10009 in the range [0:1]. This value can be used directly as the gray for gray maps.
10010 The normalized gray value can be further mapped into a color---see @ref{palette}
10011 for the complete description.
10013 2. splot of data file with two or four data columns: The gray/color value is
10014 obtained by using the last-column coordinate instead of the z-value, thus
10015 allowing the color and the z-coordinate be mutually independent. This can be
10016 used for 4d data drawing.
10020 1. The term 'scan' referenced above is used more among physicists than the
10021 term 'iso_curve' referenced in gnuplot documentation and sources. You measure
10022 maps recorded one scan after another scan, that's why.
10024 2. The 'gray' or 'color' scale is a linear mapping of a continuous variable
10025 onto a smoothly varying palette of colors. The mapping is shown in a
10026 rectangle next to the main plot. This documentation refers to this as a
10027 "colorbox", and refers to the indexing variable as lying on the colorbox axis.
10028 See `set colorbox`, @ref{cbrange}.
10030 3. To use pm3d coloring to generate a two-dimensional plot rather than a 3D
10031 surface, use `set view map` or `set pm3d map`.
10033 Syntax (the options can be given in any order):
10036 @{ at <bst combination> @}
10037 @{ interpolate <steps in scan>,<steps between scans> @}
10038 @{ scansautomatic | scansforward | scansbackward | depthorder @}
10039 @{ flush @{ begin | center | end @} @}
10040 @{ ftriangles | noftriangles @}
10041 @{ clip1in | clip4in @}
10042 @{ corners2color @{ mean|geomean|median|min|max|c1|c2|c3|c4 @} @}
10043 @{ hidden3d <linestyle> | nohidden3d @}
10044 @{ implicit | explicit @}
10052 Color surface is drawn if data or function @ref{style} is set to pm3d globally or
10053 via 'with' option, or if the option `implicit` is on---then the pm3d surface
10054 is combined with the line surface mesh. See bottom of this section for mode
10057 Color surface can be drawn at the base or top (then it is a gray/color planar
10058 map) or at z-coordinates of surface points (gray/color surface). This is
10059 defined by the `at` option with a string of up to 6 combinations of `b`, `t`
10060 and `s`. For instance, `at b` plots at bottom only, `at st` plots firstly
10061 surface and then top map, while `at bstbst` will never by seriously used.
10063 Colored quadrangles are plotted one after another. When plotting surfaces
10064 (`at s`), the later quadrangles overlap (overdraw) the previous ones.
10065 (Gnuplot is not virtual reality tool to calculate intersections of filled
10066 polygon meshes.) You may try to switch between `scansforward` and
10067 `scansbackward` to force the first scan of the data to be plotted first or
10068 last. The default is `scansautomatic` where gnuplot makes a guess about scans
10069 order. On the other hand, the @ref{depthorder} option completely reorders the
10070 qudrangles. The rendering is performed after a depth sorting, which allows to
10071 visualize even complicated surfaces; see @ref{depthorder} for more
10074 If two subsequent scans do not have same number of points, then it has to be
10075 decided whether to start taking points for quadrangles from the beginning of
10076 both scans (`flush begin`), from their ends (`flush end`) or to center them
10077 (`flush center`). Note, that `flush (center|end)` are incompatible with
10078 `scansautomatic`: if you specify `flush center` or `flush end` and
10079 `scansautomatic` is set, it is silently switched to `scansforward`.
10081 If two subsequent scans do not have the same number of points, the option
10082 `ftriangles` specifies whether color triangles are drawn at the scan tail(s)
10083 where there are not enough points in either of the scan. This can be used to
10084 draw a smooth map boundary.
10086 Clipping with respect to x, y coordinates of quadrangles can be done in two
10087 ways. `clip1in`: all 4 points of each quadrangle must be defined and at least
10088 1 point of the quadrangle must lie in the x and y ranges. `clip4in`: all 4
10089 points of each quadrangle must lie in the x and y ranges.
10091 There is a single gray/color value associated to each drawn pm3d quadrangle
10092 (no smooth color change among vertices). The value is calculated from
10093 z-coordinates from the surrounding corners according to `corners2color
10094 <option>`. The options 'mean' (default), 'geomean' and 'median' produce
10095 various kinds of surface color smoothing, while options 'min' and 'max' choose
10096 minimal or maximal value, respectively. This may not be desired for pixel
10097 images or for maps with sharp and intense peaks, in which case the options
10098 'c1', 'c2', 'c3' or 'c4' can be used instead to assign the quadrangle color
10099 based on the z-coordinate of only one corner. Some experimentation may be
10100 needed to determine which corner corresponds to 'c1', as the orientation
10101 depends on the drawing direction. Because the pm3d algorithm does not extend
10102 the colored surface outside the range of the input data points, the 'c<j>'
10103 coloring options will result in pixels along two edges of the grid not
10104 contributing to the color of any quadrangle. For example, applying the pm3d
10105 algorithm to the 4x4 grid of data points in script `demo/pm3d.dem` (please have
10106 a look) produces only (4-1)x(4-1)=9 colored rectangles.
10108 Another drawing algorithm, which would draw quadrangles around a given node
10109 by taking corners from averaged (x,y)-coordinates of its surrounding 4 nodes
10110 while using node's color, could be implemented in the future. This is already
10111 done for drawing images (2D grids) via `image` and `rgbimage` styles.
10113 Notice that ranges of z-values and color-values for surfaces are adjustable
10114 independently by @ref{zrange}, @ref{cbrange}, as well as `set log` for z or
10115 cb. Maps can be adjusted by the cb-axis only; see also `set view map` and
10118 The option @ref{hidden3d} takes as the argument a linestyle which must be created
10119 by `set style line ...`. (The style need not to be present when setting pm3d,
10120 but it must be present when plotting). If set, lines are drawn using the
10121 specified line style, taking into account hidden line removal. This is by
10122 far more efficient than using the command @ref{hidden3d} as it doesn't really
10123 calculate hidden line removal, but just draws the filled polygons in the
10124 correct order. So the recommended choice when using pm3d is
10126 set pm3d at s hidden3d 100
10127 set style line 100 lt 5 lw 0.5
10134 There used to be an option @{transparent|solid@} to this command. Now
10135 you get the same effect from `set grid @{front|layerdefault@}`,
10138 The `set pm3d map` is an abbreviation for `set pm3d at b`; `set view map`;
10139 @ref{pm3d}; @ref{pm3d};.
10140 It is used for backwards compatibility, when `set view map` was not available.
10141 Take care that you properly use @ref{zrange} and @ref{cbrange} for input data point
10142 filtering and color range scaling, respectively; and also `set (no)surface`
10143 seems to have a (side?) effect.
10145 The option `interpolate` will interpolate grid points into a finer mesh, and
10146 color each quadrangle appropriately. For data files, this will smoothen the
10147 color surface, and enhance spikes in a color surface. For functions,
10148 interpolation makes little sense, except to trade off precision for memory.
10149 It would usually make more sense to use @ref{samples} and @ref{isosamples} when working
10152 The coloring setup as well as the color box drawing are determined by
10153 @ref{palette}. There can be only one palette for the current plot. Drawing
10154 of several surfaces with different palettes can be achieved by @ref{multiplot}
10155 with fixed @ref{origin} and @ref{size}; don't forget to use `set palette maxcolors`
10156 when your terminal is running out of available colors.
10158 On gnuplot start-up, mode is `explicit`. For historical and thus compatibility
10159 reasons, commands `set pm3d;` (i.e. no options) and `set pm3d at X ...` (i.e.
10160 `at` is the first option) sets mode `implicit`. Further, `set pm3d;` sets up
10161 the other options to their default.
10163 If the option `implicit` is on, all surface plots will be plotted additionally
10164 to the default type, e.g.
10166 splot 'fred.dat' with lines, 'lola.dat' with lines
10169 would give both plots (meshes) additionally to a pm3d surface. That's what you
10170 are used to after `set pm3d;`.
10172 If the option `explicit` is on (or `implicit` is off) only plots specified
10173 by the @ref{pm3d} attribute are plotted with a pm3d surface, e.g.:
10175 splot 'fred.dat' with lines, 'lola.dat' with pm3d
10178 would plot 'fred.dat' with lines (and only lines) and 'lola.dat' with
10181 If you set the default data or function style to @ref{pm3d}, e.g.:
10183 set style data pm3d
10186 then the options `implicit` and `explicit` have no effect.
10188 Note that when plotting several plots, they are plotted in the order given
10189 on the command line. This can be of interest especially for filled surfaces
10190 which can overwrite and therefore hide part of earlier plots.
10192 If @ref{pm3d} is specified in the `splot` command line, then it accepts the
10193 'at' option. The following plots draw three color surfaces at different
10198 splot 10*x with pm3d at b, x*x-y*y, x*x+y*y with pm3d at t
10202 See also help for @ref{palette}, @ref{cbrange}, `set colorbox`, @ref{pm3d}
10203 and definitely the demo file `demo/pm3d.dem`.
10209 @node depthorder, , pm3d, pm3d
10210 @subsubsection depthorder
10212 @c ?commands set pm3d depthorder
10213 @c ?set pm3d depthorder
10214 @c ?pm3d depthorder
10217 By default the quadrangles making up a pm3d solid surface are rendered in the
10218 order they are encountered along the surface grid points. This order may be
10219 controlled by the options `scansautomatic`|`scansforward`|`scansbackward`.
10220 These scan options are not in general compatible with hidden-surface removal.
10222 Gnuplot does not do true hidden surface removal for solid surfaces, but often
10223 it is sufficient to render the component quadrangles in order from furthest
10224 to closest. This mode may be selected using the options
10226 set pm3d depthorder hidden3d
10229 The @ref{depthorder} option orders the solid quadrangles; the @ref{hidden3d} option
10230 similarly orders the bounding lines (if drawn). Note that the global option
10231 @ref{hidden3d} does not affect pm3d surfaces.
10233 @node palette, pointsize, pm3d, set-show
10234 @subsection palette
10236 @c ?commands set palette
10237 @c ?commands show palette
10244 Palette is a color storage for use by @ref{pm3d}, filled color contours or
10245 polygons, color histograms, color gradient background, and whatever it is
10246 or it will be implemented... Here it stands for a palette of smooth
10247 "continuous" colors or grays, but let's call it just a palette.
10249 Color palettes require terminal entries for filled color polygons and
10250 palettes of smooth colors, are currently available for terminals listed in
10251 help for @ref{pm3d}. The range of color values are adjustable independently by
10252 @ref{cbrange} and `set log cb`. The whole color palette is
10253 visualized in the `colorbox`.
10260 @{ gamma <gamma> @}
10261 @{ rgbformulae <r>,<g>,<b>
10262 | defined @{ ( <gray1> <color1> @{, <grayN> <colorN>@}... ) @}
10263 | file '<filename>' @{datafile-modifiers@}
10264 | functions <R>,<G>,<B>
10266 @{ model @{ RGB | HSV | CMY | YIQ | XYZ @} @}
10267 @{ positive | negative @}
10268 @{ nops_allcF | ps_allcF @}
10269 @{ maxcolors <maxcolors> @}
10272 show palette palette <n> @{@{float | int@}@}
10273 show palette gradient
10274 show palette fit2rgbformulae
10275 show palette rgbformulae
10276 show palette colornames
10280 @ref{palette} (i.e. without options) sets up the default values.
10281 Otherwise, the options can be given in any order.
10282 @ref{palette} shows the current palette properties.
10284 `show palette gradient` displays the gradient defining the palette (if
10285 appropriate). @ref{rgbformulae} prints the available fixed gray -->
10286 color transformation formulae. @ref{colornames} prints the
10287 implemented color names.
10289 `show palette palette <n>` prints to screen or to the file given by
10290 @ref{output} table of RGB triplets calculated for the current palette settings
10291 and a palette having <n> discrete colors. The default wide table can be
10292 limited to 3 columns of r,g,b float values [0..1] or integer values [0..255]
10293 by options float or int, respectively. This way, the current gnuplot color
10294 palette can be loaded into other imaging applications, for example Octave.
10295 Additionally to this textual list of RGB table, you can enjoy command @ref{palette} to draw graphically the R,G,B profiles for the current palette.
10297 The following options determine the coloring properties.
10299 Figure using this palette can be `gray` or `color`. For instance, in @ref{pm3d}
10300 color surfaces the gray of each small spot is obtained by mapping the averaged
10301 z-coordinate of the 4 corners of surface quadrangles into the range
10302 [min_z,max_z] providing range of grays [0:1]. This value can be used directly
10303 as the gray for gray maps. The color map requires a transformation gray -->
10304 (R,G,B), i.e. a mapping [0:1] --> ([0:1],[0:1],[0:1]).
10306 Basically two different types of mappings can be used: Analytic formulae to
10307 convert gray to color, or discrete mapping tables which are interpolated.
10308 @ref{rgbformulae} and @ref{functions} use analytic formulae whereas
10309 @ref{defined} and @ref{file} use interpolated tables. @ref{rgbformulae} reduces the size of postscript output to a minimum.
10311 The command `show palette fit2rgbformulae` finds the best matching @ref{rgbformulae} for the current @ref{palette}. Naturally, it makes sense
10312 to use it for non-rgbformulae palettes. This command can be found useful
10313 mainly for external programs using the same rgbformulae definition of palettes
10314 as gnuplot, like zimg (
10315 @uref{http://zimg.sourceforge.net,http://zimg.sourceforge.net
10322 `set palette gray` switches to a gray only palette. @ref{rgbformulae},
10323 @ref{defined}, @ref{file} and @ref{functions} switch
10324 to a color mapping. `set palette color` is an easy way to switch back from the
10325 gray palette to the last color mapping.
10327 Automatic gamma correction via `set palette gamma <gamma>` can be done for
10328 gray maps only (`set palette gray`). Linear mapping to gray is for gamma
10329 equals 1, see @ref{palette}. Gamma is ignored for color mappings.
10331 Most terminals support only discrete number of colors (e.g. 256 colors in
10332 gif). All entries of the palette remaining after the default gnuplot linetype
10333 colors declaration are allocated for pm3d by default. Then @ref{multiplot} could
10334 fail if there are no more color positions in the terminal available. Then you
10335 should use `set palette maxcolors <maxcolors>` with a reasonably small value.
10336 This option can also be used to separate levels of z=constant in discrete
10337 steps, thus to emulate filled contours. Default value of 0 stays for
10338 allocating all remaining entries in the terminal palette or for to use exact
10341 RGB color space might not be the most useful color space to work in. For that
10342 reason you may change the color space with `model` to one of `RGB`, `HSV`,
10343 `CMY`, `YIQ` and `XYZ`. Using color names for @ref{defined} tables
10344 and a color space other than RGB will result in funny colors. All explanation
10345 have been written for RGB color space, so please note, that `R` can be `H`,
10346 `C`, `Y`, or `X`, depending on the actual color space (`G` and `B`
10349 All values for all color spaces are limited to [0,1].
10351 RGB stands for Red, Green and Blue; CMY stands for Cyan, Magenta and Yellow;
10352 HSV stands for Hue, Saturation, and Value; YIQ is the color model used by
10353 the U.S. Commercial Color Television Broadcasting, it is basically an RGB
10354 recoding with downward compatibility for black and white television;
10355 XYZ are the three primary colors of the color model defined by the 'Commission
10356 Internationale de l'Eclairage' (CIE).
10357 For more information on color models see:
10358 @uref{http://www.cs.rit.edu/~ncs/color/glossary.htm,http://www.cs.rit.edu/~ncs/color/glossary.htm
10361 @uref{http://cs.fit.edu/wds/classes/cse5255/cse5255/davis/index.html,http://cs.fit.edu/wds/classes/cse5255/cse5255/davis/index.html
10370 * gamma_correction::
10375 @node rgbformulae, defined_, palette, palette
10376 @subsubsection rgbformulae
10378 @c ?commands set palette rgbformulae
10379 @c ?set palette rgbformulae
10380 @c ?palette rgbformulae
10381 @cindex rgbformulae
10385 For @ref{rgbformulae} three suitable mapping functions have
10386 to be chosen. This is done via `rgbformulae <r>,<g>,<b>`. The available
10387 mapping functions are listed by @ref{rgbformulae}. Default is
10388 `7,5,15`, some other examples are `3,11,6`, `21,23,3` or `3,23,21`. Negative
10389 numbers, like `3,-11,-6`, mean inverted color (i.e. 1-gray passed into the
10390 formula, see also `positive` and `negative` options below).
10392 Some nice schemes in RGB color space
10394 7,5,15 ... traditional pm3d (black-blue-red-yellow)
10395 3,11,6 ... green-red-violet
10396 23,28,3 ... ocean (green-blue-white); try also all other permutations
10397 21,22,23 ... hot (black-red-yellow-white)
10398 30,31,32 ... color printable on gray (black-blue-violet-yellow-white)
10399 33,13,10 ... rainbow (blue-green-yellow-red)
10400 34,35,36 ... AFM hot (black-red-yellow-white)
10404 A full color palette in HSV color space
10406 3,2,2 ... red-yellow-green-cyan-blue-magenta-red
10410 Please note that even if called @ref{rgbformulae} the formulas might actually
10411 determine the <H>,<S>,<V> or <X>,<Y>,<Z> or ... color components as usual.
10413 Use `positive` and `negative` to invert the figure colors.
10414 @c ^ <a name="positive"></a>
10415 @c ^ <a name="negative"></a>
10417 Note that it is possible to find a set of the best matching rgbformulae for any
10418 other color scheme by the command
10420 show palette fit2rgbformulae
10424 @node defined_, functions_, rgbformulae, palette
10425 @subsubsection defined
10427 @c ?commands set palette defined
10428 @c ?set palette defined
10429 @c ?palette defined
10432 Gray-to-rgb mapping can be manually set by use of @ref{defined}: A color gradient
10433 is defined and used to give the rgb values. Such a gradient is a piecewise
10434 linear mapping from gray values in [0,1] to the RGB space [0,1]x[0,1]x[0,1].
10435 You have to specify the gray values and the corresponding RGB values in
10436 between a linear interpolation shall take place:
10440 set palette defined @{ ( <gray1> <color1> @{, <grayN> <colorN>@}... ) @}
10444 <grayX> are gray values which are mapped to [0,1] and <colorX> are the
10445 corresponding rgb colors. The color can be specified in three different
10449 <color> := @{ <r> <g> <b> | '<color-name>' | '#rrggbb' @}
10453 Either by three numbers (each in [0,1]) for red, green and blue, separated by
10454 whitespace, or the name of the color in quotes or X style color specifiers
10455 also in quotes. You may freely mix the three types in a gradient definition,
10456 but the named color "red" will be something strange if RGB is not selected
10457 as color space. Use @ref{colornames} for a list of known color
10460 Please note, that even if written as <r>, this might actually be the
10461 <H> component in HSV color space or <X> in CIE-XYZ space, or ...
10462 depending on the selected color model.
10464 The <gray> values have to form an ascending sequence of real numbers; the
10465 sequence will be automatically rescaled to [0,1].
10467 @ref{defined} (without a gradient definition in braces) switches to
10468 RGB color space and uses a preset full-spectrum color gradient.
10469 Use `show palette gradient` to display the gradient.
10473 To produce a gray palette (useless but instructive) use:
10475 set palette model RGB
10476 set palette defined ( 0 "black", 1 "white" )
10480 To produce a blue yellow red palette use (all equivalent):
10482 set palette defined ( 0 "blue", 1 "yellow", 2 "red" )
10483 set palette defined ( 0 0 0 1, 1 1 1 0, 2 1 0 0 )
10484 set palette defined ( 0 "#0000ff", 1 "#ffff00", 2 "#ff0000" )
10488 To produce some rainbow-like palette use:
10490 set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )
10494 Full color spectrum within HSV color space:
10496 set palette model HSV
10497 set palette defined ( 0 0 1 1, 1 1 1 1 )
10498 set palette defined ( 0 0 1 0, 1 0 1 1, 6 0.8333 1 1, 7 0.8333 0 1)
10502 To produce a palette with few colors only use:
10504 set palette model RGB maxcolors 4
10505 set palette defined ( 0 "blue", 1 "green", 2 "yellow", 3 "red" )
10509 'Traffic light' palette (non-smooth color jumps at gray = 1/3 and 2/3).
10511 set palette model RGB
10512 set palette defined (0 "dark-green", 1 "green", 1 "yellow", \
10513 2 "dark-yellow", 2 "red", 3 "dark-red" )
10518 @node functions_, file, defined_, palette
10519 @subsubsection functions
10521 @c ?commands set palette functions
10522 @c ?set palette functions
10523 @c ?palette functions
10524 Use `set palette functions <Rexpr>, <Gexpr>, <Bexpr>` to define three formulae
10525 for the R(gray), G(gray) and B(gray) mapping. The three formulae may depend
10526 on the variable `gray` which will take values in [0,1] and should also
10527 produce values in [0,1].
10528 Please note that <Rexpr> might be a formula for the H-value if HSV color
10529 space has been chosen (same for all other formulae and color spaces).
10533 To produce a full color palette use:
10535 set palette model HSV functions gray, 1, 1
10539 A nice black to gold palette:
10541 set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8
10545 A gamma-corrected black and white palette
10548 color(gray) = gray**(1./gamma)
10549 set palette model RGB functions color(gray), color(gray), color(gray)
10554 @node file, gamma_correction, functions_, palette
10555 @subsubsection file
10557 @c ?commands set palette file
10558 @c ?set palette file
10560 @ref{file} is basically a `set palette defined (<gradient>)` where
10561 <gradient> is read from a datafile. Either 4 columns (gray,R,G,B) or
10562 just three columns (R,G,B) have to be selected via the @ref{using} data file
10563 modifier. In the three column case, the line number will be used as gray.
10564 The gray range is automatically rescaled to [0,1]. The file is read as a
10565 normal data file, so all datafile modifiers can be used.
10566 Please note, that `R` might actually be e.g. `H` if HSV color space is
10569 As usual <filename> may be `'-'` which means that the data follow the command
10570 inline and are terminated by a single `e` on a line of its own.
10572 Use `show palette gradient` to display the gradient.
10576 Read in a palette of RGB triples each in range [0,255]:
10578 set palette file 'some-palette' using ($1/255):($2/255):($3/255)
10582 Equidistant rainbow (blue-green-yellow-red) palette:
10584 set palette model RGB file "-"
10593 Binary palette files are supported as well, see `binary general`. Example:
10594 put 64 triplets of R,G,B doubles into file palette.bin and load it by
10596 set palette file "palette.bin" binary record=64 using 1:2:3
10602 @node gamma_correction, postscript, file, palette
10603 @subsubsection gamma correction
10605 @c ?commands set palette gamma-correction
10606 @c ?set palette gamma-correction
10607 @c ?palette gamma-correction
10608 @cindex gamma-correction
10610 For gray mappings gamma correction can be turned on by `set palette gamma
10611 <gamma>`. <gamma> defaults to 1.5 which is quite suitable for most
10614 For color mappings no automatic gamma correction is done by gnuplot. However,
10615 you may easily implement gamma correction. Here is an example for a gray
10616 scale image by use of explicit functions for the red, green and blue component
10617 with slightly different values of gamma
10621 set palette model RGB
10622 set palette functions gray**0.64, gray**0.67, gray**0.70
10626 To use gamma correction with interpolated gradients specify intermediate
10627 gray values with appropriate colors. Instead of
10630 set palette defined ( 0 0 0 0, 1 1 1 1 )
10637 set palette defined ( 0 0 0 0, 0.5 .73 .73 .73, 1 1 1 1 )
10641 or even more intermediate points until the linear interpolation fits the
10642 "gamma corrected" interpolation well enough.
10645 @node postscript, colornames, gamma_correction, palette
10646 @subsubsection postscript
10648 @c ?commands set palette postscript
10649 @c ?set palette postscript
10650 In order to reduce the size of postscript files, the gray value and not all
10651 three calculated r,g,b values are written to the file. Therefore the
10652 analytical formulae are coded directly in the postscript language as a header
10653 just before the pm3d drawing, see /g and /cF definitions. Usually, it makes
10654 sense to write therein definitions of only the 3 formulae used. But for
10655 multiplot or any other reason you may want to manually edit the
10656 transformations directly in the postscript file. This is the default option
10657 `nops_allcF`. Using the option `ps_allcF` writes postscript definitions of
10658 all formulae. This you may find interesting if you want to edit the
10659 postscript file in order to have different palettes for different surfaces
10660 in one graph. Well, you can achieve this functionality by @ref{multiplot} with
10661 fixed @ref{origin} and @ref{size}.
10663 If pm3d map has been plotted from gridded or almost regular data with an
10664 output to a postscript file, then it is possible to reduce the size of this
10665 postscript file up to at about 50% by the enclosed awk script
10666 `pm3dCompress.awk`. This you may find interesting if you intend to keep the
10667 file for including it into your publication or before downloading a very large
10668 file into a slow printer. Usage:
10670 awk -f pm3dCompress.awk thefile.ps >smallerfile.ps
10674 If pm3d map has been plotted from rectangular gridded data with an output
10675 to a postscript file, then it is possible to reduce the file size even more
10676 by the enclosed awk script `pm3dConvertToImage.awk`. Usage:
10678 awk -f pm3dConvertToImage.awk <thefile.ps >smallerfile.ps
10682 You may manually change the postscript output from gray to color and vice
10683 versa and change the definition of <maxcolors>.
10685 @node colornames, , postscript, palette
10686 @subsubsection colornames
10690 @c ?show palette colornames
10691 @c ?show colornames
10692 Gnuplot knows a limited number of color names. You can use these to define
10693 the color range spanned by a pm3d palette, or to assign a terminal-independent
10694 color to a particular linetype or linestyle. To see the list of known color
10695 names, use the command @ref{colornames}.
10696 See @ref{palette}, `linestyle`.
10698 @node pointsize, polar, palette, set-show
10699 @subsection pointsize
10701 @c ?commands set pointsize
10702 @c ?commands show pointsize
10709 The @ref{pointsize} command scales the size of the points used in plots.
10713 set pointsize <multiplier>
10718 The default is a multiplier of 1.0. Larger pointsizes may be useful to
10719 make points more visible in bitmapped graphics.
10721 The pointsize of a single plot may be changed on the `plot` command.
10722 See @ref{with} for details.
10724 Please note that the pointsize setting is not supported by all terminal
10727 @node polar, print_, pointsize, set-show
10730 @c ?commands set polar
10731 @c ?commands unset polar
10732 @c ?commands show polar
10742 The `set polar` command changes the meaning of the plot from rectangular
10743 coordinates to polar coordinates.
10753 There have been changes made to polar mode in version 3.7, so that scripts
10754 for `gnuplot` versions 3.5 and earlier will require modification. The main
10755 change is that the dummy variable t is used for the angle so that the x and
10756 y ranges can be controlled independently. Other changes are:
10757 1) tics are no longer put along the zero axes automatically
10758 ---use `set xtics axis nomirror`; `set ytics axis nomirror`;
10759 2) the grid, if selected, is not automatically polar
10760 ---use `set grid polar`;
10761 3) the grid is not labelled with angles
10762 ---use @ref{label} as necessary.
10764 In polar coordinates, the dummy variable (t) is an angle. The default range
10765 of t is [0:2*pi], or, if degree units have been selected, to [0:360] (see
10768 The command `unset polar` changes the meaning of the plot back to the default
10769 rectangular coordinate system.
10771 The `set polar` command is not supported for `splot`s. See the @ref{mapping}
10772 command for similar functionality for `splot`s.
10774 While in polar coordinates the meaning of an expression in t is really
10775 r = f(t), where t is an angle of rotation. The trange controls the domain
10776 (the angle) of the function, and the x and y ranges control the range of the
10777 graph in the x and y directions. Each of these ranges, as well as the
10778 rrange, may be autoscaled or set explicitly. See @ref{xrange} for details
10779 of all the @ref{ranges} commands.
10785 plot [-2*pi:2*pi] [-3:3] [-3:3] t*sin(t)
10789 The first `plot` uses the default polar angular domain of 0 to 2*pi. The
10790 radius and the size of the graph are scaled automatically. The second `plot`
10791 expands the domain, and restricts the size of the graph to [-3:3] in both
10794 You may want to `set size square` to have `gnuplot` try to make the aspect
10795 ratio equal to unity, so that circles look circular.
10797 @uref{http://www.gnuplot.info/demo/polar.html,polar demos (polar.dem)
10800 @uref{http://www.gnuplot.info/demo/poldat.html,polar data plot (poldat.dem).
10803 @node print_, object, polar, set-show
10806 @c ?commands set print
10807 @c ?commands show print
10810 The @ref{print} command redirects the output of the @ref{print} command to a file.
10816 set print "<filename>"
10817 set print "<filename>" append
10818 set print "|<shell_command>"
10822 Without "<filename>", the output file is restored to <STDERR>. The <filename>
10823 "-" means <STDOUT>. The `append` flag causes the file to be opened in append
10824 mode. A <filename> starting with "|" is opened as a pipe to the
10825 <shell_command> on platforms that support piping.
10827 @node object, rmargin, print_, set-show
10836 @c ?commands set object
10837 @c ?commands show object
10838 @c ?commands set object rectangle
10839 @c ?commands show object rectangle
10842 @c ?set object rectangle
10843 @c ?show object rectangle
10844 This command defines a single object, which will appear in all subsequent
10845 2D plots. You may define as many objects as you like. Currently the only
10846 object type supported is `rectangle`.
10847 Each rectangle is specified by a pair of points that define diagonal vertices.
10848 A default set of style properties (fill, color, border) are inherited from
10849 those set by the command `set style rectangle`, but each rectangle can also be
10850 given individual style properties.
10854 set object <index> rectangle
10855 @{from <position> @{to|rto@} <position> |
10856 center <position> size <w>,<h> |
10857 at <position> size <w>,<h>@}
10858 @{front|back|behind@} @{fc|fillcolor <colorspec>@} @{fs <fillstyle>@}
10859 @{default@} @{lw|linewidth <width>@}
10863 The position of the rectangle may be specified by giving the position of two
10864 diagonal corners (bottom left and top right) or by giving the position of the
10865 center followed by the width and the height. In either case the positions
10866 may be given in axis, graph, or screen coordinates. See `coordinates`.
10867 The options `at` and `center` are synonyms.
10869 Setting `front` will draw the rectangle in front of all plot elements, but
10870 behind any labels that are also marked `front`. Setting `back` will place the
10871 rectangle behind all plot curves and labels. Setting `behind` will place the
10872 rectangle behind everything including the axes and `back` rectangles, and can
10873 be used to provide a colored background for the entire graph or page.
10875 The fill color of the rectangle is taken from the <colorspec>. `fillcolor`
10876 may be abbreviated `fc`. The fill style is taken from <fillstyle>.
10877 See @ref{colorspec} and `fillstyle`. If the keyword `default` is given,
10878 these properties are inherited from the default settings of at the time a plot
10879 is drawn. See `set style rectangle`.
10883 # Force the entire area enclosed by the axes to have background color cyan
10884 set object 1 rect from graph 0, graph 0 to graph 1, graph 1 back
10885 set object 1 rect fc rgb "cyan" fillstyle solid 1.0
10890 # Position a red square with lower left at 0,0 and upper right at 2,3
10891 set object 2 rect from 0,0 to 2,3 fc lt 1
10896 # Position an empty rectangle (no fill) with a blue border
10897 set object 3 rect from 0,0 to 2,3 fs empty border 3
10902 # Return fill and color to the default style but leave vertices unchanged
10903 set object 2 rect default
10908 @node rmargin, rrange, object, set-show
10909 @subsection rmargin
10911 @c ?commands set rmargin
10917 The command @ref{rmargin} sets the size of the right margin.
10918 Please see @ref{margin} for details.
10920 @node rrange, samples, rmargin, set-show
10923 @c ?commands set rrange
10924 @c ?commands show rrange
10931 The @ref{rrange} command sets the range of the radial coordinate for a
10932 graph in polar mode. Please see @ref{xrange} for details.
10934 @node samples, size, rrange, set-show
10935 @subsection samples
10937 @c ?commands set samples
10938 @c ?commands show samples
10945 The sampling rate of functions, or for interpolating data, may be changed
10946 by the @ref{samples} command.
10950 set samples <samples_1> @{,<samples_2>@}
10955 By default, sampling is set to 100 points. A higher sampling rate will
10956 produce more accurate plots, but will take longer. This parameter has no
10957 effect on data file plotting unless one of the interpolation/approximation
10958 options is used. See @ref{smooth} re 2-d data and @ref{cntrparam} and
10959 @ref{dgrid3d} re 3-d data.
10961 When a 2-d graph is being done, only the value of <samples_1> is relevant.
10963 When a surface plot is being done without the removal of hidden lines, the
10964 value of samples specifies the number of samples that are to be evaluated for
10965 the isolines. Each iso-v line will have <sample_1> samples and each iso-u
10966 line will have <sample_2> samples. If you only specify <samples_1>,
10967 <samples_2> will be set to the same value as <samples_1>. See also
10970 @node size, style, samples, set-show
10973 @c ?commands set size
10974 @c ?commands show size
10984 set size @{@{no@}square | ratio <r> | noratio@} @{<xscale>,<yscale>@}
10989 The <xscale> and <yscale> values are scale factors for the size of the plot,
10990 which includes the graph, labels, and margins.
10994 In earlier versions of gnuplot, some terminal types used the values from
10995 @ref{size} to control also the size of the output canvas; others did not.
10996 In version 4.2 almost all terminals now follow the following convention:
11000 `set term <terminal_type> size <XX>, <YY>` controls the size of the output
11001 file, or `canvas`. Please see individual terminal documentation for allowed
11002 values of the size parameters. By default, the plot will fill this canvas.
11004 `set size <XX>, <YY>` scales the plot itself relative to the size of the
11005 canvas. Scale values less than 1 will cause the plot to not fill the entire
11006 canvas. Scale values larger than 1 will cause only a portion of the plot to
11007 fit on the canvas. Please be aware that setting scale values larger than 1
11008 may cause problems on some terminal types.
11010 `ratio` causes `gnuplot` to try to create a graph with an aspect ratio of <r>
11011 (the ratio of the y-axis length to the x-axis length) within the portion of
11012 the plot specified by <xscale> and <yscale>.
11014 The meaning of a negative value for <r> is different. If <r>=-1, gnuplot
11015 tries to set the scales so that the unit has the same length on both the x
11016 and y axes (suitable for geographical data, for instance). If <r>=-2, the
11017 unit on y has twice the length of the unit on x, and so on.
11019 The success of `gnuplot` in producing the requested aspect ratio depends on
11020 the terminal selected. The graph area will be the largest rectangle of
11021 aspect ratio <r> that will fit into the specified portion of the output
11022 (leaving adequate margins, of course).
11024 `square` is a synonym for `ratio 1`.
11026 Both `noratio` and `nosquare` return the graph to the default aspect ratio
11027 of the terminal, but do not return <xscale> or <yscale> to their default
11030 `ratio` and `square` have no effect on 3-d plots, but do affect 3D projections
11031 created using `set view map`. Similarly `set view equal` forces the
11032 x and y axes of a 3D onto the same scale.
11036 To set the size so that the plot fills the available canvas:
11042 To make the graph half size and square use:
11044 set size square 0.5,0.5
11048 To make the graph twice as high as wide use:
11055 @uref{http://www.gnuplot.info/demo/airfoil.html,airfoil demo.
11058 @node style, surface, size, set-show
11064 @c ^ <a name="set style <style>"></a>
11065 Default plotting styles are chosen with the `set style data` and
11066 `set style function` commands. See @ref{with} for information about how to
11067 override the default plotting style for individual functions and data sets.
11068 See `plotting styles` for a complete list of styles.
11072 set style function <style>
11073 set style data <style>
11074 show style function
11079 Default styles for specific plotting elements may also be set.
11083 set style arrow <n> <arrowstyle>
11084 set style fill <fillstyle>
11085 set style histogram <histogram style options>
11086 set style line <n> <linestyle>
11092 * set_style_arrow::
11095 * set_style_function::
11096 * set_style_increment::
11098 * plotting_styles::
11099 * set_style_rectangle::
11102 @node set_style_arrow, set_style_data, style, style
11103 @subsubsection set style arrow
11105 @c ?commands set style arrow
11106 @c ?commands unset style arrow
11107 @c ?commands show style arrow
11108 @c ?set style arrow
11109 @c ?unset style arrow
11110 @c ?show style arrow
11113 @c ^ <a name="arrowtype"></a>
11114 @c ^ <a name="arrowwidth"></a>
11115 Each terminal has a default set of arrow and point types, which can be seen
11116 by using the command @ref{test}. @ref{arrow} defines a set of arrow types
11117 and widths and point types and sizes so that you can refer to them later by
11118 an index instead of repeating all the information at each invocation.
11122 set style arrow <index> default
11123 set style arrow <index> @{nohead | head | heads@}
11124 @{size <length>,<angle>@{,<backangle>@}@}
11125 @{filled | empty | nofilled@}
11127 @{ @{linestyle | ls <line_style>@}
11128 | @{linetype | lt <line_type>@}
11129 @{linewidth | lw <line_width@} @}
11135 <index> is an integer that identifies the arrowstyle.
11137 If `default` is given all arrow style parameters are set to their default
11140 If the linestyle <index> already exists, only the given parameters are
11141 changed while all others are preserved. If not, all undefined values are
11142 set to the default values.
11144 Specifying `nohead` produces arrows drawn without a head---a line segment.
11145 This gives you yet another way to draw a line segment on the plot. By
11146 default, arrows have one head. Specifying `heads` draws arrow heads on both
11149 Head size can be controlled by `size <length>,<angle>` or
11150 `size <length>,<angle>,<backangle>`, where `<length>` defines length of each
11151 branch of the arrow head and `<angle>` the angle (in degrees) they make with
11152 the arrow. `<Length>` is in x-axis units; this can be changed by `first`,
11153 `second`, `graph`, `screen`, or `character` before the <length>; see
11154 `coordinates` for details. `<Backangle>` only takes effect when `filled`
11155 or `empty` is also used. Then, `<backangle>` is the angle (in degrees) the
11156 back branches make with the arrow (in the same direction as `<angle>`).
11157 The `fig` terminal has a restricted backangle function. It supports three
11158 different angles. There are two thresholds: Below 70 degrees, the arrow head
11159 gets an indented back angle. Above 110 degrees, the arrow head has an acute
11160 back angle. Between these thresholds, the back line is straight.
11162 Specifying `filled` produces filled arrow heads (if heads are used).
11163 Filling is supported on filled-polygon capable terminals, see help of @ref{pm3d}
11164 for their list, otherwise the arrow heads are closed but not filled.
11165 The same result (closed but not filled arrow head) is reached by specifying
11166 `empty`. Further, filling and outline is obviously not supported on
11167 terminals drawing arrows by their own specific routines, like `metafont`,
11168 `metapost`, `latex` or `tgif`.
11170 The line style may be selected from a user-defined list of line styles
11171 (see `set style line`) or may be defined here by providing values for
11172 `<line_type>` (an index from the default list of styles) and/or
11173 `<line_width>` (which is a multiplier for the default width).
11175 Note, however, that if a user-defined line style has been selected, its
11176 properties (type and width) cannot be altered merely by issuing another
11177 @ref{arrow} command with the appropriate index and `lt` or `lw`.
11179 If `front` is given, the arrows are written on top of the graphed data. If
11180 `back` is given (the default), the arrow is written underneath the graphed
11181 data. Using `front` will prevent a arrow from being obscured by dense data.
11185 To draw an arrow without an arrow head and double width, use:
11187 set style arrow 1 nohead lw 2
11188 set arrow arrowstyle 1
11193 See also @ref{arrow} for further examples.
11198 @node set_style_data, set_style_fill, set_style_arrow, style
11199 @subsubsection set style data
11201 @c ?commands set style data
11202 @c ?commands show style data
11204 @c ?show style data
11206 The `set style data` command changes the default plotting style for data
11211 set style data <plotting-style>
11216 See `plotting styles` for the choices. If no choice is given, the choices are
11217 listed. `show style data` shows the current default data plotting style.
11219 @node set_style_fill, set_style_function, set_style_data, style
11220 @subsubsection set style fill
11222 @c ?commands set style fill
11223 @c ?commands show style fill
11225 @c ?show style fill
11228 The `set style fill` command is used to set the style of boxes,
11229 histograms, candlesticks and filledcurves.
11233 set style fill @{empty | solid @{<density>@} | pattern @{<n>@}@}
11234 @{border @{<linetype>@} | noborder@}
11238 The default fillstyle is `empty`.
11240 The `solid` option causes filling with a solid color, if the terminal
11241 supports that. The <density> parameter specifies the intensity of the
11242 fill color. At a <density> of 0.0, the box is empty, at <density> of 1.0,
11243 the inner area is of the same color as the current linetype.
11244 Some terminal types can vary the density continuously; others implement
11245 only a few levels of partial fill. If no <density> parameter is given,
11248 The `pattern` option causes filling to be done with a fill pattern supplied
11249 by the terminal driver. The kind and number of available fill patterns
11250 depend on the terminal driver. If multiple datasets using filled boxes are
11251 plotted, the pattern cycles through all available pattern types, starting
11252 from pattern <n>, much as the line type cycles for multiple line plots.
11254 The `empty` option causes filled boxes not to be filled. This is the default.
11256 By default, @ref{border}, the box is bounded by a solid line of the current
11257 linetype. `border <lt>` specifies that a border is to be drawn using
11258 linetype <lt>. `noborder` specifies that no bounding lines are drawn.
11260 @node set_style_function, set_style_increment, set_style_fill, style
11261 @subsubsection set style function
11263 @c ?commands set style function
11264 @c ?commands show style function
11265 @c ?set style function
11266 @c ?show style function
11268 The `set style function` command changes the default plotting style for
11273 set style function <plotting-style>
11274 show style function
11278 See `plotting styles` for the choices. If no choice is given, the choices are
11279 listed. `show style function` shows the current default function plotting
11282 @node set_style_increment, set_style_line, set_style_function, style
11283 @subsubsection set style increment
11285 @c ?commands set style increment
11286 @c ?commands show style increment
11287 @c ?set style increment
11288 @c ?show style increment
11291 set style increment @{default|userstyles@}
11292 show style increment
11296 By default, successive plots within the same graph will use successive
11297 linetypes from the default set for the current terminal type.
11298 However, choosing `set style increment user` allows you to step through
11299 the user-defined line styles rather than through the default linetypes.
11304 set style line 1 lw 2 lc rgb "gold"
11305 set style line 2 lw 2 lc rgb "purple"
11306 set style line 4 lw 1 lc rgb "sea-green"
11307 set style increment user
11312 plot f1(x), f2(x), f3(x), f4(x)
11316 should plot functions f1, f2, f4 in your 3 newly defined line styles.
11317 If a user-defined line style is not found then the corresponding default
11318 linetype is used instead. E.g. in the example above, f3(x) will be plotted
11319 using the default linetype 3.
11322 @node set_style_line, plotting_styles, set_style_increment, style
11323 @subsubsection set style line
11325 @c ?commands set style line
11326 @c ?commands unset style line
11327 @c ?commands show style line
11329 @c ?unset style line
11330 @c ?show style line
11335 Each terminal has a default set of line and point types, which can be seen
11336 by using the command @ref{test}. `set style line` defines a set of line types
11337 and widths and point types and sizes so that you can refer to them later by
11338 an index instead of repeating all the information at each invocation.
11342 set style line <index> default
11343 set style line <index> @{@{linetype | lt@} <line_type> | <colorspec>@}
11344 @{@{linecolor | lc@} <colorspec>@}
11345 @{@{linewidth | lw@} <line_width>@}
11346 @{@{pointtype | pt@} <point_type>@}
11347 @{@{pointsize | ps@} <point_size>@}
11354 If `default` is given all line style parameters are set to their default
11357 If the linestyle <index> already exists, only the given parameters are
11358 changed while all others are preserved. If not, all undefined values are
11359 set to the default values.
11361 The line and point types are taken from the default types for the terminal
11362 currently in use. The line width and point size are multipliers for the
11363 default width and size (but note that <point_size> here is unaffected by
11364 the multiplier given on @ref{pointsize}).
11366 The defaults for the line and point types is the index. The defaults for
11367 the width and size are both unity.
11369 Linestyles created by this mechanism do not replace the default linetype
11370 styles; both may be used. If you want plots to use the defined styles in
11371 preference to the default linetypes, please see `set style increment`.
11373 Not all terminals support the `linewidth` and @ref{pointsize} features; if
11374 not supported, the option will be ignored.
11376 Terminal-independent colors may be assigned using either
11377 `linecolor <colorspec>` or `linetype <colorspec>`, abbreviated `lc` or `lt`.
11378 This requires giving a RGB color triple, a known palette color name,
11379 a fractional index into the current palette, or a constant value from the
11380 current mapping of the palette onto cbrange.
11381 See `colors`, @ref{colorspec}, @ref{palette}, @ref{colornames}, @ref{cbrange}.
11383 `set style line <n> linetype <lt>` will set both a terminal-dependent dot/dash
11384 pattern and color. The commands`set style line <n> linecolor <colorspec>` or
11385 `set style line <n> linetype <colorspec>` will set a new line color while
11386 leaving the existing dot-dash pattern unchanged.
11388 In 3d mode (`splot` command), the special keyword @ref{palette} is allowed as a
11389 shorthand for "linetype palette z". The color value corresponds to the
11390 z-value (elevation) of the splot, and varies smoothly along a line or surface.
11393 Suppose that the default lines for indices 1, 2, and 3 are red, green, and
11394 blue, respectively, and the default point shapes for the same indices are a
11395 square, a cross, and a triangle, respectively. Then
11398 set style line 1 lt 2 lw 2 pt 3 ps 0.5
11402 defines a new linestyle that is green and twice the default width and a new
11403 pointstyle that is a half-sized triangle. The commands
11406 set style function lines
11407 plot f(x) lt 3, g(x) ls 1
11411 will create a plot of f(x) using the default blue line and a plot of g(x)
11412 using the user-defined wide green line. Similarly the commands
11415 set style function linespoints
11416 plot p(x) lt 1 pt 3, q(x) ls 1
11420 will create a plot of p(x) using the default triangles connected by a red
11421 line and q(x) using small triangles connected by a green line.
11424 splot sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) w l pal
11428 creates a surface plot using smooth colors according to @ref{palette}. Note,
11429 that this works only on some terminals. See also @ref{palette}, @ref{pm3d}.
11432 set style line 10 linetype 1 linecolor rgb "cyan"
11436 will assign linestyle 10 to be a solid cyan line on any terminal that
11437 supports rgb colors.
11440 @node plotting_styles, set_style_rectangle, set_style_line, style
11441 @subsubsection plotting styles
11443 @c ?plotting styles
11445 The commands `set style data` and `set style function` change the
11446 default plotting style for subsequent `plot` and `splot` commands.
11448 The types used for all line and point styles (i.e., solid, dash-dot, color,
11449 etc. for lines; circles, squares, crosses, etc. for points) will be either
11450 those specified on the `plot` or `splot` command or will be chosen
11451 sequentially from the types available to the terminal in use. Use the
11452 command @ref{test} to see what is available.
11454 None of the styles requiring more than two columns of information
11455 (e.g., @ref{errorbars} or @ref{errorlines}) can be used with `splot`s or
11456 function `plot`s. Neither `boxes`, `filledcurves` nor any
11457 of the `steps` styles can be used with `splot`s. If an inappropriate style
11458 is specified, it will be changed to `points`.
11460 The above caveat does not apply to `plot with labels`, for which the third
11461 column specifies a data source rather than coordinate information.
11462 See `set style labels`.
11464 For 2-d data with more than two columns, `gnuplot` is picky about the
11465 allowed @ref{errorbars} and @ref{errorlines} styles. The @ref{using} option on the
11466 `plot` command can be used to set up the correct columns for the style
11467 you want. (In this discussion, "column" will be used to refer both to
11468 a column in the data file and an entry in the @ref{using} list.)
11470 For three columns, only `xerrorbars`, `yerrorbars` (or @ref{errorbars}),
11471 `xerrorlines`, `yerrorlines` (or @ref{errorlines}), `boxes`,
11472 and `boxerrorbars` are allowed. If another plot style is used, the style
11473 will be changed to `yerrorbars`. The `boxerrorbars` style will
11474 calculate the boxwidth automatically.
11476 For four columns, only `xerrorbars`, `yerrorbars` (or @ref{errorbars}),
11477 `xyerrorbars`, `xerrorlines`, `yerrorlines` (or @ref{errorlines}), `xyerrorlines`,
11478 `boxxyerrorbars`, and `boxerrorbars` are allowed. An illegal
11479 style will be changed to `yerrorbars`.
11481 Five-column data allow only the `boxerrorbars`, `financebars`, and
11482 `candlesticks` styles. An illegal style will be changed to `boxerrorbars`
11485 Six- and seven-column data only allow the `xyerrorbars`,
11486 `xyerrorlines`, and `boxxyerrorbars` styles. Illegal styles will be
11487 changed to `xyerrorbars` before plotting.
11489 For more information about error bars with and without lines,
11490 please see @ref{errorlines} and @ref{errorbars}.
11493 @node set_style_rectangle, , plotting_styles, style
11494 @subsubsection set style rectangle
11496 @c ?commands set style rectangle
11497 @c ?commands unset style rectangle
11498 @c ?commands show style rectangle
11499 @c ?set style rectangle
11500 @c ?unset style rectangle
11501 @c ?show style rectangle
11503 Rectangles defined with the `set object rectangle` command can have individual
11504 styles. However, if a rectangle is not assigned a private style then it
11505 inherits a default that is taken from the `set style rectangle` command.
11509 set style rectangle @{front|back@} @{fillcolor <colorspec>@} @{fs <fillstyle>@}
11510 @{lw|linewidth <lw>@}
11514 See @ref{colorspec} and `fillstyle`. `fillcolor` may be abbreviated as `fc`.
11518 set style rectangle back fc rgb "white" fs solid 1.0 border -1
11519 set style rectangle fc linsestyle 3 fs pattern 2 noborder
11523 The default values correspond to solid fill with the background color and a
11528 @noindent --- BOXERRORBARS ---
11530 @c ?commands set style boxerrorbars
11531 @c ?set style boxerrorbars
11532 @c ?plotting styles boxerrorbars
11533 @c ?style boxerrorbars
11534 @cindex boxerrorbars
11536 The `boxerrorbars` style is only relevant to 2-d data plotting. It is a
11537 combination of the `boxes` and `yerrorbars` styles. The boxwidth will come
11538 from the fourth column if the y errors are in the form of "ydelta" and the
11539 boxwidth was not previously set equal to -2.0 (`set boxwidth -2.0`) or from
11540 the fifth column if the y errors are in the form of "ylow yhigh". The
11541 special case `boxwidth = -2.0` is for four-column data with y errors in the
11542 form "ylow yhigh". In this case the boxwidth will be calculated so that each
11543 box touches the adjacent boxes. The width will also be calculated in cases
11544 where three-column data are used.
11546 The box height is determined from the y error in the same way as it is for
11547 the `yerrorbars` style---either from y-ydelta to y+ydelta or from ylow to
11548 yhigh, depending on how many data columns are provided.
11550 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
11554 @noindent --- BOXES ---
11556 @c ?commands set style boxes
11557 @c ?set style boxes
11558 @c ?plotting styles boxes
11562 The `boxes` style is only relevant to 2-d plotting. It draws a box centered
11563 about the given x coordinate from the x axis (not the graph border) to the
11564 given y coordinate. The width of the box is obtained in one of three ways.
11565 If it is a data plot and the data file has a third column, this will be used
11566 to set the width of the box. If not, if a width has been set using the @ref{boxwidth} command, this will be used. If neither of these is available, the
11567 width of each box will be calculated automatically so that it touches the
11570 The interior of the boxes is drawn according to the current fillstyle.
11571 See `set style fill` for details. Alternatively a new fillstyle
11572 may be specified in the plot command.
11574 For fillstyle `empty` the box is filled with the background color.
11576 For fillstyle `solid` the box is filled with a solid rectangle of the
11577 current drawing color. There is an optional parameter <density> that
11578 controls the fill density; it runs from 0 (background color) to 1
11579 (current drawing color).
11581 For fillstyle `pattern` the box is filled in the current drawing color with
11582 a pattern, if supported by the terminal driver.
11586 To plot a data file with solid filled boxes with a small vertical space
11587 separating them (bargraph):
11590 set boxwidth 0.9 relative
11591 set style fill solid 1.0
11592 plot 'file.dat' with boxes
11596 To plot a sine and a cosine curve in pattern-filled boxes style:
11599 set style fill pattern
11600 plot sin(x) with boxes, cos(x) with boxes
11604 The sin plot will use pattern 0; the cos plot will use pattern 1.
11605 Any additional plots would cycle through the patterns supported by the
11608 To specify explicit fillstyles for each dataset:
11611 plot 'file1' with boxes fs solid 0.25, \
11612 'file2' with boxes fs solid 0.50, \
11613 'file3' with boxes fs solid 0.75, \
11614 'file4' with boxes fill pattern 1, \
11615 'file5' with boxes fill empty
11619 Currently only the following terminal drivers support fillstyles other
11621 x11, windows, pm, wxt, postscript, fig, pbm, png, gif, hpdj, hppj, hpljii,
11622 hp500c, jpeg, nec_cp6, epson_180dpi, epson_60dpi, epson_lx800, okidata, starc
11623 and tandy_60dpi. The BeOS driver (`be`) is untested.
11626 @noindent --- BOXXYERRORBARS ---
11628 @c ?commands set style boxxyerrorbars
11629 @c ?set style boxxyerrorbars
11630 @c ?plotting styles boxxyerrorbars
11631 @c ?style boxxyerrorbars
11632 @cindex boxxyerrorbars
11634 The `boxxyerrorbars` style is only relevant to 2-d data plotting. It is a
11635 combination of the `boxes` and `xyerrorbars` styles.
11637 The box width and height are determined from the x and y errors in the same
11638 way as they are for the `xyerrorbars` style---either from xlow to xhigh and
11639 from ylow to yhigh, or from x-xdelta to x+xdelta and from y-ydelta to
11640 y+ydelta , depending on how many data columns are provided.
11642 If filled-box support is present, then the interior of the boxes is drawn
11643 according to the current fillstyle. See `set style fill` and `boxes` for
11644 details. Alternatively a new fillstyle may be specified in the plot command.
11647 @noindent --- CANDLESTICKS ---
11649 @c ?commands set style candlesticks
11650 @c ?set style candlesticks
11651 @c ?plotting styles candlesticks
11652 @c ?style candlesticks
11653 @cindex candlesticks
11655 The `candlesticks` style can be used for 2-d data plotting of financial
11656 data or for generating box-and-whisker plots of statistical data.
11657 Five columns of data are required; in order, these should be the x
11658 coordinate (most likely a date) and the opening, low, high, and closing
11659 prices. The symbol is a rectangular box, centered horizontally at the x
11660 coordinate and limited vertically by the opening and closing prices. A
11661 vertical line segment at the x coordinate extends up from the top of the
11662 rectangle to the high price and another down to the low. The vertical line
11663 will be unchanged if the low and high prices are interchanged.
11665 The width of the rectangle can be controlled by the @ref{boxwidth} command.
11666 For backwards compatibility with earlier gnuplot versions, when the
11667 boxwidth parameter has not been set then the width of the candlestick
11668 rectangle is controlled by `set bars <width>`.
11670 By default the vertical line segments have no crossbars at the top and
11671 bottom. If you want crossbars, which are typically used for box-and-whisker
11672 plots, then add the keyword `whiskerbars` to the plot command. By default
11673 these whiskerbars extend the full horizontal width of the candlestick, but
11674 you can modify this by specifying a fraction of the full width.
11676 By default the rectangle is empty if (open < close), and filled with three
11677 vertical bars if (close < open). If filled-boxes support is present, then
11678 the rectangle is colored according to `set style fill <fillstyle>`.
11679 See @ref{bars} and `financebars`. See also
11680 @uref{http://gnuplot.sourceforge.net/demo/candlesticks.html,finance demos
11684 Note: To place additional symbols, such as the median value, on a
11685 box-and-whisker plot requires additional plot commands as in this example:
11688 # Data columns: X Min 1stQuartile Median 3rdQuartile Max
11690 set style fill empty
11691 plot 'stat.dat' using 1:3:2:6:5 with candlesticks title 'Quartiles', \
11692 '' using 1:4:4:4:4 with candlesticks lt -1 notitle
11697 # Plot with crossbars on the whiskers, crossbars are 50% of full width
11698 plot 'stat.dat' using 1:3:2:6:5 with candlesticks whiskerbars 0.5
11703 See @ref{boxwidth}, @ref{bars} and `set style fill`.
11708 @noindent --- DOTS ---
11710 @c ?commands set style dots
11712 @c ?plotting styles dots
11716 The `dots` style plots a tiny dot at each point; this is useful for scatter
11717 plots with many points. For some terminals (post, pdf) the size of the dot can
11718 be controlled by changing the linewidth.
11721 @noindent --- FILLEDCURVES ---
11723 @c ?commands set style filledcurves
11724 @c ?set style filledcurves
11725 @c ?plotting styles filledcurves
11726 @c ?style filledcurves
11727 @cindex filledcurves
11729 The `filledcurves` style is only relevant to 2-d plotting. Three variants
11730 are possible. The first two variants require either a function or two columns
11731 of input data, and may be further modified by the options listed below.
11732 The first variant, `closed`, treats the curve itself as a closed polygon.
11733 This is the default if there are two columns of input data.
11735 The second variant is to fill the area between the curve and a given axis,
11736 a horizontal or vertical line, or a point.
11738 The third variant requires three columns of input data: the x coordinate and
11739 two y coordinates corresponding to two curves sampled at the same set of
11740 x coordinates; the area between the two curves is filled.
11741 This is the default if there are three or more columns of input data.
11746 set style [data | function] filledcurves [option]
11747 plot ... with filledcurves [option]
11751 where the option can be
11754 [closed | @{above | below@} @{x1 | x2 | y1 | y2@}[=<a>] | xy=<x>,<y>]
11758 The first two plot variants can be further modified by the options
11761 filledcurves closed ... just filled closed curve,
11762 filledcurves x1 ... x1 axis,
11763 filledcurves x2 ... x2 axis, etc for y1 and y2 axes,
11764 filledcurves y1=0 ... line y=0 (at y1 axis) ie parallel to x1 axis,
11765 filledcurves y2=42 ... line y=42 (at y2 axis) ie parallel to x2, etc,
11766 filledcurves xy=10,20 ... point 10,20 of x1,y1 axes (arc-like shape).
11770 Example of filling the area between two input curves.
11771 @uref{http://www.gnuplot.info/demo/fillbetween.html,fill between curves demo.
11775 plot 'data' using 1:2:3 with filledcurves
11779 The `above` and `below` options apply both to commands of the form
11781 ... filledcurves above @{x1|x2|y1|y2@}=<val>
11784 and to commands of the form
11786 ... using 1:2:3 with filledcurves below
11789 In either case the option limits the filled area to one side of the bounding
11792 Note: Not all terminal types support this plotting mode.
11794 Zoom of a filled curve drawn from a datafile may produce empty or incorrect
11795 area because gnuplot is clipping points and lines, and not areas.
11797 If the values of <a>, <x>, <y> are out of the drawing boundary, then they
11798 are moved to the graph boundary. Then the actually filled area in the case
11799 of option xy=<x>,<y> will depend on xrange and yrange.
11802 @noindent --- FINANCEBARS ---
11804 @c ?commands set style financebars
11805 @c ?set style financebars
11806 @c ?plotting styles financebars
11807 @c ?style financebars
11808 @cindex financebars
11810 The `financebars` style is only relevant for 2-d data plotting of financial
11811 data. Five columns of data are required; in order, these should be the x
11812 coordinate (most likely a date) and the opening, low, high, and closing
11813 prices. The symbol is a vertical line segment, located horizontally at the x
11814 coordinate and limited vertically by the high and low prices. A horizontal
11815 tic on the left marks the opening price and one on the right marks the
11816 closing price. The length of these tics may be changed by @ref{bars}. The
11817 symbol will be unchanged if the high and low prices are interchanged.
11818 See @ref{bars} and `candlesticks`, and also the
11819 @uref{http://www.gnuplot.info/demo/finance.html,finance demo.
11823 @noindent --- FSTEPS ---
11825 @c ?commands set style fsteps
11826 @c ?set style fsteps
11827 @c ?plotting styles fsteps
11831 The `fsteps` style is only relevant to 2-d plotting. It connects consecutive
11832 points with two line segments: the first from (x1,y1) to (x1,y2) and the
11833 second from (x1,y2) to (x2,y2).
11835 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
11839 @noindent --- HISTEPS ---
11841 @c ?commands set style histeps
11842 @c ?set style histeps
11843 @c ?plotting styles histeps
11847 The `histeps` style is only relevant to 2-d plotting. It is intended for
11848 plotting histograms. Y-values are assumed to be centered at the x-values;
11849 the point at x1 is represented as a horizontal line from ((x0+x1)/2,y1) to
11850 ((x1+x2)/2,y1). The lines representing the end points are extended so that
11851 the step is centered on at x. Adjacent points are connected by a vertical
11852 line at their average x, that is, from ((x1+x2)/2,y1) to ((x1+x2)/2,y2).
11854 If @ref{autoscale} is in effect, it selects the xrange from the data rather than
11855 the steps, so the end points will appear only half as wide as the others.
11857 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
11860 `histeps` is only a plotting style; `gnuplot` does not have the ability to
11861 create bins and determine their population from some data set.
11864 @noindent --- HISTOGRAMS ---
11866 @c ?commands set style histogram
11867 @c ?set style histogram
11868 @c ?style histograms
11869 @c ?plotting styles histograms
11872 The `histograms` style is only relevant to 2-d plotting. It produces a bar
11873 chart from a sequence of data columns in parallel. Each element of the
11874 `plot` command must specify a single input data source (e.g. one column of
11875 the input file), possibly with associated tic values or key titles.
11876 Four styles of histogram layout are currently supported.
11879 set style histogram clustered @{gap <gapsize>@}
11880 set style histogram errorbars @{gap <gapsize>@} @{<linewidth>@}
11881 set style histogram rowstacked
11882 set style histogram columnstacked
11886 The default style corresponds to `set style histogram clustered gap 2`.
11887 In this style, each set of parallel data values is collected into a group of
11888 boxes clustered at the x-axis coordinate corresponding to their sequential
11889 position (row #) in the selected datafile columns. Thus if <n> datacolumns are
11890 selected, the first cluster is centered about x=1, and contains <n> boxes whose
11891 heights are taken from the first entry in the corresponding <n> data columns.
11892 This is followed by a gap and then a second cluster of boxes centered about x=2
11893 corresponding to the second entry in the respective data columns, and so on.
11894 The default gap width of 2 indicates that the empty space between clusters is
11895 equivalent to the width of 2 boxes. All boxes derived from any one column
11896 are given the same fill color and/or pattern (see `set style fill`).
11898 Each cluster of boxes is derived from a single row of the input data file.
11899 It is common in such input files that the first element of each row is a
11900 label. Labels from this column may be placed along the x-axis underneath
11901 the appropriate cluster of boxes with the `xticlabels` option to @ref{using}.
11903 The @ref{errorbars} style is very similar to the `clustered` style, except that
11904 it requires two columns of input for each entry. The first column is treated
11905 as the height (y-value) of that box, exactly as for the `clustered` style.
11906 The second column is treated as an error magnitude, and used to generate a
11907 vertical error bar at the top of the box. The appearance of the error bar is
11908 controlled by the current value of @ref{bars} and by the optional <linewidth>
11911 Two styles of stacked histogram are supported, chosen by the command
11912 `set style histogram @{rowstacked|columnstacked@}`. In these styles the data
11913 values from the selected columns are collected into stacks of boxes.
11914 Positive values stack upwards from y=0; negative values stack downwards.
11915 Mixed positive and negative values will produce both an upward stack and a
11916 downward stack. The default stacking mode is `rowstacked`.
11918 The `rowstacked` style places a box resting on the x-axis for each
11919 data value in the first selected column; the first data value results in
11920 a box a x=1, the second at x=2, and so on. Boxes corresponding to the
11921 second and subsequent data columns are layered on top of these, resulting
11922 in a stack of boxes at x=1 representing the first data value from each
11923 column, a stack of boxes at x=2 representing the second data value from
11924 each column, and so on. All boxes derived from any one column are given the
11925 same fill color and/or pattern (see `set style fill`).
11927 The `columnstacked` style is similar, except that each stack of boxes is
11928 built up from a single data column. Each data value from the first specified
11929 column yields a box in the stack at x=1, each data value from the second
11930 specified column yields a box in the stack at x=2, and so on. In this style
11931 the color of each box is taken from the row number, rather than the column
11932 number, of the corresponding data field.
11934 Box widths may be modified using the @ref{boxwidth} command.
11935 Box fill styles may be set using the `set style fill` command.
11937 Histograms always use the x1 axis, but may use either y1 or y2.
11938 If a plot contains both histograms and other plot styles, the non-histogram
11939 plot elements may use either the x1 or the x2 axis.
11943 To plot a data file containing multiple columns of data as a histogram
11944 of clustered boxes (the default style):
11947 set boxwidth 0.9 relative
11948 set style data histograms
11949 set style fill solid 1.0 border -1
11950 plot 'file.dat' using 2, '' using 4, '' using 6
11954 This will produce a plot with clusters of three boxes (vertical bars) centered
11955 at each integral value on the x axis. If the first column of the input file
11956 contains labels, they may be placed along the x-axis using the variant command
11959 plot 'file.dat' using 2, '' using 4, '' using 6:xticlabels(1)
11963 If the file contains both a magnitude and an error estimate for each value,
11964 then error bars can be added to the plot. The following commands will add
11965 error bars extending from (y-<error>) to (y+<error>), capped by horizontal bar
11966 ends drawn the same width as the box itself. The error bars and bar ends are
11967 drawn with linewidth 2 using the border linetype from the current fill style.
11971 set style fill solid border -1
11972 set style histogram errorbars gap 2 lw 2
11973 plot 'file.dat' using 2:3, '' using 4:5, '' using 6:7:xticlabels(1)
11977 To plot the same data as a rowstacked histogram:
11980 set style histogram rows
11981 plot 'file.dat' using 2, '' using 4, '' using 6:xtic(1)
11985 This will produce a plot in which each vertical bar contains a stack of three
11986 segments, corresponding in height to the values found in columns 2, 4 and 6
11989 Finally, the commands
11992 set style histogram columnstacked
11993 plot 'file.dat' using 2, '' using 4, '' using 6
11997 will produce three vertical stacks. The stack at x=1 will contain a box for
11998 each entry in column 2 of the datafile. The stack at x=2 will contain a box
11999 for each parallel entry in column 4 of the datafile, and the stack at x=3 a
12000 box for each entry of column 6. Because this interchanges gnuplot's usual
12001 interpretation of input rows and columns, the specification of key titles and
12002 x-axis tic labels must also be modified.
12005 set style histogram columnstacked
12006 plot '' u 5:key(1) # uses first column to generate key titles
12007 plot '' u 5 title columnhead # uses first row to generate xtic labels
12012 @noindent --- NEWHISTOGRAM ---
12014 @cindex newhistogram
12016 @c ?histograms newhistogram
12017 More than one set of histograms can appear in a single plot. In this case you
12018 can force a gap between them, and a separate label for each set, by using the
12019 plot command `newhistogram @{"<title>"@} @{<linetype>@} @{at <x-coord>@}`.
12023 set style histogram cluster
12024 plot newhistogram "Set A", 'a' using 1, '' using 2, '' using 3, \
12025 newhistogram "Set B", 'b' using 1, '' using 2, '' using 3
12029 The labels "Set A" and "Set B" will appear beneath the respective sets of
12030 histograms, under the overall x axis label.
12032 The newhistogram command can also be used to force histogram coloring to
12033 begin with a specific color (linetype). By default colors will continue to
12034 increment successively even across histogram boundaries. Here is an example
12035 using the same coloring for multiple histograms
12037 plot newhistogram "Set A" lt 4, 'a' using 1, '' using 2, '' using 3, \
12038 newhistogram "Set B" lt 4, 'b' using 1, '' using 2, '' using 3
12042 The `at <x-coord>` option only applies to column-stacked histograms.
12045 @noindent --- IMAGE ---
12047 @c ?commands set style image
12048 @c ?set style image
12049 @c ?plotting styles image
12053 The `image` style is intendend for plotting 2D images. It may be used for
12054 both `plot` and `splot` in the form of 3D data (x,y,value) or projected 4D
12055 data (x,y,z,value), respectively. It is assumed that in the viewing plane
12056 the image data forms an equidistant sampling grid in the viewing plane along
12057 two, not necessarily orthogonal, directions. In other words, groups of
12058 four adjacent points are assumed to form the same size parallelogram. The
12059 variable `value` in the tuples represent a palette color (gray value) for
12060 indexing in the current palette.
12062 The `image` style will attempt to create a properly positioned and scaled
12063 data matrix to match the plot borders for those terminals supporting palettes
12064 and images. Such output is efficient and draws quickly. However, when a
12065 terminal driver does not support palettes and images, or when image support
12066 is not implemented, the `image` style reverts to drawing filled rectangular
12067 boxes for pixels, which is not as efficient. General parallelogram-shaped
12068 images currently always have filled parallelograms for pixels.
12070 The coordinate of each data point of an image will lie at the center of a
12071 pixel. That is, an M x N set of data will form an image with M x N pixels.
12072 This is slightly different than pm3d elements where an M x N set of data
12073 will form a surface of (M-1) x (N-1) elements. The scan directions for the
12074 image data grid can be any of eight possible combinations.
12076 Here are some specific comments about particular terminal drivers:
12078 x11 and wxt - Pixels are either repeated or decimated to fit the display
12080 resolution; no other processing (filtering) is done. Thus, aliasing may
12081 occur when decimating images having high spatial frequency content.
12085 postscript (pslatex, epslatex, pstex) - Image is copied in its original
12087 resolution, and sample interpolation is turned off.
12091 See also `rgbimage`.
12094 @noindent --- IMPULSES ---
12096 @c ?commands set style impulses
12097 @c ?set style impulses
12098 @c ?plotting styles impulses
12102 The `impulses` style displays a vertical line from the x axis (not the graph
12103 border), or from the grid base for `splot`, to each point.
12106 @noindent --- LABELS ---
12108 @c ?commands set style labels
12109 @c ?set style labels
12110 @c ?plotting styles labels
12114 The `labels` style is available only if gnuplot is built with configuration
12115 option --enable-datastrings. For a 2-D plot with labels you must specify
12116 3 input data columns; the text string found in the third column is printed at
12117 the X and Y coordinates generated by the first two column specifiers. The
12118 font, color, rotation angle and other properties of the printed text may be
12119 specified as additional command options (see @ref{label}). The example below
12120 will generate a 2-D plot with text labels taken from column 4 of the input
12121 file (`tc lt 2` is shorthand for `textcolor linetype 2`, which is green).
12124 plot 'datafile' using 1:(0.5 * $2):4 with labels font "arial,11" tc lt 2
12128 The `labels` style can also be used in 3-D plots. In this case four input
12129 column specifiers are required, corresponding to X Y Z and text.
12132 splot 'datafile' using 1:2:3:4 with labels
12136 See also `datastrings`, `set style data`.
12139 @noindent --- LINES ---
12141 @c ?commands set style lines
12142 @c ?set style lines
12143 @c ?plotting styles lines
12147 The `lines` style connects adjacent points with straight line segments.
12148 See also `linetype`, `linewidth`, and `linestyle`.
12151 @noindent --- LINESPOINTS ---
12153 @c ?commands set style linespoints
12154 @c ?commands set style lp
12155 @c ?set style linespoints
12156 @c ?plotting styles linespoints
12158 @c ?style linespoints
12160 @cindex linespoints
12164 The `linespoints` style does both `lines` and `points`, that is, it draws a
12165 small symbol at each point and then connects adjacent points with straight
12166 line segments. The command @ref{pointsize} may be used to change the size of
12167 the points. See @ref{pointsize} for its usage.
12169 `linespoints` may be abbreviated `lp`.
12172 @noindent --- POINTS ---
12174 @c ?commands set style points
12175 @c ?set style points
12176 @c ?plotting styles points
12180 The `points` style displays a small symbol at each point. The command @ref{pointsize} may be used to change the size of the points. See @ref{pointsize}
12184 @noindent --- STEPS ---
12186 @c ?commands set style steps
12187 @c ?set style steps
12188 @c ?plotting styles steps
12192 The `steps` style is only relevant to 2-d plotting. It connects consecutive
12193 points with two line segments: the first from (x1,y1) to (x2,y1) and the
12194 second from (x2,y1) to (x2,y2).
12196 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
12200 @noindent --- RGBIMAGE ---
12202 @c ?commands set style rgbimage
12203 @c ?set style rgbimage
12204 @c ?plotting styles rgbimage
12208 The `rgbimage` style is intended for plotting 2D images and is similar
12209 in concept to `image`. See `image` for details. The difference is
12210 that 5D data (x,y,r,g,b) for `plot` and 6D data (x,y,z,r,g,b) for `splot`
12211 describe the coordinates and color components of an image.
12216 @noindent --- VECTORS ---
12218 @c ?commands set style vectors
12219 @c ?set style vectors
12220 @c ?plotting styles vectors
12224 The 2D `vectors` style draws a vector from (x,y) to (x+xdelta,y+ydelta).
12225 Thus it requires four columns of data. It also draws a small arrowhead at the
12227 The 3D `vectors` style is similar, but requires six columns of data.
12228 splot with vectors is supported only for `set mapping cartesian`.
12229 The keywords "with vectors" may be followed by arrow style specifications.
12230 See `arrowstyle` for more details.
12234 plot 'file.dat' using 1:2:3:4 with vectors head filled lt 2
12235 splot 'file.dat' using 1:2:3:(1):(1):(1) with vectors filled head lw 2
12239 `set clip one` and `set clip two` affect vectors drawn in 2D.
12240 Please see @ref{clip} and `arrowstyle`.
12243 @noindent --- XERRORBARS ---
12245 @c ?commands set style xerrorbars
12246 @c ?set style xerrorbars
12247 @c ?plotting styles xerrorbars
12248 @c ?style xerrorbars
12251 The `xerrorbars` style is only relevant to 2-d data plots. `xerrorbars` is
12252 like `dots`, except that a horizontal error bar is also drawn. At each point
12253 (x,y), a line is drawn from (xlow,y) to (xhigh,y) or from (x-xdelta,y) to
12254 (x+xdelta,y), depending on how many data columns are provided. A tic mark
12255 is placed at the ends of the error bar (unless @ref{bars} is used---see
12256 @ref{bars} for details).
12259 @noindent --- XYERRORBARS ---
12261 @c ?commands set style xyerrorbars
12262 @c ?set style xyerrorbars
12263 @c ?plotting styles xyerrorbars
12264 @c ?style xyerrorbars
12265 @cindex xyerrorbars
12267 The `xyerrorbars` style is only relevant to 2-d data plots. `xyerrorbars` is
12268 like `dots`, except that horizontal and vertical error bars are also drawn.
12269 At each point (x,y), lines are drawn from (x,y-ydelta) to (x,y+ydelta) and
12270 from (x-xdelta,y) to (x+xdelta,y) or from (x,ylow) to (x,yhigh) and from
12271 (xlow,y) to (xhigh,y), depending upon the number of data columns provided. A
12272 tic mark is placed at the ends of the error bar (unless @ref{bars} is
12273 used---see @ref{bars} for details).
12275 If data are provided in an unsupported mixed form, the @ref{using} filter on the
12276 `plot` command should be used to set up the appropriate form. For example,
12277 if the data are of the form (x,y,xdelta,ylow,yhigh), then you can use
12280 plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars
12285 @noindent --- YERRORBARS ---
12287 @c ?commands set style yerrorbars
12288 @c ?commands set style errorbars
12289 @c ?plotting styles yerrorbars
12290 @c ?plotting styles errorbars
12291 @c ?set style yerrorbars
12292 @c ?set style errorbars
12293 @c ?style yerrorbars
12294 @c ?style errorbars
12297 The `yerrorbars` (or @ref{errorbars}) style is only relevant to 2-d data plots.
12298 `yerrorbars` is like `points`, except that a vertical error bar is also drawn.
12299 At each point (x,y), a line is drawn from (x,y-ydelta) to (x,y+ydelta) or
12300 from (x,ylow) to (x,yhigh), depending on how many data columns are provided.
12301 A tic mark is placed at the ends of the error bar (unless @ref{bars} is
12302 used---see @ref{bars} for details).
12304 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
12308 @noindent --- XERRORLINES ---
12310 @c ?commands set style xerrorlines
12311 @c ?set style xerrorlines
12312 @c ?plotting styles xerrorlines
12313 @c ?style xerrorlines
12314 @cindex xerrorlines
12316 The `xerrorlines` style is only relevant to 2-d data plots.
12317 `xerrorlines` is like `linespoints`, except that a horizontal error
12318 line is also drawn. At each point (x,y), a line is drawn from (xlow,y)
12319 to (xhigh,y) or from (x-xdelta,y) to (x+xdelta,y), depending on how
12320 many data columns are provided. A tic mark is placed at the ends of
12321 the error bar (unless @ref{bars} is used---see @ref{bars} for details).
12324 @noindent --- XYERRORLINES ---
12326 @c ?commands set style xyerrorlines
12327 @c ?set style xyerrorlines
12328 @c ?plotting styles xyerrorlines
12329 @c ?style xyerrorlines
12330 @cindex xyerrorlines
12332 The `xyerrorlines` style is only relevant to 2-d data plots.
12333 `xyerrorlines` is like `linespoints`, except that horizontal and
12334 vertical error bars are also drawn. At each point (x,y), lines are
12335 drawn from (x,y-ydelta) to (x,y+ydelta) and from (x-xdelta,y) to
12336 (x+xdelta,y) or from (x,ylow) to (x,yhigh) and from (xlow,y) to
12337 (xhigh,y), depending upon the number of data columns provided. A tic
12338 mark is placed at the ends of the error bar (unless @ref{bars} is
12339 used---see @ref{bars} for details).
12341 If data are provided in an unsupported mixed form, the @ref{using} filter on the
12342 `plot` command should be used to set up the appropriate form. For example,
12343 if the data are of the form (x,y,xdelta,ylow,yhigh), then you can use
12346 plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorlines
12351 @noindent --- YERRORLINES ---
12353 @c ?commands set style yerrorlines
12354 @c ?commands set style errorlines
12355 @c ?plotting styles yerrorlines
12356 @c ?plotting styles errorlines
12357 @c ?set style yerrorlines
12358 @c ?set style errorlines
12359 @c ?style yerrorlines
12360 @c ?style errorlines
12361 @cindex yerrorlines
12363 The `yerrorlines` (or @ref{errorlines}) style is only relevant to 2-d data
12364 plots. `yerrorlines` is like `linespoints`, except that a vertical
12365 error line is also drawn. At each point (x,y), a line is drawn from
12366 (x,y-ydelta) to (x,y+ydelta) or from (x,ylow) to (x,yhigh), depending
12367 on how many data columns are provided. A tic mark is placed at the
12368 ends of the error bar (unless @ref{bars} is used---see @ref{bars} for
12371 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
12374 @node surface, table, style, set-show
12375 @subsection surface
12377 @c ?commands set surface
12378 @c ?commands unset surface
12379 @c ?commands show surface
12389 The command @ref{surface} controls the display of surfaces by `splot`.
12399 The surface is drawn with the style specified by @ref{with}, or else the
12400 appropriate style, data or function.
12402 Whenever @ref{surface} is issued, `splot` will not draw points or lines
12403 corresponding to the function or data file points. Contours may still be
12404 drawn on the surface, depending on the @ref{contour} option. `unset surface;
12405 set contour base` is useful for displaying contours on the grid base. See
12406 also @ref{contour}.
12408 @node table, terminal, surface, set-show
12411 @c ?commands set table
12417 When @ref{table} mode is enabled, `plot` and `splot` commands print out a
12418 multicolumn ASCII table of X Y @{Z@} R values rather than creating an actual
12419 plot on the current terminal. The character R takes on one of three values:
12420 "i" if the point is in the active range, "o" if it is out-of-range, or "u"
12421 if it is undefined. The data format is determined by the format of the axis
12422 labels (see `set format`), and the columns are separated by single spaces.
12423 This can be useful if you want to generate contours and then save them for
12424 further use, perhaps for plotting with `plot`; see @ref{contour} for example.
12425 The same method can be used to save interpolated data
12426 (see @ref{samples} and @ref{dgrid3d}).
12430 set table @{"outfile"@}
12436 Tabular output is written to the named file, if any, otherwise it is written
12437 to the current value of @ref{output}. You must explicitly @ref{table}
12438 in order to go back to normal plotting on the current terminal.
12440 @node terminal, termoption, table, set-show
12441 @subsection terminal
12443 @c ?commands set terminal
12444 @c ?commands show terminal
12449 @c ?set terminal push
12455 @c ?set terminal pop
12461 `gnuplot` supports many different graphics devices. Use @ref{terminal} to
12462 tell `gnuplot` what kind of output to generate. Use @ref{output} to redirect
12463 that output to a file or device.
12467 set terminal @{<terminal-type> | push | pop@}
12472 If <terminal-type> is omitted, `gnuplot` will list the available terminal
12473 types. <terminal-type> may be abbreviated.
12475 If both @ref{terminal} and @ref{output} are used together, it is safest to
12476 give @ref{terminal} first, because some terminals set a flag which is needed
12477 in some operating systems.
12479 Several terminals have many additional options. For example, see `png`,
12480 or @ref{postscript}.
12481 The options used by a previous invocation `set term <term> <options>` of a
12482 given `<term>` are remembered, thus subsequent `set term <term>` does
12483 not reset them. This helps in printing, for instance, when switching
12484 among different terminals---previous options don't have to be repeated.
12486 The command `set term push` remembers the current terminal including its
12487 settings while `set term pop` restores it. This is equivalent to `save term`
12488 and `load term`, but without accessing the filesystem. Therefore they can be
12489 used to achieve platform independent restoring of the terminal after printing,
12490 for instance. After gnuplot's startup, the default terminal or that from
12491 `startup` file is pushed automatically. Therefore portable scripts can rely
12492 that `set term pop` restores the default terminal on a given platform unless
12493 another terminal has been pushed explicitly.
12495 For a complete list of available terminal types, see @ref{terminal}.
12497 @node termoption, tics, terminal, set-show
12498 @subsection termoption
12500 @c ?commands set termoption
12503 @opindex termoption
12506 The @ref{termoption} command allows you to change the behaviour of the
12507 current terminal without requiring a new @ref{terminal} command. Only one
12508 option can be changed per command, and only a small number of options can
12509 be changed this way. Currently the only options accepted are
12512 set termoption @{no@}enhanced
12513 set termoption font "<fontname>@{,<fontsize>@}"
12518 @node tics, ticslevel, termoption, set-show
12521 @c ?commands set tics
12522 @c ?commands unset tics
12523 @c ?commands show tics
12531 Control of the major (labelled) tics on all axes at once is possible with the
12532 `set tics` command.
12534 Fine control of the major (labelled) tics on all axes at once is possible
12535 with the `set tics` command. The tics may be turned off with the `unset tics`
12536 command, and may be turned on (the default state) with `set tics`. Similar
12537 commands (by preceding 'tics' by the axis name) control the major tics on a
12542 set tics @{axis | border@} @{@{no@}mirror@}
12543 @{in | out@} @{scale @{default | <major> @{,<minor>@}@}@}
12544 @{@{no@}rotate @{by <ang>@}@} @{offset <offset> | nooffset@}
12545 @{ format "formatstring" @} @{ font "name@{,<size>@}" @}
12546 @{ textcolor <colorspec> @}
12547 set tics @{front | back@}
12553 The options in the first set above can be applied individually to
12554 any or all axes, i.e., x, y, z, x2, y2, and cb.
12556 Set tics `front` or `back` applies to all axes at once, but only for 2D plots
12557 (not splot). It controls whether the tics are placed behind or in front of
12558 the plot elements, in the case that there is overlap.
12560 `axis` or @ref{border} tells `gnuplot` to put the tics (both the tics themselves
12561 and the accompanying labels) along the axis or the border, respectively. If
12562 the axis is very close to the border, the `axis` option will move the
12563 tic labels to outside the border in case the border is printed (see
12564 @ref{border}). The relevant margin settings will usually be sized badly by
12565 the automatic layout algorithm in this case.
12567 `mirror` tells `gnuplot` to put unlabelled tics at the same positions on the
12568 opposite border. `nomirror` does what you think it does.
12570 `in` and `out` change the tic marks to be drawn inwards or outwards.
12572 With `scale`, the size of the tic marks can be adjusted. If <minor> is not
12573 specified, it is 0.5*<major>. The default size 1.0 for major tics and 0.5
12574 for minor tics is requested by `scale default`.
12576 `rotate` asks `gnuplot` to rotate the text through 90 degrees, which will be
12577 done if the terminal driver in use supports text rotation. `norotate`
12578 cancels this. `rotate by <ang>` asks for rotation by <ang> degrees, supported
12579 by some terminal types.
12581 The defaults are `border mirror norotate` for tics on the x and y axes, and
12582 `border nomirror norotate` for tics on the x2 and y2 axes. For the z axis,
12583 the default is `nomirror`.
12585 The <offset> is specified by either x,y or x,y,z, and may be preceded by
12586 `first`, `second`, `graph`, `screen`, or `character` to select the
12587 coordinate system. <offset> is the offset of the tics texts from their
12588 default positions, while the default coordinate system is `character`.
12589 See `coordinates` for details. `nooffset` switches off the offset.
12591 `set tics` with no options restores to place tics inwards. Every other
12592 options are retained.
12594 See also `set xtics` for more control of major (labelled) tic marks and
12595 @ref{mxtics} for control of minor tic marks. These commands provide control
12596 at a axis by axis basis.
12598 @node ticslevel, ticscale, tics, set-show
12599 @subsection ticslevel
12603 @node ticscale, timestamp, ticslevel, set-show
12604 @subsection ticscale
12606 @c ?commands set ticscale
12607 @c ?commands show ticscale
12614 The @ref{ticscale} command is deprecated, use `set tics scale` instead.
12616 @node timestamp, timefmt, ticscale, set-show
12617 @subsection timestamp
12619 @c ?commands set timestamp
12620 @c ?commands unset timestamp
12621 @c ?commands show timestamp
12623 @c ?unset timestamp
12629 @cindex notimestamp
12631 The command @ref{timestamp} places the time and date of the plot in the left
12636 set timestamp @{"<format>"@} @{top|bottom@} @{@{no@}rotate@}
12637 @{offset <xoff>@{,<yoff>@}@} @{font "<fontspec>"@}
12643 The format string allows you to choose the format used to write the date and
12644 time. Its default value is what asctime() uses: "%a %b %d %H:%M:%S %Y"
12645 (weekday, month name, day of the month, hours, minutes, seconds, four-digit
12646 year). With `top` or `bottom` you can place the timestamp at the top or
12647 bottom of the left margin (default: bottom). `rotate` lets you write the
12648 timestamp vertically, if your terminal supports vertical text. The constants
12649 <xoff> and <yoff> are offsets that let you adjust the position more finely.
12650 <font> is used to specify the font with which the time is to be written.
12652 The abbreviation `time` may be used in place of @ref{timestamp}.
12656 set timestamp "%d/%m/%y %H:%M" offset 80,-2 font "Helvetica"
12660 See @ref{timefmt} for more information about time format strings.
12662 @node timefmt, title_, timestamp, set-show
12663 @subsection timefmt
12665 @c ?commands set timefmt
12666 @c ?commands show timefmt
12673 This command applies to timeseries where data are composed of dates/times.
12674 It has no meaning unless the command `set xdata time` is given also.
12678 set timefmt "<format string>"
12683 The string argument tells `gnuplot` how to read timedata from the datafile.
12684 The valid formats are:
12689 %d day of the month, 1--31
12690 %m month of the year, 1--12
12693 %j day of the year, 1--365
12696 %s seconds since the Unix epoch (1970-01-01, 00:00 UTC)
12698 %b three-character abbreviation of the name of the month
12699 %B name of the month
12703 Any character is allowed in the string, but must match exactly. \t (tab) is
12704 recognized. Backslash-octals (\nnn) are converted to char. If there is no
12705 separating character between the time/date elements, then %d, %m, %y, %H, %M
12706 and %S read two digits each, %Y reads four digits and %j reads three digits.
12707 %b requires three characters, and %B requires as many as it needs.
12709 Spaces are treated slightly differently. A space in the string stands for
12710 zero or more whitespace characters in the file. That is, "%H %M" can be used
12711 to read "1220" and "12 20" as well as "12 20".
12713 Each set of non-blank characters in the timedata counts as one column in the
12714 `using n:n` specification. Thus `11:11 25/12/76 21.0` consists of three
12715 columns. To avoid confusion, `gnuplot` requires that you provide a complete
12716 @ref{using} specification if your file contains timedata.
12718 Since `gnuplot` cannot read non-numerical text, if the date format includes
12719 the day or month in words, the format string must exclude this text. But
12720 it can still be printed with the "%a", "%A", "%b", or "%B" specifier:
12721 see `set format` for more details about these and other options for printing
12722 timedata. (`gnuplot` will determine the proper month and weekday from the
12725 See also @ref{xdata} and `Time/date` for more information.
12729 set timefmt "%d/%m/%Y\t%H:%M"
12732 tells `gnuplot` to read date and time separated by tab. (But look closely at
12733 your data---what began as a tab may have been converted to spaces somewhere
12734 along the line; the format string must match what is actually in the file.)
12736 @uref{http://www.gnuplot.info/demo/timedat.html,time data demo.
12739 @node title_, tmargin, timefmt, set-show
12742 @c ?commands set title
12743 @c ?commands show title
12750 The @ref{title} command produces a plot title that is centered at the top of
12751 the plot. @ref{title} is a special case of @ref{label}.
12755 set title @{"<title-text>"@} @{offset <offset>@} @{font "<font>@{,<size>@}"@}
12756 @{@{textcolor | tc@} @{<colorspec> | default@}@} @{@{no@}enhanced@}
12761 If <offset> is specified by either x,y or x,y,z the title is moved by the
12762 given offset. It may be preceded by `first`, `second`, `graph`, `screen`,
12763 or `character` to select the coordinate system. See `coordinates` for
12764 details. By default, the `character` coordinate system is used. For
12765 example, "`set title offset 0,-1`" will change only the y offset of the
12766 title, moving the title down by roughly the height of one character. The
12767 size of a character depends on both the font and the terminal.
12769 <font> is used to specify the font with which the title is to be written;
12770 the units of the font <size> depend upon which terminal is used.
12772 `textcolor <colorspec>` changes the color of the text. <colorspec> can be a
12773 linetype, an rgb color, or a palette mapping. See help for @ref{colorspec} and
12776 `noenhanced` requests that the title not be processed by the enhanced text
12777 mode parser, even if enhanced text mode is currently active.
12779 @ref{title} with no parameters clears the title.
12781 See `syntax` for details about the processing of backslash sequences and
12782 the distinction between single- and double-quotes.
12784 @node tmargin, trange, title_, set-show
12785 @subsection tmargin
12787 @c ?commands set tmargin
12793 The command @ref{tmargin} sets the size of the top margin.
12794 Please see @ref{margin} for details.
12796 @node trange, urange, tmargin, set-show
12799 @c ?commands set trange
12800 @c ?commands show trange
12807 The @ref{trange} command sets the parametric range used to compute x and y
12808 values when in parametric or polar modes. Please see @ref{xrange} for
12811 @node urange, variables, trange, set-show
12814 @c ?commands set urange
12815 @c ?commands show urange
12822 The @ref{urange} and @ref{vrange} commands set the parametric ranges used
12823 to compute x, y, and z values when in `splot` parametric mode.
12824 Please see @ref{xrange} for details.
12826 @node variables, version, urange, set-show
12827 @subsection variables
12829 @c ?commands show variables
12831 The @ref{variables} command lists all user-defined variables and their
12836 show variables @{all@}
12840 With the optional keyword "all", also the @ref{variables} that
12841 begin with `GPVAL_` are listed.
12844 @node version, view, variables, set-show
12845 @subsection version
12848 The @ref{version} command lists the version of gnuplot being run, its last
12849 modification date, the copyright holders, and email addresses for the FAQ,
12850 the gnuplot-info mailing list, and reporting bugs--in short, the information
12851 listed on the screen when the program is invoked interactively.
12855 show version @{long@}
12859 When the `long` option is given, it also lists the operating system, the
12860 compilation options used when `gnuplot` was installed, the location of the
12861 help file, and (again) the useful email addresses.
12863 @node view, vrange, version, set-show
12866 @c ?commands set view
12867 @c ?commands show view
12870 @c ?set view @{no@}equal @{xy|xyz@}
12876 The @ref{view} command sets the viewing angle for `splot`s. It controls how
12877 the 3-d coordinates of the plot are mapped into the 2-d screen space. It
12878 provides controls for both rotation and scaling of the plotted data, but
12879 supports orthographic projections only. It supports both 3D projection or
12880 orthogonal 2D projection into a 2D plot-like map.
12884 set view <rot_x>@{,@{<rot_z>@}@{,@{<scale>@}@{,<scale_z>@}@}@}
12886 set view @{no@}equal_axes
12891 where <rot_x> and <rot_z> control the rotation angles (in degrees) in a
12892 virtual 3-d coordinate system aligned with the screen such that initially
12893 (that is, before the rotations are performed) the screen horizontal axis is
12894 x, screen vertical axis is y, and the axis perpendicular to the screen is z.
12895 The first rotation applied is <rot_x> around the x axis. The second rotation
12896 applied is <rot_z> around the new z axis.
12898 Command `set view map` is used to represent the drawing as a map. It can be
12899 used for @ref{contour} plots, or for color @ref{pm3d} maps. In the latter, take care
12900 that you properly use @ref{zrange} and @ref{cbrange} for input data point filtering
12901 and color range scaling, respectively.
12903 <rot_x> is bounded to the [0:180] range with a default of 60 degrees, while
12904 <rot_z> is bounded to the [0:360] range with a default of 30 degrees.
12905 <scale> controls the scaling of the entire `splot`, while <scale_z> scales
12906 the z axis only. Both scales default to 1.0.
12910 set view 60, 30, 1, 1
12915 The first sets all the four default values. The second changes only scale,
12918 The command `set view equal xy` forces the unit length of the x and y axes
12919 to be on the same scale, and chooses that scale so that the plot will fit on
12920 the page. The command `set view equal xyz` additionally sets the z axis
12921 scale to match the x and y axes; however there is no guarantee that the
12922 current z axis range will fit within the plot boundary.
12923 By default all three axes are scaled independently to fill the available area.
12925 See also @ref{ticslevel}.
12927 @node vrange, x2data, view, set-show
12930 @c ?commands set vrange
12931 @c ?commands show vrange
12938 The @ref{urange} and @ref{vrange} commands set the parametric ranges used
12939 to compute x, y, and z values when in `splot` parametric mode.
12940 Please see @ref{xrange} for details.
12942 @node x2data, x2dtics, vrange, set-show
12945 @c ?commands set x2data
12946 @c ?commands show x2data
12953 The @ref{x2data} command sets data on the x2 (top) axis to timeseries
12954 (dates/times). Please see @ref{xdata}.
12956 @node x2dtics, x2label, x2data, set-show
12957 @subsection x2dtics
12959 @c ?commands set x2dtics
12960 @c ?commands unset x2dtics
12961 @c ?commands show x2dtics
12971 The @ref{x2dtics} command changes tics on the x2 (top) axis to days of the
12972 week. Please see @ref{xdtics} for details.
12974 @node x2label, x2mtics, x2dtics, set-show
12975 @subsection x2label
12977 @c ?commands set x2label
12978 @c ?commands show x2label
12985 The @ref{x2label} command sets the label for the x2 (top) axis.
12986 Please see @ref{xlabel}.
12988 @node x2mtics, x2range, x2label, set-show
12989 @subsection x2mtics
12991 @c ?commands set x2mtics
12992 @c ?commands unset x2mtics
12993 @c ?commands show x2mtics
13003 The @ref{x2mtics} command changes tics on the x2 (top) axis to months of the
13004 year. Please see @ref{xmtics} for details.
13006 @node x2range, x2tics, x2mtics, set-show
13007 @subsection x2range
13009 @c ?commands set x2range
13010 @c ?commands show x2range
13017 The @ref{x2range} command sets the horizontal range that will be displayed on
13018 the x2 (top) axis. Please see @ref{xrange} for details.
13020 @node x2tics, x2zeroaxis, x2range, set-show
13023 @c ?commands set x2tics
13024 @c ?commands unset x2tics
13025 @c ?commands show x2tics
13035 The @ref{x2tics} command controls major (labelled) tics on the x2 (top) axis.
13036 Please see `set xtics` for details.
13038 @node x2zeroaxis, xdata, x2tics, set-show
13039 @subsection x2zeroaxis
13041 @c ?commands set x2zeroaxis
13042 @c ?commands unset x2zeroaxis
13043 @c ?commands show x2zeroaxis
13045 @c ?unset x2zeroaxis
13046 @c ?show x2zeroaxis
13048 @opindex x2zeroaxis
13051 @cindex nox2zeroaxis
13053 The @ref{x2zeroaxis} command draws a line at the origin of the x2 (top) axis
13054 (y2 = 0). For details, please see @ref{zeroaxis}.
13056 @node xdata, xdtics, x2zeroaxis, set-show
13059 @c ?commands set xdata
13060 @c ?commands show xdata
13067 This command sets the datatype on the x axis to time/date. A similar command
13068 does the same thing for each of the other axes.
13077 The same syntax applies to @ref{ydata}, @ref{zdata}, @ref{x2data}, @ref{y2data} and @ref{cbdata}.
13079 The `time` option signals that the datatype is indeed time/date. If the
13080 option is not specified, the datatype reverts to normal.
13082 See @ref{timefmt} to tell gnuplot how to read date or time data. The
13083 time/date is converted to seconds from start of the century. There is
13084 currently only one timefmt, which implies that all the time/date columns must
13085 conform to this format. Specification of ranges should be supplied as quoted
13086 strings according to this format to avoid interpretation of the time/date as
13089 The function 'strftime' (type "man strftime" on unix to look it up) is used
13090 to print tic-mark labels. `gnuplot` tries to figure out a reasonable format
13091 for this unless the `set format x "string"` has supplied something that does
13092 not look like a decimal format (more than one '%' or neither %f nor %g).
13094 See also `Time/date` for more information.
13096 @node xdtics, xlabel, xdata, set-show
13099 @c ?commands set xdtics
13100 @c ?commands unset xdtics
13101 @c ?commands show xdtics
13111 The @ref{xdtics} commands converts the x-axis tic marks to days of the week
13112 where 0=Sun and 6=Sat. Overflows are converted modulo 7 to dates. `set
13113 noxdtics` returns the labels to their default values. Similar commands do
13114 the same things for the other axes.
13124 The same syntax applies to @ref{ydtics}, @ref{zdtics}, @ref{x2dtics}, @ref{y2dtics} and
13127 See also the `set format` command.
13129 @node xlabel, xmtics, xdtics, set-show
13132 @c ?commands set xlabel
13133 @c ?commands show xlabel
13140 The @ref{xlabel} command sets the x axis label. Similar commands set labels
13145 set xlabel @{"<label>"@} @{offset <offset>@} @{font "<font>@{,<size>@}"@}
13146 @{@{textcolor | tc@} @{lt <line_type> | default@}@} @{@{no@}enhanced@}
13147 @{rotate by <degrees>@}
13152 The same syntax applies to @ref{x2label}, @ref{ylabel}, @ref{y2label}, @ref{zlabel} and
13155 If <offset> is specified by either x,y or x,y,z the label is moved by the
13156 given offset. It may be preceded by `first`, `second`, `graph`, `screen`,
13157 or `character` to select the coordinate system. See `coordinates` for
13158 details. By default, the `character` coordinate system is used. For
13159 example, "`set xlabel offset -1,0`" will change only the x offset of the
13160 title, moving the label roughly one character width to the left. The size
13161 of a character depends on both the font and the terminal.
13163 <font> is used to specify the font in which the label is written; the units
13164 of the font <size> depend upon which terminal is used.
13166 `textcolor lt <n>` sets the text color to that of line type <n>.
13168 `noenhanced` requests that the label text not be processed by the enhanced text
13169 mode parser, even if enhanced text mode is currently active.
13171 To clear a label, put no options on the command line, e.g., "@ref{y2label}".
13173 The default positions of the axis labels are as follows:
13175 xlabel: The x-axis label is centered below the bottom axis.
13177 ylabel: The position of the y-axis label depends on the terminal, and can be
13178 one of the following three positions:
13180 1. Horizontal text flushed left at the top left of the plot. Terminals that
13181 cannot rotate text will probably use this method. If @ref{x2tics} is also
13182 in use, the ylabel may overwrite the left-most x2tic label. This may be
13183 remedied by adjusting the ylabel position or the left margin.
13185 2. Vertical text centered vertically at the left of the plot. Terminals
13186 that can rotate text will probably use this method.
13188 3. Horizontal text centered vertically at the left of the plot. The EEPIC,
13189 LaTeX and TPIC drivers use this method. The EEPIC driver will produce a
13190 stack of characters so as not to overwrite the plot. With other drivers
13191 (such as LaTeX and TPIC), the user probably has to insert line breaks
13192 using \\ to prevent the ylabel from overwriting the plot.
13194 zlabel: The z-axis label is centered along the z axis and placed in the space
13195 above the grid level.
13197 cblabel: The color box axis label is centered along the box and placed below
13198 or right according to horizontal or vertical color box gradient.
13200 y2label: The y2-axis label is placed to the right of the y2 axis. The
13201 position is terminal-dependent in the same manner as is the y-axis label.
13203 x2label: The x2-axis label is placed above the top axis but below the plot
13204 title. It is also possible to create an x2-axis label by using new-line
13205 characters to make a multi-line plot title, e.g.,
13208 set title "This is the title\n\nThis is the x2label"
13212 Note that double quotes must be used. The same font will be used for both
13215 The y and y2 axis labels can be explicitly rotated from their default
13216 orientation, but this applies only to 2D plots and only on terminals
13217 that support text rotation.
13219 If you are not satisfied with the default position of an axis label, use @ref{label} instead--that command gives you much more control over where text is
13222 Please see `syntax` for further information about backslash processing
13223 and the difference between single- and double-quoted strings.
13225 @node xmtics, xrange, xlabel, set-show
13228 @c ?commands set xmtics
13229 @c ?commands unset xmtics
13230 @c ?commands show xmtics
13240 The @ref{xmtics} command converts the x-axis tic marks to months of the
13241 year where 1=Jan and 12=Dec. Overflows are converted modulo 12 to months.
13242 The tics are returned to their default labels by @ref{xmtics}. Similar
13243 commands perform the same duties for the other axes.
13253 The same syntax applies to @ref{x2mtics}, @ref{ymtics}, @ref{y2mtics}, @ref{zmtics} and
13256 See also the `set format` command.
13258 @node xrange, xtics, xmtics, set-show
13261 @c ?commands set xrange
13262 @c ?commands show xrange
13273 The @ref{xrange} command sets the horizontal range that will be displayed.
13274 A similar command exists for each of the other axes, as well as for the
13275 polar radius r and the parametric variables t, u, and v.
13279 set xrange @{ [@{@{<min>@}:@{<max>@}@}] @{@{no@}reverse@} @{@{no@}writeback@} @}
13285 where <min> and <max> terms are constants, expressions or an asterisk to set
13286 autoscaling. If the data are time/date, you must give the range as a quoted
13287 string according to the @ref{timefmt} format. Any value omitted will not be
13290 The same syntax applies to @ref{yrange}, @ref{zrange}, @ref{x2range}, @ref{y2range}, @ref{cbrange},
13291 @ref{rrange}, @ref{trange}, @ref{urange} and @ref{vrange}.
13293 The `reverse` option reverses the direction of the axis, e.g., `set xrange
13294 [0:1] reverse` will produce an axis with 1 on the left and 0 on the right.
13295 This is identical to the axis produced by `set xrange [1:0]`, of course.
13296 `reverse` is intended primarily for use with @ref{autoscale}.
13298 The `writeback` option essentially saves the range found by @ref{autoscale} in
13299 the buffers that would be filled by @ref{xrange}. This is useful if you wish
13300 to plot several functions together but have the range determined by only
13301 some of them. The `writeback` operation is performed during the `plot`
13302 execution, so it must be specified before that command. To restore,
13303 the last saved horizontal range use `set xrange restore`. For example,
13306 set xrange [-10:10]
13307 set yrange [] writeback
13314 results in a yrange of [-1:1] as found only from the range of sin(x); the
13315 [-5:5] range of x/2 is ignored. Executing @ref{yrange} after each command
13316 in the above example should help you understand what is going on.
13318 In 2-d, @ref{xrange} and @ref{yrange} determine the extent of the axes, @ref{trange}
13319 determines the range of the parametric variable in parametric mode or the
13320 range of the angle in polar mode. Similarly in parametric 3-d, @ref{xrange},
13321 @ref{yrange}, and @ref{zrange} govern the axes and @ref{urange} and @ref{vrange} govern the
13322 parametric variables.
13324 In polar mode, @ref{rrange} determines the radial range plotted. <rmin> acts as
13325 an additive constant to the radius, whereas <rmax> acts as a clip to the
13326 radius---no point with radius greater than <rmax> will be plotted. @ref{xrange}
13327 and @ref{yrange} are affected---the ranges can be set as if the graph was of
13328 r(t)-rmin, with rmin added to all the labels.
13330 Any range may be partially or totally autoscaled, although it may not make
13331 sense to autoscale a parametric variable unless it is plotted with data.
13333 Ranges may also be specified on the `plot` command line. A range given on
13334 the plot line will be used for that single `plot` command; a range given by
13335 a `set` command will be used for all subsequent plots that do not specify
13336 their own ranges. The same holds true for `splot`.
13340 To set the xrange to the default:
13342 set xrange [-10:10]
13346 To set the yrange to increase downwards:
13348 set yrange [10:-10]
13352 To change zmax to 10 without affecting zmin (which may still be autoscaled):
13358 To autoscale xmin while leaving xmax unchanged:
13364 @node xtics, xyplane, xrange, set-show
13367 @c ?commands set xtics
13368 @c ?commands unset xtics
13369 @c ?commands show xtics
13379 Fine control of the major (labelled) tics on the x axis is possible with the
13380 `set xtics` command. The tics may be turned off with the `unset xtics`
13381 command, and may be turned on (the default state) with `set xtics`. Similar
13382 commands control the major tics on the y, z, x2 and y2 axes.
13386 set xtics @{axis | border@} @{@{no@}mirror@}
13387 @{in | out@} @{scale @{default | <major> @{,<minor>@}@}@}
13388 @{@{no@}rotate @{by <ang>@}@} @{offset <offset> | nooffset@}
13392 | <start>, <incr> @{,<end>@}
13393 | (@{"<label>"@} <pos> @{<level>@} @{,@{"<label>"@}...) @}
13394 @{ format "formatstring" @} @{ font "name@{,<size>@}" @}
13396 @{ textcolor <colorspec> @}
13402 The same syntax applies to @ref{ytics}, @ref{ztics}, @ref{x2tics}, @ref{y2tics} and @ref{cbtics}.
13404 `axis` or @ref{border} tells `gnuplot` to put the tics (both the tics themselves
13405 and the accompanying labels) along the axis or the border, respectively. If
13406 the axis is very close to the border, the `axis` option will move the
13407 tic labels to outside the border. The relevant margin settings will usually
13408 be sized badly by the automatic layout algorithm in this case.
13410 `mirror` tells `gnuplot` to put unlabelled tics at the same positions on the
13411 opposite border. `nomirror` does what you think it does.
13413 `in` and `out` change the tic marks to be drawn inwards or outwards.
13415 With `scale`, the size of the tic marks can be adjusted. If <minor> is not
13416 specified, it is 0.5*<major>. The default size 1.0 for major tics and 0.5
13417 for minor tics is requested by `scale default`.
13419 `rotate` asks `gnuplot` to rotate the text through 90 degrees, which will be
13420 done if the terminal driver in use supports text rotation. `norotate`
13421 cancels this. `rotate by <ang>` asks for rotation by <ang> degrees, supported
13422 by some terminal types.
13424 The defaults are `border mirror norotate` for tics on the x and y axes, and
13425 `border nomirror norotate` for tics on the x2 and y2 axes. For the z axis,
13426 the `@{axis | border@}` option is not available and the default is
13427 `nomirror`. If you do want to mirror the z-axis tics, you might want to
13428 create a bit more room for them with @ref{border}.
13430 The <offset> is specified by either x,y or x,y,z, and may be preceded by
13431 `first`, `second`, `graph`, `screen`, or `character` to select the
13432 coordinate system. <offset> is the offset of the tics texts from their
13433 default positions, while the default coordinate system is `character`.
13434 See `coordinates` for details. `nooffset` switches off the offset.
13438 Move xtics more closely to the plot.
13440 set xtics offset 0,graph 0.05
13444 `set xtics` with no options restores the default border or axis if xtics are
13445 being displayed; otherwise it has no effect. Any previously specified tic
13446 frequency or position @{and labels@} are retained.
13448 Positions of the tics are calculated automatically by default or if the
13449 `autofreq` option is given; otherwise they may be specified in either of
13452 The implicit <start>, <incr>, <end> form specifies that a series of tics will
13453 be plotted on the axis between the values <start> and <end> with an increment
13454 of <incr>. If <end> is not given, it is assumed to be infinity. The
13455 increment may be negative. If neither <start> nor <end> is given, <start> is
13456 assumed to be negative infinity, <end> is assumed to be positive infinity,
13457 and the tics will be drawn at integral multiples of <incr>. If the axis is
13458 logarithmic, the increment will be used as a multiplicative factor.
13460 If you specify to a negative <start> or <incr> after a numerical value
13461 (e.g., `rotate by <angle>` or `offset <offset>`), the parser fails because
13462 it subtracts <start> or <incr> from that value. As a workaround, specify
13463 `0-<start>` resp. `0-<incr>` in that case.
13467 set xtics border offset 0,0.5 -5,1,5
13470 Fails with 'invalid expression' at the last comma.
13472 set xtics border offset 0,0.5 0-5,1,5
13477 set xtics offset 0,0.5 border -5,1,5
13480 Sets tics at the border, tics text with an offset of 0,0.5 characters, and
13481 sets the start, increment, and end to -5, 1, and 5, as requested.
13483 The `set grid` options 'front', 'back' and 'layerdefault' affect the drawing
13484 order of the xtics, too.
13488 Make tics at 0, 0.5, 1, 1.5, ..., 9.5, 10.
13494 Make tics at ..., -10, -5, 0, 5, 10, ...
13500 Make tics at 1, 100, 1e4, 1e6, 1e8.
13502 set logscale x; set xtics 1,100,1e8
13506 The explicit ("<label>" <pos> <level>, ...) form allows arbitrary tic
13507 positions or non-numeric tic labels. In this form, the tics do not
13508 need to be listed in numerical order. Each tic has a
13509 position, optionally with a label. Note that the label is
13510 a string enclosed by quotes. It may be a constant string, such as
13511 "hello", may contain formatting information for converting the
13512 position into its label, such as "%3f clients", or may be empty, "".
13513 See `set format` for more information. If no string is given, the
13514 default label (numerical) is used.
13516 An explicit tic mark has a third parameter, the "level". The default
13517 is level 0, a major tic. A level of 1 generates a minor tic. If the
13518 level is specified, then the label must also be supplied.
13522 set xtics ("low" 0, "medium" 50, "high" 100)
13523 set xtics (1,2,4,8,16,32,64,128,256,512,1024)
13524 set ytics ("bottom" 0, "" 10, "top" 20)
13525 set ytics ("bottom" 0, "" 10 1, "top" 20)
13529 In the second example, all tics are labelled. In the third, only the end
13530 tics are labelled. In the fourth, the unlabeled tic is a minor tic.
13532 Normally if explicit tics are given, they are used instead of auto-generated
13533 tics. Conversely if you specify `set xtics auto` or the like it will erase
13534 any previously specified explicit tics. You can mix explicit and auto-
13535 generated tics by using the keyword `add`, which must appear before
13536 the tic style being added.
13541 set xtics add ("Pi" 3.14159)
13545 This will automatically generate tic marks every 0.5 along x, but will
13546 also add an explicit labeled tic mark at pi.
13548 However they are specified, tics will only be plotted when in range.
13550 Format (or omission) of the tic labels is controlled by `set format`, unless
13551 the explicit text of a label is included in the `set xtics ("<label>")` form.
13553 Minor (unlabelled) tics can be added automatically by the @ref{mxtics}
13554 command, or at explicit positions by the `set xtics ("" <pos> 1, ...)` form.
13557 * xtics_time_data::
13558 * xtics_rangelimited::
13561 @node xtics_time_data, xtics_rangelimited, xtics, xtics
13562 @subsubsection xtics time_data
13564 @c ?set xtics time_axis tics
13565 @c ?xtics time_axis tics
13567 In case of timeseries data, axis tic position values must be given as quoted
13568 dates or times according to the format @ref{timefmt}. If the <start>, <incr>, <end>
13569 form is used, <start> and <end> must be given according to @ref{timefmt}, but
13570 <incr> must be in seconds. Times will be written out according to the format
13571 given on `set format`, however.
13576 set timefmt "%d/%m"
13577 set xtics format "%b %d"
13578 set xrange ["01/12":"06/12"]
13579 set xtics "01/12", 172800, "05/12"
13585 set timefmt "%d/%m"
13586 set xtics format "%b %d"
13587 set xrange ["01/12":"06/12"]
13588 set xtics ("01/12", "" "03/12", "05/12")
13591 Both of these will produce tics "Dec 1", "Dec 3", and "Dec 5", but in the
13592 second example the tic at "Dec 3" will be unlabelled.
13594 @node xtics_rangelimited, , xtics_time_data, xtics
13595 @subsubsection xtics rangelimited
13597 @c ?set xtics rangelimited
13598 @c ?xtics rangelimited
13599 @cindex rangelimited
13601 @cindex range-frame
13603 This option limits both the auto-generated axis tic labels and the
13604 corresponding plot border to the range of values actually present in the data
13605 that has been plotted. Note that this is independent of the current range
13606 limits for the plot. For example, suppose that the data in "file.dat" all lies
13607 in the range 2 < y < 4. Then the following commands will create a plot for
13608 which the left-hand plot border (y axis) is drawn for only this portion of the
13609 total y range, and only the axis tics in this region are generated.
13610 I.e., the plot will be scaled to the full range on y, but there will be a gap
13611 between 0 and 2 on the left border and another gap between 4 and 10. This
13612 style is sometimes refered to as a `range-frame` graph.
13616 set ytics nomirror rangelimited
13621 @node xyplane, xzeroaxis, xtics, set-show
13622 @subsection xyplane
13624 @c ?commands set ticslevel
13625 @c ?commands show ticslevel
13632 @c ?commands set xyplane
13633 @c ?commands show xyplane
13640 The @ref{xyplane} command adjusts the position at which the xy plane is drawn
13641 in a 3D plot. The synonym "set ticslevel" is accepted for backwards
13646 set ticslevel <frac>
13648 set xyplane at <zvalue>
13653 The form `set ticslevel <frac>` places the xy plane below the range in Z, where
13654 the distance from the xy plane to Zmin is given as a fraction of the total
13655 range in z. The default value is 0.5. Negative values are permitted, but tic
13656 labels on the three axes may overlap.
13658 To place the xy-plane at a position 'pos' on the z-axis, @ref{ticslevel} may
13659 be set equal to (pos - zmin) / (zmin - zmax). However, this position will
13660 change if the z range is changed.
13662 The alternative form `set xyplane at <zvalue>` fixes the placement of the
13663 xy plane at a specific Z value regardless of the current z range. Thus to
13664 force the x, y, and z axes to meet at a common origin one would specify
13665 `set xyplane at 0`.
13667 See also @ref{view}, and @ref{zeroaxis}.
13669 @node xzeroaxis, y2data, xyplane, set-show
13670 @subsection xzeroaxis
13672 @c ?commands set xzeroaxis
13673 @c ?commands unset xzeroaxis
13674 @c ?commands show xzeroaxis
13676 @c ?unset xzeroaxis
13682 @cindex noxzeroaxis
13684 The @ref{xzeroaxis} command draws a line at y = 0. For details,
13685 please see @ref{zeroaxis}.
13687 @node y2data, y2dtics, xzeroaxis, set-show
13690 @c ?commands set y2data
13691 @c ?commands show y2data
13698 The @ref{y2data} command sets y2 (right-hand) axis data to timeseries
13699 (dates/times). Please see @ref{xdata}.
13701 @node y2dtics, y2label, y2data, set-show
13702 @subsection y2dtics
13704 @c ?commands set y2dtics
13705 @c ?commands unset y2dtics
13715 The @ref{y2dtics} command changes tics on the y2 (right-hand) axis to days of
13716 the week. Please see @ref{xdtics} for details.
13718 @node y2label, y2mtics, y2dtics, set-show
13719 @subsection y2label
13721 @c ?commands set y2label
13722 @c ?commands show y2label
13729 The @ref{y2label} command sets the label for the y2 (right-hand) axis.
13730 Please see @ref{xlabel}.
13732 @node y2mtics, y2range, y2label, set-show
13733 @subsection y2mtics
13735 @c ?commands set y2mtics
13736 @c ?commands unset y2mtics
13737 @c ?commands show y2mtics
13747 The @ref{y2mtics} command changes tics on the y2 (right-hand) axis to months
13748 of the year. Please see @ref{xmtics} for details.
13750 @node y2range, y2tics, y2mtics, set-show
13751 @subsection y2range
13753 @c ?commands set y2range
13754 @c ?commands show y2range
13761 The @ref{y2range} command sets the vertical range that will be displayed on
13762 the y2 (right-hand) axis. Please see @ref{xrange} for details.
13764 @node y2tics, y2zeroaxis, y2range, set-show
13767 @c ?commands set y2tics
13768 @c ?commands unset y2tics
13769 @c ?commands show y2tics
13779 The @ref{y2tics} command controls major (labelled) tics on the y2 (right-hand)
13780 axis. Please see `set xtics` for details.
13782 @node y2zeroaxis, ydata, y2tics, set-show
13783 @subsection y2zeroaxis
13785 @c ?commands set y2zeroaxis
13786 @c ?commands unset y2zeroaxis
13787 @c ?commands show y2zeroaxis
13789 @c ?unset y2zeroaxis
13790 @c ?show y2zeroaxis
13792 @opindex y2zeroaxis
13795 @cindex noy2zeroaxis
13797 The @ref{y2zeroaxis} command draws a line at the origin of the y2 (right-hand)
13798 axis (x2 = 0). For details, please see @ref{zeroaxis}.
13800 @node ydata, ydtics, y2zeroaxis, set-show
13803 @c ?commands set ydata
13804 @c ?commands show ydata
13811 The @ref{ydata} commands sets y-axis data to timeseries (dates/times).
13812 Please see @ref{xdata}.
13814 @node ydtics, ylabel, ydata, set-show
13817 @c ?commands set ydtics
13818 @c ?commands unset ydtics
13819 @c ?commands show ydtics
13829 The @ref{ydtics} command changes tics on the y axis to days of the week.
13830 Please see @ref{xdtics} for details.
13832 @node ylabel, ymtics, ydtics, set-show
13835 @c ?commands set ylabel
13836 @c ?commands show ylabel
13843 This command sets the label for the y axis. Please see @ref{xlabel}.
13845 @node ymtics, yrange, ylabel, set-show
13848 @c ?commands set ymtics
13849 @c ?commands unset ymtics
13850 @c ?commands show ymtics
13860 The @ref{ymtics} command changes tics on the y axis to months of the year.
13861 Please see @ref{xmtics} for details.
13863 @node yrange, ytics, ymtics, set-show
13866 @c ?commands set yrange
13867 @c ?commands show yrange
13874 The @ref{yrange} command sets the vertical range that will be displayed on
13875 the y axis. Please see @ref{xrange} for details.
13877 @node ytics, yzeroaxis, yrange, set-show
13880 @c ?commands set ytics
13881 @c ?commands unset ytics
13882 @c ?commands show ytics
13892 The @ref{ytics} command controls major (labelled) tics on the y axis.
13893 Please see `set xtics` for details.
13895 @node yzeroaxis, zdata, ytics, set-show
13896 @subsection yzeroaxis
13898 @c ?commands set yzeroaxis
13899 @c ?commands unset yzeroaxis
13900 @c ?commands show yzeroaxis
13902 @c ?unset yzeroaxis
13908 @cindex noyzeroaxis
13910 The @ref{yzeroaxis} command draws a line at x = 0. For details,
13911 please see @ref{zeroaxis}.
13913 @node zdata, zdtics, yzeroaxis, set-show
13916 @c ?commands set zdata
13917 @c ?commands show zdata
13924 The @ref{zdata} command sets zaxis data to timeseries (dates/times).
13925 Please see @ref{xdata}.
13927 @node zdtics, zzeroaxis, zdata, set-show
13930 @c ?commands set zdtics
13931 @c ?commands unset zdtics
13932 @c ?commands show zdtics
13942 The @ref{zdtics} command changes tics on the z axis to days of the week.
13943 Please see @ref{xdtics} for details.
13945 @node zzeroaxis, cbdata, zdtics, set-show
13946 @subsection zzeroaxis
13948 @c ?commands set zzeroaxis
13949 @c ?commands unset zzeroaxis
13950 @c ?commands show zzeroaxis
13952 @c ?unset zzeroaxis
13958 @cindex nozzeroaxis
13960 The @ref{zzeroaxis} command draws a line through (x=0,y=0). This has no effect
13961 on 2D plots, including splot with `set view map`. For details, please
13962 see @ref{zeroaxis} and @ref{xyplane}.
13964 @node cbdata, cbdtics, zzeroaxis, set-show
13967 @c ?commands set cbdata
13968 @c ?commands show cbdata
13975 Set color box axis data to timeseries (dates/times). Please see @ref{xdata}.
13977 @node cbdtics, zero, cbdata, set-show
13978 @subsection cbdtics
13980 @c ?commands set cbdtics
13981 @c ?commands unset cbdtics
13982 @c ?commands show cbdtics
13992 The @ref{cbdtics} command changes tics on the color box axis to days of the
13993 week. Please see @ref{xdtics} for details.
13995 @node zero, zeroaxis, cbdtics, set-show
13998 @c ?commands set zero
13999 @c ?commands show zero
14006 The `zero` value is the default threshold for values approaching 0.0.
14010 set zero <expression>
14015 `gnuplot` will not plot a point if its imaginary part is greater in magnitude
14016 than the `zero` threshold. This threshold is also used in various other
14017 parts of `gnuplot` as a (crude) numerical-error threshold. The default
14018 `zero` value is 1e-8. `zero` values larger than 1e-3 (the reciprocal of the
14019 number of pixels in a typical bitmap display) should probably be avoided, but
14020 it is not unreasonable to set `zero` to 0.0.
14022 @node zeroaxis, zlabel, zero, set-show
14023 @subsection zeroaxis
14025 @c ?commands set zeroaxis
14026 @c ?commands unset zeroaxis
14027 @c ?commands show zeroaxis
14035 The x axis may be drawn by @ref{xzeroaxis} and removed by @ref{xzeroaxis}.
14036 Similar commands behave similarly for the y, x2, y2, and z axes.
14040 set @{x|x2|y|y2|z@}zeroaxis @{ @{linestyle | ls <line_style>@}
14041 | @{ linetype | lt <line_type>@}
14042 @{ linewidth | lw <line_width>@}@}
14043 unset @{x|x2|y|y2|z@}zeroaxis
14044 show @{x|y|z@}zeroaxis
14049 By default, these options are off. The selected zero axis is drawn
14050 with a line of type <line_type> and width <line_width> (if supported
14051 by the terminal driver currently in use), or a user-defined style
14054 If no linetype is specified, any zero axes selected will be drawn
14055 using the axis linetype (linetype 0).
14057 @ref{zeroaxis} is equivalent to @ref{yzeroaxis}.
14058 Note that the z-axis must be set separately using @ref{zzeroaxis}.
14062 To simply have the y=0 axis drawn visibly:
14069 If you want a thick line in a different color or pattern, instead:
14072 set xzeroaxis linetype 3 linewidth 2.5
14076 @node zlabel, zmtics, zeroaxis, set-show
14079 @c ?commands set zlabel
14080 @c ?commands show zlabel
14087 This command sets the label for the z axis. Please see @ref{xlabel}.
14089 @node zmtics, zrange, zlabel, set-show
14092 @c ?commands set zmtics
14093 @c ?commands unset zmtics
14094 @c ?commands show zmtics
14104 The @ref{zmtics} command changes tics on the z axis to months of the year.
14105 Please see @ref{xmtics} for details.
14107 @node zrange, ztics, zmtics, set-show
14110 @c ?commands set zrange
14111 @c ?commands show zrange
14118 The @ref{zrange} command sets the range that will be displayed on the z axis.
14119 The zrange is used only by `splot` and is ignored by `plot`. Please see
14120 @ref{xrange} for details.
14122 @node ztics, cblabel, zrange, set-show
14125 @c ?commands set ztics
14126 @c ?commands unset ztics
14127 @c ?commands show ztics
14137 The @ref{ztics} command controls major (labelled) tics on the z axis.
14138 Please see `set xtics` for details.
14140 @node cblabel, cbmtics, ztics, set-show
14141 @subsection cblabel
14143 @c ?commands set cblabel
14144 @c ?commands show cblabel
14151 This command sets the label for the color box axis. Please see @ref{xlabel}.
14153 @node cbmtics, cbrange, cblabel, set-show
14154 @subsection cbmtics
14156 @c ?commands set cbmtics
14157 @c ?commands unset cbmtics
14158 @c ?commands show cbmtics
14168 The @ref{cbmtics} command changes tics on the color box axis to months of the
14169 year. Please see @ref{xmtics} for details.
14171 @node cbrange, cbtics, cbmtics, set-show
14172 @subsection cbrange
14174 @c ?commands set cbrange
14175 @c ?commands show cbrange
14182 The @ref{cbrange} command sets the range of values which are colored using
14183 the current @ref{palette} by styles @ref{pm3d}, `with image` and @ref{palette}.
14184 Values outside of the color range use color of the nearest extreme.
14186 If the cb-axis is autoscaled in `splot`, then the colorbox range is taken from
14187 @ref{zrange}. Points drawn in `splot ... pm3d|palette` can be filtered by using
14188 different @ref{zrange} and @ref{cbrange}.
14190 Please see @ref{xrange} for details on @ref{cbrange} syntax. See also
14191 @ref{palette} and `set colorbox`.
14193 @node cbtics, , cbrange, set-show
14196 @c ?commands set cbtics
14197 @c ?commands unset cbtics
14198 @c ?commands show cbtics
14208 The @ref{cbtics} command controls major (labelled) tics on the color box axis.
14209 Please see `set xtics` for details.
14211 @node shell, splot, set-show, Commands
14219 The @ref{shell} command spawns an interactive shell. To return to `gnuplot`,
14220 type `logout` if using VMS, @ref{exit} or the END-OF-FILE character if using
14221 Unix, `endcli` if using AmigaOS, or @ref{exit} if using MS-DOS or OS/2.
14223 There are two ways of spawning a shell command: using @ref{system} command
14224 or via `!` ($ if using VMS). The former command takes a string as a
14225 parameter and thus it can be used anywhere among other gnuplot commands,
14226 while the latter syntax requires to be the only command on the line. Control
14227 will return immediately to `gnuplot` after this command is executed. For
14228 example, in AmigaOS, MS-DOS or OS/2,
14241 prints a directory listing and then returns to `gnuplot`.
14244 Other examples of the former syntax:
14246 system "date"; set time; plot "a.dat"
14247 print=1; if (print) replot; set out; system "lpr x.ps"
14251 On an Atari, the `!` command first checks whether a shell is already loaded
14252 and uses it, if available. This is practical if `gnuplot` is run from
14253 `gulam`, for example.
14255 @node splot, system_, shell, Commands
14263 `splot` is the command for drawing 3-d plots (well, actually projections on
14264 a 2-d surface, but you knew that). It can create a plot from functions or
14265 a data file in a manner very similar to the `plot` command.
14267 See `plot` for features common to the `plot` command; only differences are
14268 discussed in detail here. Note specifically `plot`'s `axes` option is not
14269 available for `splot`.
14274 <function> | "<datafile>" @{datafile-modifiers@}@}
14275 @{<title-spec>@} @{with <style>@}
14276 @{, @{definitions,@} <function> ...@}
14280 where either a <function> or the name of a data file enclosed in quotes is
14281 supplied. The function can be a mathematical expression, or a triple of
14282 mathematical expressions in parametric mode.
14284 By default `splot` draws the xy plane completely below the plotted data.
14285 The offset between the lowest ztic and the xy plane can be changed by @ref{ticslevel}. The orientation of a `splot` projection is controlled by
14286 @ref{view}. See @ref{view} and @ref{ticslevel} for more information.
14288 The syntax for setting ranges on the `splot` command is the same as for
14289 `plot`. In non-parametric mode, the order in which ranges must be given is
14290 @ref{xrange}, @ref{yrange}, and @ref{zrange}. In parametric mode, the order is @ref{urange},
14291 @ref{vrange}, @ref{xrange}, @ref{yrange}, and @ref{zrange}.
14293 The @ref{title} option is the same as in `plot`. The operation of @ref{with} is also
14294 the same as in `plot`, except that the plotting styles available to `splot`
14295 are limited to `lines`, `points`, `linespoints`, `dots`, and `impulses`; the
14296 error-bar capabilities of `plot` are not available for `splot`.
14298 The @ref{datafile} options have more differences.
14300 See also `show plot`.
14308 @node data-file, grid_data, splot, splot
14309 @subsection data-file
14311 @c ?commands splot datafile
14313 @c ?splot data-file
14314 As for `plot`, discrete data contained in a file can be displayed by
14315 specifying the name of the data file, enclosed in quotes, on the `splot`
14320 splot '<file_name>' @{binary <binary list>@}
14322 @{index <index list>@}
14323 @{every <every list>@}
14324 @{using <using list>@}
14328 The special filenames `""` and `"-"` are permitted, as in `plot`.
14330 In brief, `binary` and `matrix` indicate that the data are in a special
14331 form, @ref{index} selects which data sets in a multi-data-set file are to be
14332 plotted, @ref{every} specifies which datalines (subsets) within a single data
14333 set are to be plotted, and @ref{using} determines how the columns within a single
14334 record are to be interpreted.
14336 The options @ref{index} and @ref{every} behave the same way as with `plot`; @ref{using}
14337 does so also, except that the @ref{using} list must provide three entries
14340 The `plot` options @ref{thru} and @ref{smooth} are not available for `splot`, but
14341 @ref{cntrparam} and @ref{dgrid3d} provide limited smoothing capabilities.
14343 Data file organization is essentially the same as for `plot`, except that
14344 each point is an (x,y,z) triple. If only a single value is provided, it
14345 will be used for z, the datablock number will be used for y, and the index
14346 of the data point in the datablock will be used for x. If two or four values
14347 are provided, `gnuplot` uses the last value for calculating the color in
14348 pm3d plots. Three values are interpreted as an (x,y,z) triple. Additional
14349 values are generally used as errors, which can be used by @ref{fit}.
14351 Single blank records separate datablocks in a `splot` datafile; `splot`
14352 treats datablocks as the equivalent of function y-isolines. No line will
14353 join points separated by a blank record. If all datablocks contain the same
14354 number of points, `gnuplot` will draw cross-isolines between datablocks,
14355 connecting corresponding points. This is termed "grid data", and is required
14356 for drawing a surface, for contouring (@ref{contour}) and hidden-line removal
14357 (@ref{hidden3d}). See also `splot grid_data`.
14359 It is no longer necessary to specify `parametric` mode for three-column
14364 * example_datafile_::
14369 @node binary_matrix, example_datafile_, data-file, data-file
14370 @subsubsection binary matrix
14372 @c ?commands plot datafile binary matrix
14373 @c ?commands splot datafile binary matrix
14374 @c ?plot datafile matrix binary
14375 @c ?splot datafile matrix binary
14376 @c ?plot binary matrix
14377 @c ?splot binary matrix
14378 @c ?plot matrix binary
14379 @c ?splot matrix binary
14384 Gnuplot can read matrix binary files by use of the option `binary` appearing
14385 without keyword qualifications unique to general binary, i.e., `array`,
14386 `record`, `format`, or `filetype`. Other general binary keywords for
14387 translation should also apply to matrix binary. (See `binary general` for
14390 In previous versions, `gnuplot` dynamically detected binary data files. It
14391 is now necessary to specify the keyword `binary` directly after the filename.
14393 Single precision floats are stored in a binary file as follows:
14396 <N+1> <y0> <y1> <y2> ... <yN>
14397 <x0> <z0,0> <z0,1> <z0,2> ... <z0,N>
14398 <x1> <z1,0> <z1,1> <z1,2> ... <z1,N>
14403 which are converted into triplets:
14420 These triplets are then converted into `gnuplot` iso-curves and then
14421 `gnuplot` proceeds in the usual manner to do the rest of the plotting.
14423 A collection of matrix and vector manipulation routines (in C) is provided
14424 in `binary.c`. The routine to write binary data is
14427 int fwrite_matrix(file,m,nrl,nrl,ncl,nch,row_title,column_title)
14431 An example of using these routines is provided in the file `bf_test.c`, which
14432 generates binary files for the demo file `demo/binary.dem`.
14434 The @ref{index} keyword is not supported, since the file format allows only one
14435 surface per file. The @ref{every} and @ref{using} filters are supported. @ref{using}
14436 operates as if the data were read in the above triplet form.
14438 See also `binary general` and
14440 @uref{http://www.gnuplot.info/demo/binary.html,Binary File Splot Demo.
14443 @node example_datafile_, matrix_ascii, binary_matrix, data-file
14444 @subsubsection example datafile
14446 @c ?commands splot datafile example
14447 @c ?splot datafile example
14449 A simple example of plotting a 3-d data file is
14452 splot 'datafile.dat'
14456 where the file "datafile.dat" might contain:
14459 # The valley of the Gnu.
14487 Note that "datafile.dat" defines a 4 by 3 grid ( 4 rows of 3 points each ).
14488 Rows (datablocks) are separated by blank records.
14490 @c ^ <img align=bottom src="http://www.gnuplot.info/doc/splot.gif" alt="[splot.gif]" width=640 height=480>
14491 Note also that the x value is held constant within each dataline. If you
14492 instead keep y constant, and plot with hidden-line removal enabled, you will
14493 find that the surface is drawn 'inside-out'.
14495 Actually for grid data it is not necessary to keep the x values constant
14496 within a datablock, nor is it necessary to keep the same sequence of y
14497 values. `gnuplot` requires only that the number of points be the same for
14498 each datablock. However since the surface mesh, from which contours are
14499 derived, connects sequentially corresponding points, the effect of an
14500 irregular grid on a surface plot is unpredictable and should be examined
14501 on a case-by-case basis.
14503 @node matrix_ascii, matrix, example_datafile_, data-file
14504 @subsubsection matrix_ascii
14506 @c ?commands plot datafile matrix ascii
14507 @c ?commands splot datafile matrix ascii
14508 @c ?plot datafile matrix ascii
14509 @c ?splot datafile matrix ascii
14510 @c ?plot matrix ascii
14511 @c ?splot matrix ascii
14512 @c ?data-file matrix ascii
14513 @c ?datafile matrix ascii
14515 The `matrix` keyword (without a sequent `binary` keyword) in
14517 @{s@}plot 'a.dat' matrix
14520 indicates that data are stored in an ascii numbers matrix format.
14522 The z-values are read in a row at a time, i. e.,
14524 z11 z12 z13 z14 ...
14525 z21 z22 z23 z24 ...
14526 z31 z32 z33 z34 ...
14531 In 3D, the x- and y-indices of the matrix surface plot correspond to column
14532 and row indices of the matrix, respectively, being enumerated from 0. You can
14533 rescale or transform the axes as usual for a data file with three columns
14534 by means of x=$1, y=$2, z=$3. For example
14536 splot 'a.dat' matrix using (1+$1/100):(1+$2*10):3
14540 A blank line or comment line ends the matrix, and starts a new surface mesh.
14541 You can select among the meshes inside a file by the @ref{index} option to the
14542 `splot` command, as usual.
14544 See `matrix` for examples of plotting rows and columns of the matrix in
14547 @node matrix, , matrix_ascii, data-file
14548 @subsubsection matrix
14550 @c ?commands plot datafile matrix
14551 @c ?commands splot datafile matrix
14552 @c ?plot datafile matrix
14553 @c ?splot datafile matrix
14556 @c ?data-file matrix
14557 @c ?datafile matrix
14560 Datafile can be in an ascii or binary matrix format. The `matrix` flag
14561 indicates that the file is ascii, the `binary` or `matrix binary` stands for
14562 a binary format. For details, see `matrix ascii` and `matrix binary`.
14564 Basic usage in `splot`:
14566 splot 'a.dat' matrix
14567 splot 'a.gpbin' @{matrix@} binary
14570 Advanced usage in `splot`:
14572 splot 'a.dat' matrix using 1:2:3
14573 splot 'a.gpbin' @{matrix@} binary using 1:2:3
14576 allows to transform the axes coordinates and the z-data independently.
14580 plot `a.dat` matrix
14581 plot `a.dat` matrix using 1:3
14582 plot 'a.gpbin' @{matrix@} binary using 1:3
14585 will plot rows of the matrix, while using 2:3 will plot matrix columns, and
14586 using 1:2 the point coordinates (rather useless). Applying the @ref{every} option
14587 you can specify explicit rows and columns.
14589 Example -- rescale axes of a matrix in an ascii file:
14591 splot `a.dat` matrix using (1+$1):(1+$2*10):3
14595 Example -- plot the 3rd row of a matrix in an ascii file:
14597 plot 'a.dat' matrix using 1:3 every 1:999:1:2
14600 (rows are enumerated from 0, thus 2 instead of 3).
14602 @node grid_data, splot_overview, data-file, splot
14603 @subsection grid data
14605 @c ?commands splot grid_data
14606 @c ?splot grid_data
14609 The 3D routines are designed for points in a grid format, with one sample,
14610 datapoint, at each mesh intersection; the datapoints may originate from
14611 either evaluating a function, see @ref{isosamples}, or reading a datafile,
14612 see @ref{datafile}. The term "isoline" is applied to the mesh lines for
14613 both functions and data. Note that the mesh need not be rectangular in x
14614 and y, as it may be parameterized in u and v, see @ref{isosamples}.
14616 However, `gnuplot` does not require that format. In the case of functions,
14617 'samples' need not be equal to 'isosamples', i.e., not every x-isoline
14618 sample need intersect a y-isoline. In the case of data files, if there
14619 are an equal number of scattered data points in each datablock, then
14620 "isolines" will connect the points in a datablock, and "cross-isolines"
14621 will connect the corresponding points in each datablock to generate a
14622 "surface". In either case, contour and hidden3d modes may give different
14623 plots than if the points were in the intended format. Scattered data can be
14624 converted to a @{different@} grid format with @ref{dgrid3d}.
14626 The contour code tests for z intensity along a line between a point on a
14627 y-isoline and the corresponding point in the next y-isoline. Thus a `splot`
14628 contour of a surface with samples on the x-isolines that do not coincide with
14629 a y-isoline intersection will ignore such samples. Try:
14631 set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2]
14632 set style function lp
14634 set isosamples 10,10; set samples 10,10;
14635 splot cos(x)*cos(y)
14636 set samples 4,10; replot
14637 set samples 10,4; replot
14642 @node splot_overview, , grid_data, splot
14643 @subsection splot overview
14645 @c ?commands splot overview
14647 `splot` can display a surface as a collection of points, or by connecting
14648 those points. As with `plot`, the points may be read from a data file or
14649 result from evaluation of a function at specified intervals, see
14650 @ref{isosamples}. The surface may be approximated by connecting the points
14651 with straight line segments, see @ref{surface}, in which case the surface
14652 can be made opaque with `set hidden3d.` The orientation from which the 3d
14653 surface is viewed can be changed with @ref{view}.
14655 Additionally, for points in a grid format, `splot` can interpolate points
14656 having a common amplitude (see @ref{contour}) and can then connect those
14657 new points to display contour lines, either directly with straight-line
14658 segments or smoothed lines (see @ref{cntrparam}). Functions are already
14659 evaluated in a grid format, determined by @ref{isosamples} and @ref{samples},
14660 while file data must either be in a grid format, as described in @ref{data-file},
14661 or be used to generate a grid (see @ref{dgrid3d}).
14663 Contour lines may be displayed either on the surface or projected onto the
14664 base. The base projections of the contour lines may be written to a
14665 file, and then read with `plot`, to take advantage of `plot`'s additional
14666 formatting capabilities.
14668 @node system_, test, splot, Commands
14671 @c ?commands system
14676 `system "command"` executes "command" using the standard shell. See @ref{shell}.
14677 If called as a function, `system("command")` returns the resulting character
14678 stream from stdout as a string. One optional trailing newline is ignored.
14680 This can be used to import external functions into gnuplot scripts:
14683 f(x) = real(system(sprintf("somecommand %f", x)))
14687 @node test, undefine, system_, Commands
14696 This command graphically tests or presents terminal and palette capabilities.
14700 test @{terminal | palette [rgb|rbg|grb|gbr|brg|bgr]@}
14704 @ref{test} or @ref{terminal} creates a display of line and point styles and other
14705 useful things appropriate for and supported by the @ref{terminal} you are just
14708 @ref{palette} draws graphically profiles R(z),G(z),B(z), where 0<=z<=1, as
14709 calculated by the current color @ref{palette}. In other words, it is a beautiful
14710 plot you would have to do yourself with the result of `show palette palette 256 float`.
14711 The optional parameter, a permutation of letters rgb, determines the sequence of
14712 r,g,b profiles drawn one after the other --- try this yourself for `set palette
14713 gray`. The default sequence is rgb.
14715 @node undefine, unset, test, Commands
14718 @c ?commands undefine
14723 Clear one or more previously defined user variables. This is useful in order
14724 to reset the state of a script containing an initialization test.
14729 undefine foo foo1 foo2
14730 if (!exists("foo")) load "initialize.gp"
14735 @node unset, update, undefine, Commands
14743 Options set using the `set` command may be returned to their default state by
14744 issuing the corresponding @ref{unset} command.
14748 set xtics mirror rotate by -45 0,10,100
14755 @node update, , unset, Commands
14758 @c ?commands update
14763 This command writes the current values of the fit parameters into the given
14764 file, formatted as an initial-value file (as described in the @ref{fit}section).
14765 This is useful for saving the current values for later use or for restarting
14766 a converged or stopped fit.
14770 update <filename> @{<filename>@}
14774 If a second filename is supplied, the updated values are written to this
14775 file, and the original parameter file is left unmodified.
14777 Otherwise, if the file already exists, `gnuplot` first renames it by
14778 appending `.old` and then opens a new file. That is, "`update 'fred'`"
14779 behaves the same as "`!rename fred fred.old; update 'fred.old' 'fred'`".
14780 [On DOS and other systems that use the twelve-character "filename.ext"
14781 naming convention, "ext" will be "`old`" and "filename" will be related
14782 (hopefully recognizably) to the initial name. Renaming is not done at all
14783 on VMS systems, since they use file-versioning.]
14785 Please see @ref{fit} for more information.
14787 @node Terminal_types, Graphical_User_Interfaces, Commands, Top
14788 @chapter Terminal types
14790 @c ^ <h2> Terminal Types </h2>
14796 @node terminal_, , Terminal_types, Terminal_types
14805 Gnuplot supports a large number of output formats. These are selected by
14806 choosing an appropriate terminal type, possibly with additional modifying
14807 options. See @ref{terminal}.
14809 This document may describe terminal types that are not available to you
14810 because they were not configured or installed on your system. To see a list of
14811 terminals available on a particular gnuplot installation, type 'set terminal'
14813 @@c <3 -- all terminal stuff is pulled from the .trm files
14821 * atari_ST_(via_AES)::
14822 * atari_ST_(via_VDI)::
14841 * Gnugraph(GNU_plotutils)::
14865 * Openstep_(next)::
14896 @node aed767, aifm, terminal_, terminal_
14897 @subsubsection aed767
14899 @c ?commands set terminal aed767
14900 @c ?set terminal aed767
14901 @c ?set term aed767
14902 @c ?terminal aed767
14908 @c ?commands set terminal aed512
14909 @c ?set terminal aed512
14910 @c ?set term aed512
14911 @c ?terminal aed512
14917 The `aed512` and `aed767` terminal drivers support AED graphics terminals.
14918 The two drivers differ only in their horizontal ranges, which are 512 and
14919 768 pixels, respectively. Their vertical range is 575 pixels. There are
14920 no options for these drivers."
14922 @node aifm, amiga, aed767, terminal_
14923 @subsubsection aifm
14925 @c ?commands set terminal aifm
14926 @c ?set terminal aifm
14933 NOTE: this terminal driver is outdated. Since Adobe Illustrator understands
14934 PostScript level 1 directly, you should use `set terminal post level1`
14937 Several options may be set in `aifm`---the Adobe Illustrator 3.0+ driver.
14941 set terminal aifm @{<color>@} @{"<fontname>"@} @{<fontsize>@}
14945 <color> is either `color` or `monochrome`; "<fontname>" is the name of a
14946 valid PostScript font; <fontsize> is the size of the font in PostScript
14947 points, before scaling by the @ref{size} command. Selecting `default` sets
14948 all options to their default values: `monochrome`, "Times-Roman", and 14pt.
14950 Since AI does not really support multiple pages, multiple graphs will be
14951 drawn directly on top of one another. However, each graph will be grouped
14952 individually, making it easy to separate them inside AI (just pick them up
14959 set size 0.7,1.4; set term aifm color "Times-Roman" 14"
14963 @node amiga, apollo, aifm, terminal_
14964 @subsubsection amiga
14966 @c ?commands set terminal amiga
14967 @c ?set terminal amiga
14975 The `amiga` terminal, for Commodore Amiga computers, allows the user to
14976 plot either to a screen (default), or, if Kickstart 3.0 or higher is
14977 installed, to a window on the current public screen. The font and its size
14978 can also be selected.
14982 set terminal amiga @{screen | window@} @{"<fontname>"@} @{<fontsize>@}
14986 The default font is 8-point "topaz".
14988 The screen option uses a virtual screen, so it is possible that the graph
14989 will be larger than the screen."
14991 @node apollo, aqua, amiga, terminal_
14992 @subsubsection apollo
14994 @c ?commands set terminal apollo
14995 @c ?set terminal apollo
14996 @c ?set term apollo
14997 @c ?terminal apollo
15003 The `apollo` terminal driver supports the Apollo Graphics Primitive Resource
15004 with rescaling after window resizing. It has no options.
15006 If a fixed-size window is desired, the `gpr` terminal may be used instead."
15008 @node aqua, atari_ST_(via_AES), apollo, terminal_
15009 @subsubsection aqua
15011 @c ?commands set terminal aqua
15012 @c ?set terminal aqua
15020 This terminal relies on AquaTerm.app for display on Mac OS X.
15024 set terminal aqua @{<n>@} @{title "<wintitle>"@} @{size <x> <y>@}
15025 @{font "<fontname>@{,<fontsize>@}"@}
15026 @{@{no@}enhanced@} @{solid|dashed@} @{dl <dashlength>@}@}
15030 where <n> is the number of the window to draw in (default is 0),
15031 <wintitle> is the name shown in the title bar (default "Figure <n>"),
15032 <x> <y> is the size of the plot (default is 846x594 pt = 11.75x8.25 in).
15034 Use <fontname> to specify the font to use (default is "Times-Roman"),
15035 and <fontsize> to specify the font size (default is 14.0 pt). The old syntax
15036 @{fname "<fontname>"@} @{fsize <fontsize>@} is still supported.
15038 The aqua terminal supports enhanced text mode (see `enhanced`), except for
15039 overprint. Font support is limited to the fonts available on the system.
15040 Character encoding can be selected by @ref{encoding} and currently supports
15041 iso_latin_1, iso_latin_2, cp1250, and default which equals UTF8.
15043 Lines can be drawn either solid or dashed, (default is solid) and the dash
15044 spacing can be modified by <dashlength> which is a multiplier > 0.
15047 @node atari_ST_(via_AES), atari_ST_(via_VDI), aqua, terminal_
15048 @subsubsection atari ST (via AES)
15050 @c ?commands set terminal atari
15051 @c ?set terminal atari
15059 The `atari` terminal has options to set the character size and the screen
15064 set terminal atari @{<fontsize>@} @{<col0> <col1> ... <col15>@}
15068 The character size must appear if any colors are to be specified. Each of
15069 the (up to 16) colors is given as a three-digit hex number, where the digits
15070 represent RED, GREEN and BLUE (in that order). The range of 0--15 is scaled
15071 to whatever color range the screen actually has. On a normal ST screen, odd
15072 and even intensities are the same.
15076 set terminal atari 4 # use small (6x6) font
15077 set terminal atari 6 0 # set monochrome screen to white on black
15078 set terminal atari 13 0 fff f00 f0 f ff f0f
15079 # set first seven colors to black, white, red, green,
15080 # blue, cyan, and purple and use large font (8x16).
15084 Additionally, if an environment variable GNUCOLORS exists, its contents are
15085 interpreted as an options string, but an explicit terminal option takes
15088 @node atari_ST_(via_VDI), be, atari_ST_(via_AES), terminal_
15089 @subsubsection atari ST (via VDI)
15091 @c ?commands set terminal vdi
15092 @c ?set terminal vdi
15100 The `vdi` terminal is the same as the `atari` terminal, except that it sends
15101 output to the screen via the VDI and not into AES-Windows.
15103 The `vdi` terminal has options to set the character size and the screen
15108 set terminal vdi @{<fontsize>@} @{<col0> <col1> ... <col15>@}
15112 The character size must appear if any colors are to be specified. Each of
15113 the (up to 16) colors is given as a three-digit hex number, where the digits
15114 represent RED, GREEN and BLUE (in that order). The range of 0--15 is scaled
15115 to whatever color range the screen actually has. On a normal ST screen, odd
15116 and even intensities are the same.
15120 set terminal vdi 4 # use small (6x6) font
15121 set terminal vdi 6 0 # set monochrome screen to white on black
15122 set terminal vdi 13 0 fff f00 f0 f ff f0f
15123 # set first seven colors to black, white, red, green,
15124 # blue, cyan, and purple and use large font (8x16).
15128 Additionally, if an environment variable GNUCOLORS exists, its contents are
15129 interpreted as an options string, but an explicit terminal option takes
15132 @node be, cgi, atari_ST_(via_VDI), terminal_
15135 @c ?commands set terminal be
15136 @c ?set terminal be
15144 `gnuplot` provides the `be` terminal type for use with X servers. This
15145 terminal type is set automatically at startup if the `DISPLAY` environment
15146 variable is set, if the `TERM` environment variable is set to `xterm`, or
15147 if the `-display` command line option is used.
15151 set terminal be @{reset@} @{<n>@}
15155 Multiple plot windows are supported: `set terminal be <n>` directs the
15156 output to plot window number n. If n>0, the terminal number will be
15157 appended to the window title and the icon will be labeled `gplt <n>`.
15158 The active window may distinguished by a change in cursor (from default
15161 Plot windows remain open even when the `gnuplot` driver is changed to a
15162 different device. A plot window can be closed by pressing the letter q
15163 while that window has input focus, or by choosing `close` from a window
15164 manager menu. All plot windows can be closed by specifying @ref{reset}, which
15165 actually terminates the subprocess which maintains the windows (unless
15166 `-persist` was specified).
15168 Plot windows will automatically be closed at the end of the session
15169 unless the `-persist` option was given.
15171 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
15174 Linewidths and pointsizes may be changed from within `gnuplot` with
15177 For terminal type `be`, `gnuplot` accepts (when initialized) the standard
15178 X Toolkit options and resources such as geometry, font, and name from the
15179 command line arguments or a configuration file. See the X(1) man page
15180 (or its equivalent) for a description of such options.
15182 A number of other `gnuplot` options are available for the `be` terminal.
15183 These may be specified either as command-line options when `gnuplot` is
15184 invoked or as resources in the configuration file ".Xdefaults". They are
15185 set upon initialization and cannot be altered during a `gnuplot` session.
15188 @noindent --- COMMAND-LINE_OPTIONS ---
15190 @c ?commands set terminal be command-line-options
15191 @c ?set terminal be command-line-options
15192 @c ?set term be command-line-options
15193 @c ?be command-line-options
15194 In addition to the X Toolkit options, the following options may be specified
15195 on the command line when starting `gnuplot` or as resources in your
15199 `-mono` forces monochrome rendering on color displays.
15200 `-gray` requests grayscale rendering on grayscale or color displays.
15201 (Grayscale displays receive monochrome rendering by default.)
15202 `-clear` requests that the window be cleared momentarily before a
15203 new plot is displayed.
15204 `-raise` raises plot window after each plot
15205 `-noraise` does not raise plot window after each plot
15206 `-persist` plots windows survive after main gnuplot program exits
15210 The options are shown above in their command-line syntax. When entered as
15211 resources in ".Xdefaults", they require a different syntax.
15219 `gnuplot` also provides a command line option (`-pointsize <v>`) and a
15220 resource, `gnuplot*pointsize: <v>`, to control the size of points plotted
15221 with the `points` plotting style. The value `v` is a real number (greater
15222 than 0 and less than or equal to ten) used as a scaling factor for point
15223 sizes. For example, `-pointsize 2` uses points twice the default size, and
15224 `-pointsize 0.5` uses points half the normal size.
15227 @noindent --- MONOCHROME_OPTIONS ---
15229 @c ?commands set terminal be monochrome_options
15230 @c ?set terminal be monochrome_options
15231 @c ?set term be monochrome_options
15232 @c ?be monochrome_options
15233 For monochrome displays, `gnuplot` does not honor foreground or background
15234 colors. The default is black-on-white. `-rv` or `gnuplot*reverseVideo: on`
15235 requests white-on-black.
15239 @noindent --- COLOR_RESOURCES ---
15241 @c ?commands set terminal be color_resources
15242 @c ?set terminal be color_resources
15243 @c ?set term be color_resources
15244 @c ?be color_resources
15245 For color displays, `gnuplot` honors the following resources (shown here
15246 with their default values) or the greyscale resources. The values may be
15247 color names as listed in the BE rgb.txt file on your system, hexadecimal
15248 RGB color specifications (see BE documentation), or a color name followed
15249 by a comma and an `intensity` value from 0 to 1. For example, `blue, 0.5`
15250 means a half intensity blue.
15253 gnuplot*background: white
15254 gnuplot*textColor: black
15255 gnuplot*borderColor: black
15256 gnuplot*axisColor: black
15257 gnuplot*line1Color: red
15258 gnuplot*line2Color: green
15259 gnuplot*line3Color: blue
15260 gnuplot*line4Color: magenta
15261 gnuplot*line5Color: cyan
15262 gnuplot*line6Color: sienna
15263 gnuplot*line7Color: orange
15264 gnuplot*line8Color: coral
15269 The command-line syntax for these is, for example,
15273 gnuplot -background coral
15279 @noindent --- GRAYSCALE_RESOURCES ---
15281 @c ?commands set terminal be grayscale_resources
15282 @c ?set terminal be grayscale_resources
15283 @c ?set term be grayscale_resources
15284 @c ?be grayscale_resources
15285 When `-gray` is selected, `gnuplot` honors the following resources for
15286 grayscale or color displays (shown here with their default values). Note
15287 that the default background is black.
15290 gnuplot*background: black
15291 gnuplot*textGray: white
15292 gnuplot*borderGray: gray50
15293 gnuplot*axisGray: gray50
15294 gnuplot*line1Gray: gray100
15295 gnuplot*line2Gray: gray60
15296 gnuplot*line3Gray: gray80
15297 gnuplot*line4Gray: gray40
15298 gnuplot*line5Gray: gray90
15299 gnuplot*line6Gray: gray50
15300 gnuplot*line7Gray: gray70
15301 gnuplot*line8Gray: gray30
15308 @noindent --- LINE_RESOURCES ---
15310 @c ?commands set terminal be line_resources
15311 @c ?set terminal be line_resources
15312 @c ?set term be line_resources
15313 @c ?be line_resources
15314 `gnuplot` honors the following resources for setting the width (in pixels) of
15315 plot lines (shown here with their default values.) 0 or 1 means a minimal
15316 width line of 1 pixel width. A value of 2 or 3 may improve the appearance of
15320 gnuplot*borderWidth: 2
15321 gnuplot*axisWidth: 0
15322 gnuplot*line1Width: 0
15323 gnuplot*line2Width: 0
15324 gnuplot*line3Width: 0
15325 gnuplot*line4Width: 0
15326 gnuplot*line5Width: 0
15327 gnuplot*line6Width: 0
15328 gnuplot*line7Width: 0
15329 gnuplot*line8Width: 0
15334 `gnuplot` honors the following resources for setting the dash style used for
15335 plotting lines. 0 means a solid line. A two-digit number `jk` (`j` and `k`
15336 are >= 1 and <= 9) means a dashed line with a repeated pattern of `j` pixels
15337 on followed by `k` pixels off. For example, '16' is a "dotted" line with one
15338 pixel on followed by six pixels off. More elaborate on/off patterns can be
15339 specified with a four-digit value. For example, '4441' is four on, four off,
15340 four on, one off. The default values shown below are for monochrome displays
15341 or monochrome rendering on color or grayscale displays. For color displays,
15342 the default for each is 0 (solid line) except for `axisDashes` which defaults
15343 to a '16' dotted line.
15346 gnuplot*borderDashes: 0
15347 gnuplot*axisDashes: 16
15348 gnuplot*line1Dashes: 0
15349 gnuplot*line2Dashes: 42
15350 gnuplot*line3Dashes: 13
15351 gnuplot*line4Dashes: 44
15352 gnuplot*line5Dashes: 15
15353 gnuplot*line6Dashes: 4441
15354 gnuplot*line7Dashes: 42
15355 gnuplot*line8Dashes: 13
15360 @node cgi, cgm, be, terminal_
15363 @c ?commands set terminal cgi
15364 @c ?set terminal cgi
15372 @c ?commands set terminal hcgi
15373 @c ?set terminal hcgi
15381 The `cgi` and `hcgi` terminal drivers support SCO CGI drivers. `hcgi` is for
15382 printers; the environment variable CGIPRNT must be set. `cgi` may be used
15383 for either a display or hardcopy; if the environment variable CGIDISP is set,
15384 then that display is used. Otherwise CGIPRNT is used.
15386 These terminals have no options."
15388 @node cgm, corel, cgi, terminal_
15391 @c ?commands set terminal cgm
15392 @c ?set terminal cgm
15400 The `cgm` terminal generates a Computer Graphics Metafile, Version 1.
15401 This file format is a subset of the ANSI X3.122-1986 standard entitled
15402 "Computer Graphics - Metafile for the Storage and Transfer of Picture
15403 Description Information".
15407 set terminal cgm @{color | monochrome@} @{solid | dashed@} @{@{no@}rotate@}
15408 @{<mode>@} @{width <plot_width>@} @{linewidth <line_width>@}
15409 @{font "<fontname>,<fontsize>"@}
15410 @{<color0> <color1> <color2> ...@}
15414 `solid` draws all curves with solid lines, overriding any dashed patterns;
15415 <mode> is `landscape`, `portrait`, or `default`;
15416 <plot_width> is the assumed width of the plot in points;
15417 <line_width> is the line width in points (default 1);
15418 <fontname> is the name of a font (see list of fonts below)
15419 <fontsize> is the size of the font in points (default 12).
15421 The first six options can be in any order. Selecting `default` sets all
15422 options to their default values.
15424 Each color must be of the form 'xrrggbb', where x is the literal
15425 character 'x' and 'rrggbb' are the red, green and blue components in
15426 hex. For example, 'x00ff00' is green. The background color is set
15427 first, then the plotting colors.
15431 set terminal cgm landscape color rotate dashed width 432 \\
15432 linewidth 1 'Helvetica Bold' 12 # defaults
15433 set terminal cgm linewidth 2 14 # wider lines & larger font
15434 set terminal cgm portrait "Times Italic" 12
15435 set terminal cgm color solid # no pesky dashes!
15441 @noindent --- CGM FONTS ---
15443 @c ?commands set terminal cgm font
15444 @c ?set terminal cgm font
15445 @c ?set term cgm font
15447 The first part of a Computer Graphics Metafile, the metafile description,
15448 includes a font table. In the picture body, a font is designated by an
15449 index into this table. By default, this terminal generates a table with
15450 the following 35 fonts, plus six more with `italic` replaced by
15451 `oblique`, or vice-versa (since at least the Microsoft Office and Corel
15452 Draw CGM import filters treat `italic` and `oblique` as equivalent):
15458 Helvetica Bold Oblique
15466 Courier Bold Oblique
15468 Hershey/Cartographic_Roman
15469 Hershey/Cartographic_Greek
15470 Hershey/Simplex_Roman
15471 Hershey/Simplex_Greek
15472 Hershey/Simplex_Script
15473 Hershey/Complex_Roman
15474 Hershey/Complex_Greek
15475 Hershey/Complex_Script
15476 Hershey/Complex_Italic
15477 Hershey/Complex_Cyrillic
15478 Hershey/Duplex_Roman
15479 Hershey/Triplex_Roman
15480 Hershey/Triplex_Italic
15481 Hershey/Gothic_German
15482 Hershey/Gothic_English
15483 Hershey/Gothic_Italian
15484 Hershey/Symbol_Set_1
15485 Hershey/Symbol_Set_2
15486 Hershey/Symbol_Math
15494 The first thirteen of these fonts are required for WebCGM. The
15495 Microsoft Office CGM import filter implements the 13 standard fonts
15496 listed above, and also 'ZapfDingbats' and 'Script'. However, the
15497 script font may only be accessed under the name '15'. For more on
15498 Microsoft import filter font substitutions, check its help file which
15501 C:\\Program Files\\Microsoft Office\\Office\\Cgmimp32.hlp
15504 and/or its configuration file, which you may find here:
15506 C:\\Program Files\\Common Files\\Microsoft Shared\\Grphflt\\Cgmimp32.cfg
15510 In the `set term` command, you may specify a font name which does not
15511 appear in the default font table. In that case, a new font table is
15512 constructed with the specified font as its first entry. You must ensure
15513 that the spelling, capitalization, and spacing of the name are
15514 appropriate for the application that will read the CGM file. (Gnuplot
15515 and any MIL-D-28003A compliant application ignore case in font names.)
15516 If you need to add several new fonts, use several `set term` commands.
15520 set terminal cgm 'Old English'
15521 set terminal cgm 'Tengwar'
15522 set terminal cgm 'Arabic'
15523 set output 'myfile.cgm'
15529 You cannot introduce a new font in a @ref{label} command.
15533 @noindent --- CGM FONTSIZE ---
15535 @c ?commands set terminal cgm fontsize
15536 @c ?set terminal cgm fontsize
15537 @c ?set term cgm fontsize
15539 Fonts are scaled assuming the page is 6 inches wide. If the @ref{size}
15540 command is used to change the aspect ratio of the page or the CGM file
15541 is converted to a different width, the resulting font sizes will be
15542 scaled up or down accordingly. To change the assumed width, use the
15547 @noindent --- CGM LINEWIDTH ---
15549 @c ?commands set terminal cgm linewidth
15550 @c ?set terminal cgm linewidth
15551 @c ?set term cgm linewidth
15553 The `linewidth` option sets the width of lines in pt. The default width
15554 is 1 pt. Scaling is affected by the actual width of the page, as
15555 discussed under the `fontsize` and `width` options.
15559 @noindent --- CGM ROTATE ---
15561 @c ?commands set terminal cgm rotate
15562 @c ?set terminal cgm rotate
15563 @c ?set term cgm rotate
15565 The `norotate` option may be used to disable text rotation. For
15566 example, the CGM input filter for Word for Windows 6.0c can accept
15567 rotated text, but the DRAW editor within Word cannot. If you edit a
15568 graph (for example, to label a curve), all rotated text is restored to
15569 horizontal. The Y axis label will then extend beyond the clip boundary.
15570 With `norotate`, the Y axis label starts in a less attractive location,
15571 but the page can be edited without damage. The `rotate` option confirms
15572 the default behavior.
15576 @noindent --- CGM SOLID ---
15578 @c ?set terminal cgm solid
15579 @c ?set term cgm solid
15581 The `solid` option may be used to disable dashed line styles in the
15582 plots. This is useful when color is enabled and the dashing of the
15583 lines detracts from the appearance of the plot. The `dashed` option
15584 confirms the default behavior, which gives a different dash pattern to
15589 @noindent --- CGM SIZE ---
15591 @c ?commands set terminal cgm size
15592 @c ?set terminal cgm size
15593 @c ?set term cgm size
15595 Default size of a CGM plot is 32599 units wide and 23457 units high for
15596 landscape, or 23457 units wide by 32599 units high for portrait.
15600 @noindent --- CGM WIDTH ---
15602 @c ?commands set terminal cgm width
15603 @c ?set terminal cgm width
15604 @c ?set term cgm width
15606 All distances in the CGM file are in abstract units. The application
15607 that reads the file determines the size of the final plot. By default,
15608 the width of the final plot is assumed to be 6 inches (15.24 cm). This
15609 distance is used to calculate the correct font size, and may be changed
15610 with the `width` option. The keyword should be followed by the width in
15611 points. (Here, a point is 1/72 inch, as in PostScript. This unit is
15612 known as a "big point" in TeX.) Gnuplot `expressions` can be used to
15613 convert from other units.
15617 set terminal cgm width 432 # default
15618 set terminal cgm width 6*72 # same as above
15619 set terminal cgm width 10/2.54*72 # 10 cm wide
15625 @noindent --- CGM NOFONTLIST ---
15627 @c ?commands set terminal cgm nofontlist
15628 @c ?set terminal cgm nofontlist
15629 @c ?set term cgm nofontlist
15631 @c ?set terminal cgm winword6
15632 @c ?set term cgm winword6
15634 The default font table includes the fonts recommended for WebCGM, which
15635 are compatible with the Computer Graphics Metafile input filter for
15636 Microsoft Office and Corel Draw. Another application might use
15637 different fonts and/or different font names, which may not be
15638 documented. The `nofontlist` (synonym `winword6`) option deletes the font
15639 table from the CGM file. In this case, the reading application should
15640 use a default table. Gnuplot will still use its own default font table
15641 to select font indices. Thus, 'Helvetica' will give you an index of 1,
15642 which should get you the first entry in your application's default font
15643 table. 'Helvetica Bold' will give you its second entry, etc.
15647 @node corel, debug, cgm, terminal_
15648 @subsubsection corel
15650 @c ?commands set terminal corel
15651 @c ?set terminal corel
15659 The `corel` terminal driver supports CorelDraw.
15663 set terminal corel @{ default
15664 | @{monochrome | color
15665 @{"<font>" @{<fontsize>
15666 @{<xsize> <ysize> @{<linewidth> @}@}@}@}@}
15670 where the fontsize and linewidth are specified in points and the sizes in
15671 inches. The defaults are monochrome, "SwitzerlandLight", 22, 8.2, 10 and 1.2."
15673 @node debug, svga, corel, terminal_
15674 @subsubsection debug
15676 @c ?commands set terminal debug
15677 @c ?set terminal debug
15685 This terminal is provided to allow for the debugging of `gnuplot`. It is
15686 likely to be of use only for users who are modifying the source code."
15688 @node svga, dumb, debug, terminal_
15689 @subsubsection svga
15691 @c ?commands set terminal svga
15692 @c ?set terminal svga
15700 The `svga` terminal driver supports PCs with SVGA graphics. It can only be
15701 used if it is compiled with DJGPP. Its only option is the font.
15705 set terminal svga @{"<fontname>"@}"
15709 @node dumb, dxf, svga, terminal_
15710 @subsubsection dumb
15712 @c ?commands set terminal dumb
15713 @c ?set terminal dumb
15721 The `dumb` terminal driver has an optional size specification and trailing
15726 set terminal dumb @{[no]feed@} @{<xsize> <ysize>@}
15731 where <xsize> and <ysize> set the size of the dumb terminals. Default is
15732 79 by 24. The last newline is printed only if `feed` is enabled.
15736 set term dumb nofeed
15737 set term dumb 79 49 # VGA screen---why would anyone do that?"
15741 @node dxf, dxy800a, dumb, terminal_
15744 @c ?commands set terminal dxf
15745 @c ?set terminal dxf
15753 The `dxf` terminal driver creates pictures that can be imported into AutoCad
15754 (Release 10.x). It has no options of its own, but some features of its plots
15755 may be modified by other means. The default size is 120x80 AutoCad units,
15756 which can be changed by @ref{size}. `dxf` uses seven colors (white, red,
15757 yellow, green, cyan, blue and magenta), which can be changed only by
15758 modifying the source file. If a black-and-white plotting device is used, the
15759 colors are mapped to differing line thicknesses. See the description of the
15760 AutoCad print/plot command."
15762 @node dxy800a, eepic, dxf, terminal_
15763 @subsubsection dxy800a
15765 @c ?commands set terminal dxy800a
15766 @c ?set terminal dxy800a
15767 @c ?set term dxy800a
15768 @c ?terminal dxy800a
15774 This terminal driver supports the Roland DXY800A plotter. It has no options."
15776 @node eepic, emf, dxy800a, terminal_
15777 @subsubsection eepic
15779 @c ?commands set terminal eepic
15780 @c ?set terminal eepic
15788 The `eepic` terminal driver supports the extended LaTeX picture environment.
15789 It is an alternative to the `latex` driver.
15791 The output of this terminal is intended for use with the "eepic.sty" macro
15792 package for LaTeX. To use it, you need "eepic.sty", "epic.sty" and a
15793 printer driver that supports the "tpic" \\specials. If your printer driver
15794 doesn't support those \\specials, "eepicemu.sty" will enable you to use some
15796 dvips and dvipdfm do support the "tpic" \\specials.
15800 set terminal eepic @{color, dashed, rotate, small, tiny, default, <fontsize>@}
15805 You can give options in any order you wish.
15806 'color' causes gnuplot to produce \\color@{...@} commands so that the graphs are
15807 colored. Using this option, you must include \\usepackage@{color@} in the preambel
15808 of your latex document.
15809 'dashed' will allow dashed line types; without this option, only solid lines
15810 with varying thickness will be used.
15811 'dashed' and 'color' are mutually exclusive; if 'color' is specified, then 'dashed'
15813 'rotate' will enable true rotated text (by 90 degrees). Otherwise, rotated text
15814 will be typeset with letters stacked above each other. If you use this option
15815 you must include \\usepackage@{graphicx@} in the preamble.
15816 'small' will use \\scriptsize symbols as point markers (Probably does not work
15817 with TeX, only LaTeX2e). Default is to use the default math size.
15818 'tiny' uses \\scriptscriptstyle symbols.
15819 'default' resets all options to their defaults = no color, no dashed lines,
15820 pseudo-rotated (stacked) text, large point symbols.
15821 <fontsize> is a number which specifies the font size inside the picture
15822 environment; the unit is pt (points), i.e., 10 pt equals approx. 3.5 mm.
15823 If fontsize is not specified, then all text inside the picture will be set
15827 Remember to escape the # character (or other chars meaningful to (La-)TeX)
15828 by \\\\ (2 backslashes).
15829 It seems that dashed lines become solid lines when the vertices of a plot
15830 are too close. (I do not know if that is a general problem with the tpic specials,
15831 or if it is caused by a bug in eepic.sty or dvips/dvipdfm.)
15832 The default size of an eepic plot is 5x3 inches, which can be scaled
15834 Points, among other things, are drawn using the LaTeX commands "\\Diamond",
15835 "\\Box", etc. These commands no longer belong to the LaTeX2e core; they are
15836 included in the latexsym package, which is part of the base distribution and
15837 thus part of any LaTeX implementation. Please do not forget to use this package.
15838 Instead of latexsym, you can also include the amssymb package.
15839 All drivers for LaTeX offer a special way of controlling text positioning:
15840 If any text string begins with '@{', you also need to include a '@}' at the
15841 end of the text, and the whole text will be centered both horizontally and
15842 vertically. If the text string begins with '[', you need to follow this with
15843 a position specification (up to two out of t,b,l,r), ']@{', the text itself,
15844 and finally '@}'. The text itself may be anything LaTeX can typeset as an
15845 LR-box. '\\rule@{@}@{@}'s may help for best positioning.
15850 output graphs as eepic macros inside a picture environment;
15851 \\input the resulting file in your LaTeX document.
15854 set term eepic color tiny rotate 8
15856 eepic macros with \\color macros, \\scripscriptsize point markers,
15857 true rotated text, and all text set with 8pt.
15861 About label positioning:
15862 Use gnuplot defaults (mostly sensible, but sometimes not really best):
15864 set title '\\LaTeX\\ -- $ \\gamma $'
15867 Force centering both horizontally and vertically:
15869 set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
15872 Specify own positioning (top here):
15874 set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
15877 The other label -- account for long ticlabels:
15879 set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
15883 @node emf, emxvga, eepic, terminal_
15886 @c ?commands set terminal emf
15887 @c ?set terminal emf
15895 The `emf` terminal generates an Enhanced Metafile Format file.
15896 This file format is recognized by many Windows applications.
15900 set terminal emf @{color | monochrome@} @{solid | dashed@}
15901 @{enhanced @{noproportional@}@}
15902 @{linewidth <LW>@} @{dashlength <DL>@} @{size XX,YY@}
15903 @{"<fontname>"@} @{<fontsize>@} #old syntax
15904 @{font "<fontname>,<fontsize>"@} #new syntax
15908 In `monochrome` mode successive line types cycle through dash patterns.
15909 In `color` mode successive line types use successive colors, and only after
15910 all 8 default colors are exhausted is the dash pattern incremented.
15911 `solid` draws all curves with solid lines, overriding any dashed patterns;
15912 `linewidth <factor>` multiplies all line widths by this factor.
15913 `dashlength <factor>` is useful for thick lines.
15914 <font> is the name of a font; and
15915 `<fontsize>` is the size of the font in points.
15917 The nominal size of the output image defaults to 1024x768 in arbitrary
15918 units. You may specify a different nominal size using the @ref{size} option.
15920 Enhanced text mode tries to approximate proportional character spacing.
15921 If you are using a monospaced font, or don't like the approximation, you
15922 can turn off this correction using the `noproportional` option.
15924 The default settings are `color dashed font "Arial,12" size 1024,768`
15925 Selecting `default` sets all options to their default values.
15929 set terminal emf 'Times Roman Italic' 12
15930 set terminal emf color solid # no pesky dashes!"
15934 @node emxvga, epson-180dpi, emf, terminal_
15935 @subsubsection emxvga
15937 @c ?commands set terminal emxvga
15938 @c ?set terminal emxvga
15939 @c ?set term emxvga
15940 @c ?terminal emxvga
15946 @c ?commands set terminal emxvesa
15947 @c ?set terminal emxvesa
15948 @c ?set term emxvesa
15949 @c ?terminal emxvesa
15955 @c ?commands set terminal vgal
15956 @c ?set terminal vgal
15964 The `emxvga`, `emxvesa` and `vgal` terminal drivers support PCs with SVGA,
15965 vesa SVGA and VGA graphics boards, respectively. They are intended to be
15966 compiled with "emx-gcc" under either DOS or OS/2. They also need VESA and
15967 SVGAKIT maintained by Johannes Martin (JMARTIN@@GOOFY.ZDV.UNI-MAINZ.DE) with
15968 additions by David J. Liu (liu@@phri.nyu.edu).
15972 set terminal emxvga
15973 set terminal emxvesa @{vesa-mode@}
15978 The only option is the vesa mode for `emxvesa`, which defaults to G640x480x256."
15980 @node epson-180dpi, excl, emxvga, terminal_
15981 @subsubsection epson-180dpi
15983 @c ?commands set terminal epson-180dpi
15984 @c ?set terminal epson-180dpi
15985 @c ?set term epson-180dpi
15986 @c ?terminal epson-180dpi
15987 @c ?term epson-180dpi
15988 @cindex epson-180dpi
15989 @tmindex epson-180dpi
15992 @c ?commands set terminal epson-60dpi
15993 @c ?set terminal epson-60dpi
15994 @c ?set term epson-60dpi
15995 @c ?terminal epson-60dpi
15996 @c ?term epson-60dpi
15997 @cindex epson-60dpi
15998 @tmindex epson-60dpi
16001 @c ?commands set terminal epson-lx800
16002 @c ?set terminal epson-lx800
16003 @c ?set term epson-lx800
16004 @c ?terminal epson-lx800
16005 @c ?term epson-lx800
16006 @cindex epson-lx800
16007 @tmindex epson-lx800
16010 @c ?commands set terminal nec-cp6
16011 @c ?set terminal nec-cp6
16012 @c ?set term nec-cp6
16013 @c ?terminal nec-cp6
16019 @c ?commands set terminal okidata
16020 @c ?set terminal okidata
16021 @c ?set term okidata
16022 @c ?terminal okidata
16028 @c ?commands set terminal starc
16029 @c ?set terminal starc
16037 @c ?commands set terminal tandy-60dpi
16038 @c ?set terminal tandy-60dpi
16039 @c ?set term tandy-60dpi
16040 @c ?terminal tandy-60dpi
16041 @c ?term tandy-60dpi
16042 @cindex tandy-60dpi
16043 @tmindex tandy-60dpi
16046 This driver supports a family of Epson printers and derivatives.
16048 `epson-180dpi` and `epson-60dpi` are drivers for Epson LQ-style 24-pin
16049 printers with resolutions of 180 and 60 dots per inch, respectively.
16051 `epson-lx800` is a generic 9-pin driver appropriate for printers like the
16052 Epson LX-800, the Star NL-10 and NX-1000, the PROPRINTER, and so forth.
16054 `nec-cp6` is generic 24-pin driver that can be used for printers like the
16055 NEC CP6 and the Epson LQ-800.
16057 The `okidata` driver supports the 9-pin OKIDATA 320/321 Standard printers.
16059 The `starc` driver is for the Star Color Printer.
16061 The `tandy-60dpi` driver is for the Tandy DMP-130 series of 9-pin, 60-dpi
16064 Only `nec-cp6` has any options.
16068 set terminal nec-cp6 @{monochrome | colour | draft@}
16072 which defaults to monochrome.
16074 With each of these drivers, a binary copy is required on a PC to print. Do
16075 not use @ref{print}---use instead `copy file /b lpt1:`."
16077 @node excl, hercules, epson-180dpi, terminal_
16078 @subsubsection excl
16080 @c ?commands set terminal excl
16081 @c ?set terminal excl
16089 The `excl` terminal driver supports Talaris printers such as the EXCL Laser
16090 printer and the 1590. It has no options."
16092 @node hercules, fig, excl, terminal_
16093 @subsubsection hercules
16095 @c ?commands set terminal hercules
16096 @c ?set terminal hercules
16097 @c ?set term hercules
16098 @c ?terminal hercules
16104 @c ?commands set terminal egalib
16105 @c ?set terminal egalib
16106 @c ?set term egalib
16107 @c ?terminal egalib
16113 @c ?commands set terminal egamono
16114 @c ?set terminal egamono
16115 @c ?set term egamono
16116 @c ?terminal egamono
16122 @c ?commands set terminal vgalib
16123 @c ?set terminal vgalib
16124 @c ?set term vgalib
16125 @c ?terminal vgalib
16131 @c ?commands set terminal vgamono
16132 @c ?set terminal vgamono
16133 @c ?set term vgamono
16134 @c ?terminal vgamono
16140 @c ?commands set terminal svgalib
16141 @c ?set terminal svgalib
16142 @c ?set term svgalib
16143 @c ?terminal svgalib
16149 @c ?commands set terminal ssvgalib
16150 @c ?set terminal ssvgalib
16151 @c ?set term ssvgalib
16152 @c ?terminal ssvgalib
16158 These drivers supports PC monitors with autodetected graphics boards. They
16159 can be used only when compiled with Zortech C/C++. None have options."
16161 @node fig, png, hercules, terminal_
16164 @c ?commands set terminal fig
16165 @c ?set terminal fig
16173 The `fig` terminal device generates output in the Fig graphics language.
16177 set terminal fig @{monochrome | color@}
16178 @{landscape | portrait@}
16179 @{small | big | size <xsize> <ysize>@}
16180 @{metric | inches@}
16181 @{pointsmax <max_points>@}
16183 @{font <fontname>@} @{fontsize <fsize>@}
16184 @{textnormal | @{textspecial texthidden textrigid@}@}
16185 @{@{thickness|linewidth@} <units>@}
16187 @{version <number>@}
16191 `monochrome` and `color` determine whether the picture is black-and-white or
16192 `color`. `small` and `big` produce a 5x3 or 8x5 inch graph in the default
16193 `landscape` mode and 3x5 or 5x8 inches in `portrait` mode.
16194 @ref{size} sets (overrides) the size of the drawing
16195 area to <xsize>*<ysize> in units of inches or centimeters depending on the
16196 `inches` or `metric` setting in effect.
16197 The latter settings is also used as default units for editing with "xfig".
16199 `pointsmax <max_points>` sets the maximum number of points per polyline.
16201 `solid` inhibits automatic usage of `dash`ed lines when solid linestyles are
16202 used up, which otherwise occurs.
16204 `fontsize` sets the size of the text font to <fsize> points. `textnormal`
16205 resets the text flags and selects postscript fonts, `textspecial` sets the
16206 text flags for LaTeX specials, `texthidden` sets the hidden flag and
16207 `textrigid` the rigid flag.
16209 `depth` sets the default depth layer for all lines and text. The default
16210 depth is 10 to leave room for adding material with "xfig" on top of the
16213 @ref{version} sets the format version of the generated fig output. Currently
16214 only versions 3.1 and 3.2 are supported.
16216 `thickness` sets the default line thickness, which is 1 if not specified.
16217 Overriding the thickness can be achieved by adding a multiple of 100 to the
16218 `linetype` value for a `plot` command. In a similar way the `depth`
16219 of plot elements (with respect to the default depth) can be controlled by
16220 adding a multiple of 1000 to <linetype>. The depth is then <layer> +
16221 <linetype>/1000 and the thickness is (<linetype>%1000)/100 or, if that is
16222 zero, the default line thickness. `linewidth` is a synonym for `thickness`.
16224 Additional point-plot symbols are also available with the `fig` driver. The
16225 symbols can be used through `pointtype` values % 100 above 50, with different
16226 fill intensities controlled by <pointtype> % 5 and outlines in black (for
16227 <pointtype> % 10 < 5) or in the current color. Available symbols are
16232 80 - 89: upwards triangles
16233 90 - 99: downwards triangles
16236 The size of these symbols is linked to the font size. The depth of symbols
16237 is by default one less than the depth for lines to achieve nice error bars.
16238 If <pointtype> is above 1000, the depth is <layer> + <pointtype>/1000-1. If
16239 <pointtype>%1000 is above 100, the fill color is (<pointtype>%1000)/100-1.
16241 Available fill colors are (from 1 to 9): black, blue, green, cyan, red,
16242 magenta, yellow, white and dark blue (in monochrome mode: black for 1 to 6
16243 and white for 7 to 9).
16245 See @ref{with} for details of <linetype> and <pointtype>.
16247 The `big` option is a substitute for the `bfig` terminal in earlier versions,
16248 which is no longer supported.
16252 set terminal fig monochrome small pointsmax 1000 # defaults
16257 plot 'file.dat' with points linetype 102 pointtype 759
16260 would produce circles with a blue outline of width 1 and yellow fill color.
16263 plot 'file.dat' using 1:2:3 with err linetype 1 pointtype 554
16266 would produce errorbars with black lines and circles filled red. These
16267 circles are one layer above the lines (at depth 9 by default).
16269 To plot the error bars on top of the circles use
16271 plot 'file.dat' using 1:2:3 with err linetype 1 pointtype 2554"
16275 @node png, ggi, fig, terminal_
16278 @c ?commands set terminal png
16279 @c ?set terminal png
16290 @{@{no@}transparent@} @{@{no@}interlace@}
16291 @{@{no@}truecolor@} @{rounded|butt@}
16292 @{tiny | small | medium | large | giant@}
16293 @{font <face> @{<pointsize>@}@}
16294 @{size <x>,<y>@} @{@{no@}crop@}
16296 @{<color0> <color1> <color2> ...@}
16300 PNG images are created using libgd, with optional support for TrueType
16301 and Adobe Type 1 fonts via libfreetype. Version 1.8 or greater of libgd
16304 `transparent` instructs the driver to generate transparent PNGs. The first
16305 color will be the transparent one. Default is `notransparent`.
16307 `interlace` instructs the driver to generate interlaced PNGs.
16308 Default is `nointerlace`.
16310 `butt` instructs the driver to use a line drawing method that does
16311 not overshoot the desired end point of a line. This setting is only
16312 applicable for line widths greater than 1. This setting is most useful when
16313 drawing horizontal or vertical lines. Default is `rounded`.
16314 Version 2.0 or greater of libgd is required.
16316 PNG plots may be conveniently viewed by piping the output to the
16317 'display' program from the ImageMagick package as follows:
16320 set output '| display png:-'
16324 View the output from successive plot commands interactively by hitting
16325 <space> in the display window. To save a particular one to disk, left
16326 click in the display window and choose @ref{save}.
16328 Five basic fonts are supported directly by the gd library. These are
16329 `tiny` (5x8 pixels), `small` (6x12 pixels), `medium`, (7x13 Bold),
16330 `large` (8x16) or `giant` (9x15 pixels). These fonts cannot be scaled
16331 or rotated (pure horizontal or vertical text only).
16335 If gnuplot was built with support for TrueType (*.ttf) or Adobe Type 1
16336 (*.pfa) fonts, they may be selected using the 'font <face> @{<pointsize>@}'
16337 option. <face> is either the full pathname to the font file, or a font
16338 face name that is assumed to be the first part of a filename in one of the
16339 directories listed in the GDFONTPATH environmental variable. That is,
16340 'set term png font "Face"' will look for a font file named either
16341 <somedirectory>/Face.ttf or <somedirectory>/Face.pfa. Both TrueType and
16342 Adobe Type 1 fonts are fully scalable and may be rotated through any angle.
16343 If no font is specified, gnuplot checks the environmental variable
16344 GNUPLOT_DEFAULT_GDFONT to see if there is a preferred default font.
16346 `enhanced` enables the enhanced text processing features, (subscripts,
16347 superscripts and mixed fonts). See `enhanced` for more information.
16348 The full enhanced mode syntax is supported by the PNG/JPEG driver itself,
16349 but some of these features are dependent on which version of the
16350 underlying libgd library is present, and which fonts are available.
16352 The size <x,y> is given in pixels---it defaults to 640x480. The number of
16353 pixels can be also modified by scaling with the @ref{size} command.
16354 `crop` trims blank space from the edges of the completed plot, resulting
16355 in a smaller final image size. Default is `nocrop`.
16357 Each color must be of the form 'xrrggbb', where x is the literal character
16358 'x' and 'rrggbb' are the red, green and blue components in hex. For example,
16359 'x00ff00' is green. The background color is set first, then the border
16360 colors, then the X & Y axis colors, then the plotting colors. The maximum
16361 number of colors that can be set is 256.
16365 set terminal png medium size 640,480 \\
16366 xffffff x000000 x404040 \\
16367 xff0000 xffa500 x66cdaa xcdb5cd \\
16368 xadd8e6 x0000ff xdda0dd x9500d3 # defaults
16372 which uses white for the non-transparent background, black for borders, gray
16373 for the axes, and red, orange, medium aquamarine, thistle 3, light blue, blue,
16374 plum and dark violet for eight plotting colors.
16377 set terminal png font arial 14 size 800,600
16381 which searches for a TrueType font with face name 'arial' in the directory
16382 specified by the environment variable GDFONTPATH and 14pt font size.
16385 set terminal png transparent xffffff \\
16386 x000000 x202020 x404040 x606060 \\
16387 x808080 xA0A0A0 xC0C0C0 xE0E0E0
16391 which uses white for the transparent background, black for borders, dark
16392 gray for axes, and a gray-scale for the six plotting colors.
16395 @node ggi, Gnugraph(GNU_plotutils), png, terminal_
16398 @c ?commands set terminal ggi
16399 @c ?set terminal ggi
16407 The `ggi` driver can run on different targets as X or svgalib.
16411 set terminal ggi [acceleration <integer>] [[mode] @{mode@}]
16415 In X the window cannot be resized using window manager handles, but the
16416 mode can be given with the mode option, e.g.:
16424 Please refer to the ggi documentation for other modes. The 'mode' keyword
16425 is optional. It is recommended to select the target by environment variables
16426 as explained in the libggi manual page. To get DGA on X, you should for
16429 bash> export GGI_DISPLAY=DGA
16430 csh> setenv GGI_DISPLAY DGA
16434 'acceleration' is only used for targets which report relative pointer
16435 motion events (e.g. DGA) and is a strictly positive integer multiplication
16436 factor for the relative distances. The default for acceleration is 7.
16440 set term ggi acc 10
16441 set term ggi acc 1 mode V1024x768
16442 set term ggi V1024x768"
16446 @node Gnugraph(GNU_plotutils), gpic, ggi, terminal_
16447 @subsubsection Gnugraph(GNU plotutils)
16449 @c ?commands set terminal gnugraph
16450 @c ?set terminal gnugraph
16451 @c ?set term gnugraph
16452 @c ?terminal gnugraph
16458 The `gnugraph` driver produces device-independent output in the GNU plot
16459 graphics language. The default size of the PostScript results generated by
16460 "plot2ps" is 5 x 3 inches; this can be increased up to about 8.25 x 8.25 by
16465 set terminal gnugraph @{"<fontname>"@} @{<fontsize>@}
16466 @{type <pt>@} @{size "<size>"@}
16470 which defaults to 10-point "Courier".
16472 For `type`, the following options are accepted: `X`, `pnm`, `gif`, `ai`,
16473 `ps`, `cgm`, `fig`, `pcl5`, `hpgl`, `tek`, and `meta` (default). The
16474 @ref{size} option (default is a4) is passed straight through to plotutils, it's
16475 the user's responsibility to provide correct values. Details can be found
16476 in the plotutils documentation.
16480 set terminal gnugraph type hpgl size "a4"
16481 set terminal gnugraph size "a4,xoffset=-5mm,yoffset=2.0cm" type pnm
16485 There is a non-GNU version of the `gnugraph` driver which cannot be compiled
16486 unless this version is left out."
16488 @node gpic, gpic_, Gnugraph(GNU_plotutils), terminal_
16489 @subsubsection gpic
16491 @c ?commands set terminal gpic
16492 @c ?set terminal gpic
16500 The `gpic` terminal driver generates GPIC graphs in the Free Software
16501 Foundations's "groff" package. The default size is 5 x 3 inches. The only
16502 option is the origin, which defaults to (0,0).
16506 set terminal gpic @{<x> <y>@}
16510 where `x` and `y` are in inches.
16512 A simple graph can be formatted using
16515 groff -p -mpic -Tps file.pic > file.ps.
16519 The output from pic can be pipe-lined into eqn, so it is possible to put
16520 complex functions in a graph with the @ref{label} and `set @{x/y@}label`
16521 commands. For instance,
16524 set ylab '@@space 0 int from 0 to x alpha ( t ) roman d t@@'
16528 will label the y axis with a nice integral if formatted with the command:
16531 gpic filename.pic | geqn -d@@@@ -Tps | groff -m[macro-package] -Tps
16536 Figures made this way can be scaled to fit into a document. The pic language
16537 is easy to understand, so the graphs can be edited by hand if need be. All
16538 co-ordinates in the pic-file produced by `gnuplot` are given as x+gnuplotx
16539 and y+gnuploty. By default x and y are given the value 0. If this line is
16540 removed with an editor in a number of files, one can put several graphs in
16541 one figure like this (default size is 5.0x3.0 inches):
16557 This will produce an 8-inch-wide figure with four graphs in two rows on top
16560 One can also achieve the same thing by the command
16563 set terminal gpic x y
16576 @node gpic_, gpr, gpic, terminal_
16577 @subsubsection gpic
16579 @c ?commands set terminal gpic
16580 @c ?set terminal gpic
16588 The `gpic` terminal driver generates GPIC graphs in the Free Software
16589 Foundations's "groff" package. The default size is 5 x 3 inches. The only
16590 option is the origin, which defaults to (0,0).
16594 set terminal gpic @{<x> <y>@}
16598 where `x` and `y` are in inches.
16600 A simple graph can be formatted using
16603 groff -p -mpic -Tps file.pic > file.ps.
16607 The output from pic can be pipe-lined into eqn, so it is possible to put
16608 complex functions in a graph with the @ref{label} and `set @{x/y@}label`
16609 commands. For instance,
16612 set ylab '@@space 0 int from 0 to x alpha ( t ) roman d t@@'
16616 will label the y axis with a nice integral if formatted with the command:
16619 gpic filename.pic | geqn -d@@@@ -Tps | groff -m[macro-package] -Tps
16624 Figures made this way can be scaled to fit into a document. The pic language
16625 is easy to understand, so the graphs can be edited by hand if need be. All
16626 co-ordinates in the pic-file produced by `gnuplot` are given as x+gnuplotx
16627 and y+gnuploty. By default x and y are given the value 0. If this line is
16628 removed with an editor in a number of files, one can put several graphs in
16629 one figure like this (default size is 5.0x3.0 inches):
16645 This will produce an 8-inch-wide figure with four graphs in two rows on top
16648 One can also achieve the same thing by the command
16651 set terminal gpic x y
16664 @node gpr, grass, gpic_, terminal_
16667 @c ?commands set terminal gpr
16668 @c ?set terminal gpr
16676 The `gpr` terminal driver supports the Apollo Graphics Primitive Resource
16677 for a fixed-size window. It has no options.
16679 If a variable window size is desired, use the `apollo` terminal instead."
16681 @node grass, hp2623a, gpr, terminal_
16682 @subsubsection grass
16684 @c ?commands set terminal grass
16685 @c ?set terminal grass
16693 The `grass` terminal driver gives `gnuplot` capabilities to users of the
16694 GRASS geographic information system. Contact grassp-list@@moon.cecer.army.mil
16695 for more information. Pages are written to the current frame of the GRASS
16696 Graphics Window. There are no options."
16698 @node hp2623a, hp2648, grass, terminal_
16699 @subsubsection hp2623a
16701 @c ?commands set terminal hp2623a
16702 @c ?set terminal hp2623a
16703 @c ?set term hp2623a
16704 @c ?terminal hp2623a
16710 The `hp2623a` terminal driver supports the Hewlett Packard HP2623A. It has
16713 @node hp2648, hp500c, hp2623a, terminal_
16714 @subsubsection hp2648
16716 @c ?commands set terminal hp2648
16717 @c ?set terminal hp2648
16718 @c ?set term hp2648
16719 @c ?terminal hp2648
16725 The `hp2648` terminal driver supports the Hewlett Packard HP2647 and HP2648.
16726 It has no options."
16728 @node hp500c, hpgl, hp2648, terminal_
16729 @subsubsection hp500c
16731 @c ?commands set terminal hp500c
16732 @c ?set terminal hp500c
16733 @c ?set term hp500c
16734 @c ?terminal hp500c
16740 The `hp500c` terminal driver supports the Hewlett Packard HP DeskJet 500c.
16741 It has options for resolution and compression.
16745 set terminal hp500c @{<res>@} @{<comp>@}
16749 where `res` can be 75, 100, 150 or 300 dots per inch and `comp` can be "rle",
16750 or "tiff". Any other inputs are replaced by the defaults, which are 75 dpi
16751 and no compression. Rasterization at the higher resolutions may require a
16752 large amount of memory."
16754 @node hpgl, hpljii, hp500c, terminal_
16755 @subsubsection hpgl
16757 @c ?commands set terminal hpgl
16758 @c ?set terminal hpgl
16766 @c ?commands set terminal pcl5
16767 @c ?set terminal pcl5
16775 The `hpgl` driver produces HPGL output for devices like the HP7475A plotter.
16776 There are two options which can be set: the number of pens and `eject`,
16777 which tells the plotter to eject a page when done. The default is to use 6
16778 pens and not to eject the page when done.
16780 The international character sets ISO-8859-1 and CP850 are recognized via
16781 `set encoding iso_8859_1` or `set encoding cp850` (see @ref{encoding} for
16786 set terminal hpgl @{<number_of_pens>@} @{eject@}
16793 set terminal hpgl 8 eject
16797 is equivalent to the previous `hp7550` terminal, and the selection
16800 set terminal hpgl 4
16804 is equivalent to the previous `hp7580b` terminal.
16806 The `pcl5` driver supports plotters such as the Hewlett-Packard Designjet
16807 750C, the Hewlett-Packard Laserjet III, and the Hewlett-Packard Laserjet IV.
16808 It actually uses HPGL-2, but there is a name conflict among the terminal
16809 devices. It has several options which must be specified in the order
16814 set terminal pcl5 @{mode <mode>@} @{<plotsize>@}
16815 @{@{color @{<number_of_pens>@}@} | monochrome@} @{solid | dashed@}
16816 @{font <font>@} @{size <fontsize>@} @{pspoints | nopspoints@}
16820 <mode> is `landscape` or `portrait`. <plotsize> is the physical
16821 plotting size of the plot, which is one of the following: `letter` for
16822 standard (8 1/2" X 11") displays, `legal` for (8 1/2" X 14") displays,
16823 `noextended` for (36" X 48") displays (a letter size ratio) or,
16824 `extended` for (36" X 55") displays (almost a legal size ratio).
16825 `color` is for multi-pen (i.e. color) plots, and <number_of_pens> is
16826 the number of pens (i.e. colors) used in color plots. `monochrome` is for
16827 one (e.g. black) pen plots. `solid` draws all lines as solid lines, or
16828 `dashed` will draw lines with different dashed and dotted line patterns.
16829 <font> is `stick`, `univers`, `cg_times`, `zapf_dingbats`, `antique_olive`,
16830 `arial`, `courier`, `garamond_antigua`, `letter_gothic`, `cg_omega`,
16831 `albertus`, `times_new_roman`, `clarendon`, `coronet`, `marigold`,
16832 `truetype_symbols`, or `wingdings`. <fontsize> is the font size in points.
16833 The point type selection can be the standard default set by specifying
16834 `nopspoints`, or the same set of point types found in the postscript terminal
16835 by specifying `pspoints`.
16837 Note that built-in support of some of these options is printer device
16838 dependent. For instance, all the fonts are supposedly supported by the HP
16839 Laserjet IV, but only a few (e.g. univers, stick) may be supported by the HP
16840 Laserjet III and the Designjet 750C. Also, color obviously won't work on the
16841 the laserjets since they are monochrome devices.
16843 Defaults: landscape, noextended, color (6 pens), solid, univers, 12 point,
16849 With `pcl5` international characters are handled by the printer; you just put
16850 the appropriate 8-bit character codes into the text strings. You don't need
16851 to bother with @ref{encoding}.
16853 HPGL graphics can be imported by many software packages."
16855 @node hpljii, hppj, hpgl, terminal_
16856 @subsubsection hpljii
16858 @c ?commands set terminal hpljii
16859 @c ?set terminal hpljii
16860 @c ?set term hpljii
16861 @c ?terminal hpljii
16867 @c ?commands set terminal hpdj
16868 @c ?set terminal hpdj
16876 The `hpljii` terminal driver supports the HP Laserjet Series II printer. The
16877 `hpdj` driver supports the HP DeskJet 500 printer. These drivers allow a
16878 choice of resolutions.
16882 set terminal hpljii | hpdj @{<res>@}
16886 where `res` may be 75, 100, 150 or 300 dots per inch; the default is 75.
16887 Rasterization at the higher resolutions may require a large amount of memory.
16889 The `hp500c` terminal is similar to `hpdj`; `hp500c` additionally supports
16890 color and compression."
16892 @node hppj, imagen, hpljii, terminal_
16893 @subsubsection hppj
16895 @c ?commands set terminal hppj
16896 @c ?set terminal hppj
16904 The `hppj` terminal driver supports the HP PaintJet and HP3630 printers. The
16905 only option is the choice of font.
16909 set terminal hppj @{FNT5X9 | FNT9X17 | FNT13X25@}
16913 with the middle-sized font (FNT9X17) being the default."
16915 @node imagen, iris4d, hppj, terminal_
16916 @subsubsection imagen
16918 @c ?commands set terminal imagen
16919 @c ?set terminal imagen
16920 @c ?set term imagen
16921 @c ?terminal imagen
16927 The `imagen` terminal driver supports Imagen laser printers. It is capable
16928 of placing multiple graphs on a single page.
16932 set terminal imagen @{<fontsize>@} @{portrait | landscape@}
16933 @{[<horiz>,<vert>]@}
16937 where `fontsize` defaults to 12 points and the layout defaults to `landscape`.
16938 `<horiz>` and `<vert>` are the number of graphs in the horizontal and
16939 vertical directions; these default to unity.
16943 set terminal imagen portrait [2,3]
16947 puts six graphs on the page in three rows of two in portrait orientation."
16949 @node iris4d, kyo, imagen, terminal_
16950 @subsubsection iris4d
16952 @c ?commands set terminal iris4d
16953 @c ?set terminal iris4d
16954 @c ?set term iris4d
16955 @c ?terminal iris4d
16961 The `iris4d` terminal driver supports Silicon Graphics IRIS 4D computers.
16962 Its only option is 8- or 24-bit color depth. The default is 8.
16966 set terminal iris4d @{8 | 24@}
16970 The color depth is not really a choice -- the value appropriate for the
16971 hardware should be selected.
16973 When using 24-bit mode, the colors can be directly specified via the file
16974 .gnuplot_iris4d that is searched in the current directory and then in the
16975 home directory specified by the HOME environment variable. This file holds
16976 RGB values for the background, border, labels and nine plotting colors, in
16977 that order. For example, here is a file containing the default colors:
16980 85 85 85 Background (dark gray)
16981 0 0 0 Boundary (black)
16982 170 0 170 Labeling (magenta)
16983 85 255 255 Plot Color 1 (light cyan)
16984 170 0 0 Plot Color 2 (red)
16985 0 170 0 Plot Color 3 (green)
16986 255 85 255 Plot Color 4 (light magenta)
16987 255 255 85 Plot Color 5 (yellow)
16988 255 85 85 Plot Color 6 (light red)
16989 85 255 85 Plot Color 7 (light green)
16990 0 170 170 Plot Color 8 (cyan)
16991 170 170 0 Plot Color 9 (brown)
16995 This file must have exactly 12 lines of RGB triples. No empty lines are
16996 allowed, and anything after the third number on a line is ignored."
16998 @node kyo, latex, iris4d, terminal_
17001 @c ?commands set terminal kyo
17002 @c ?set terminal kyo
17010 @c ?commands set terminal prescribe
17011 @c ?set terminal prescribe
17012 @c ?set term prescribe
17013 @c ?terminal prescribe
17019 The `kyo` and `prescribe` terminal drivers support the Kyocera laser printer.
17020 The only difference between the two is that `kyo` uses "Helvetica" whereas
17021 `prescribe` uses "Courier". There are no options."
17023 @node latex, linux, kyo, terminal_
17024 @subsubsection latex
17026 @c ?commands set terminal emtex
17027 @c ?set terminal emtex
17035 @c ?commands set terminal latex
17036 @c ?set terminal latex
17046 set terminal @{latex | emtex@} @{default | @{courier|roman@} @{<fontsize>@}@}
17047 @{size <XX>@{unit@}, <YY>@{unit@}@}
17051 By default the plot will inherit font settings from the embedding document.
17052 You have the option of forcing either Courier (cmtt) or Roman (cmr) fonts
17053 instead. In this case you may also specify a fontsize.
17054 Unless your driver is capable of building fonts at any size (e.g. dvips),
17055 stick to the standard 10, 11 and 12 point sizes.
17057 METAFONT users beware: METAFONT does not like odd sizes.
17059 All drivers for LaTeX offer a special way of controlling text positioning:
17060 If any text string begins with '@{', you also need to include a '@}' at the
17061 end of the text, and the whole text will be centered both horizontally and
17062 vertically. If the text string begins with '[', you need to follow this with
17063 a position specification (up to two out of t,b,l,r), ']@{', the text itself,
17064 and finally '@}'. The text itself may be anything LaTeX can typeset as an
17065 LR-box. '\\rule@{@}@{@}'s may help for best positioning.
17067 Points, among other things, are drawn using the LaTeX commands "\\Diamond" and
17068 "\\Box". These commands no longer belong to the LaTeX2e core; they are included
17069 in the latexsym package, which is part of the base distribution and thus part
17070 of any LaTeX implementation. Please do not forget to use this package.
17072 The default size for the plot is 5 inches by 3 inches. The @ref{size} option
17073 changes this to whatever the user requests. By default the X and Y sizes
17074 are taken to be in inches, but other units are possible (currently only cm).
17077 About label positioning:
17078 Use gnuplot defaults (mostly sensible, but sometimes not really best):
17080 set title '\\LaTeX\\ -- $ \\gamma $'
17083 Force centering both horizontally and vertically:
17085 set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
17088 Specify own positioning (top here):
17090 set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
17093 The other label -- account for long ticlabels:
17095 set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
17099 @node linux, linux_, latex, terminal_
17100 @subsubsection linux
17102 @c ?commands set terminal linux
17103 @c ?set terminal linux
17111 The `linux` driver has no additional options to specify. It looks at the
17112 environment variable GSVGAMODE for the default mode; if not set, it uses
17113 1024x768x256 as default mode or, if that is not possible, 640x480x16
17116 @node linux_, macintosh, linux, terminal_
17117 @subsubsection linux
17119 @c ?commands set terminal linux
17120 @c ?set terminal linux
17128 The `linux` driver has no additional options to specify. It looks at the
17129 environment variable GSVGAMODE for the default mode; if not set, it uses
17130 1024x768x256 as default mode or, if that is not possible, 640x480x16
17133 @node macintosh, mf, linux_, terminal_
17134 @subsubsection macintosh
17136 @c ?set terminal macintosh
17137 @c ?set term macintosh
17138 @c ?terminal macintosh
17144 Several options may be set in the 'macintosh' driver.
17148 set terminal macintosh @{singlewin | multiwin@} @{vertical | novertical@}
17149 @{size <width>, <height> | default@}
17153 'singlewin' limits the output to a single window and is useful for animations.
17154 'multiwin' allows multiple windows.
17155 'vertical' is only valid under the gx option. With this option, rotated text
17157 be drawn vertically. novertical turns this option off.
17158 size <width>, <height> overrides the graph size set in the preferences
17159 dialog until it is cleared with either 'set term mac size default'
17160 or 'set term mac default'.
17165 'set term mac size default' sets the window size settings to those set in
17166 the preferences dialog.
17171 'set term mac default' sets all options to their default values.
17172 Default values: nogx, multiwin, novertical.
17177 If you generate graphs under the multiwin option and then switch to singlewin,
17178 the next plot command will cause one more window to be created. This new
17179 window will be reused as long as singlewin is in effect. If you switch back
17180 to multiwin, generate some graphs, and then switch to singlewin again, the
17181 orginal 'singlewin' window will be resused if it is still open. Otherwise
17182 a new 'singlewin' window will be created. The 'singlewin' window is not numbered."
17186 @node mf, mp, macintosh, terminal_
17189 @c ?commands set terminal mf
17190 @c ?set terminal mf
17198 The `mf` terminal driver creates an input file to the METAFONT program. Thus a
17199 figure may be used in the TeX document in the same way as is a character.
17201 To use a picture in a document, the METAFONT program must be run with the
17202 output file from `gnuplot` as input. Thus, the user needs a basic knowledge
17203 of the font creating process and the procedure for including a new font in a
17204 document. However, if the METAFONT program is set up properly at the local
17205 site, an unexperienced user could perform the operation without much trouble.
17207 The text support is based on a METAFONT character set. Currently the
17208 Computer Modern Roman font set is input, but the user is in principal free to
17209 choose whatever fonts he or she needs. The METAFONT source files for the
17210 chosen font must be available. Each character is stored in a separate
17211 picture variable in METAFONT. These variables may be manipulated (rotated,
17212 scaled etc.) when characters are needed. The drawback is the interpretation
17213 time in the METAFONT program. On some machines (i.e. PC) the limited amount
17214 of memory available may also cause problems if too many pictures are stored.
17216 The `mf` terminal has no options.
17219 @noindent --- METAFONT INSTRUCTIONS ---
17221 @c ?commands set terminal mf detailed
17222 @c ?set terminal mf detailed
17223 @c ?set term mf detailed
17225 @c ?metafont detailed
17227 - Set your terminal to METAFONT:
17232 - Select an output-file, e.g.:
17234 set output "myfigures.mf"
17237 - Create your pictures. Each picture will generate a separate character. Its
17238 default size will be 5*3 inches. You can change the size by saying `set size
17239 0.5,0.5` or whatever fraction of the default size you want to have.
17243 - Generate a TFM and GF file by running METAFONT on the output of `gnuplot`.
17244 Since the picture is quite large (5*3 in), you will have to use a version of
17245 METAFONT that has a value of at least 150000 for memmax. On Unix systems
17246 these are conventionally installed under the name bigmf. For the following
17247 assume that the command virmf stands for a big version of METAFONT. For
17255 - Select the output device: At the METAFONT prompt ('*') type:
17257 \\mode:=CanonCX; % or whatever printer you use
17260 - Optionally select a magnification:
17262 mag:=1; % or whatever you wish
17265 - Input the `gnuplot`-file:
17270 On a typical Unix machine there will usually be a script called "mf" that
17271 executes virmf '&plain', so you probably can substitute mf for virmf &plain.
17272 This will generate two files: mfput.tfm and mfput.$$$gf (where $$$ indicates
17273 the resolution of your device). The above can be conveniently achieved by
17274 typing everything on the command line, e.g.:
17275 virmf '&plain' '\\mode:=CanonCX; mag:=1; input myfigures.mf'
17276 In this case the output files will be named myfigures.tfm and
17279 - Generate a PK file from the GF file using gftopk:
17281 gftopk myfigures.300gf myfigures.300pk
17284 The name of the output file for gftopk depends on the DVI driver you use.
17285 Ask your local TeX administrator about the naming conventions. Next, either
17286 install the TFM and PK files in the appropriate directories, or set your
17287 environment variables properly. Usually this involves setting TEXFONTS to
17288 include the current directory and doing the same thing for the environment
17289 variable that your DVI driver uses (no standard name here...). This step is
17290 necessary so that TeX will find the font metric file and your DVI driver will
17293 - To include your pictures in your document you have to tell TeX the font:
17295 \\font\\gnufigs=myfigures
17298 Each picture you made is stored in a single character. The first picture is
17299 character 0, the second is character 1, and so on... After doing the above
17300 step, you can use the pictures just like any other characters. Therefore, to
17301 place pictures 1 and 2 centered in your document, all you have to do is:
17303 \\centerline@{\\gnufigs\\char0@}
17304 \\centerline@{\\gnufigs\\char1@}
17307 in plain TeX. For LaTeX you can, of course, use the picture environment and
17308 place the picture wherever you wish by using the \\makebox and \\put macros.
17310 This conversion saves you a lot of time once you have generated the font;
17311 TeX handles the pictures as characters and uses minimal time to place them,
17312 and the documents you make change more often than the pictures do. It also
17313 saves a lot of TeX memory. One last advantage of using the METAFONT driver
17314 is that the DVI file really remains device independent, because no \\special
17315 commands are used as in the eepic and tpic drivers."
17317 @node mp, mgr, mf, terminal_
17320 @c ?commands set terminal mpost
17321 @c ?set terminal mp
17330 The `mp` driver produces output intended to be input to the Metapost program.
17331 Running Metapost on the file creates EPS files containing the plots. By
17332 default, Metapost passes all text through TeX. This has the advantage of
17333 allowing essentially any TeX symbols in titles and labels.
17337 set term mp @{color | colour | monochrome@}
17339 @{notex | tex | latex@}
17340 @{magnification <magsize>@}
17341 @{psnfss | psnfss-version7 | nopsnfss@}
17342 @{prologues <value>@}
17345 @{"<fontname>"@} @{<fontsize>@}
17349 The option `color` causes lines to be drawn in color (on a printer or display
17350 that supports it), `monochrome` (or nothing) selects black lines. The option
17351 `solid` draws solid lines, while `dashed` (or nothing) selects lines with
17352 different patterns of dashes. If `solid` is selected but `color` is not,
17353 nearly all lines will be identical. This may occasionally be useful, so it is
17356 The option `notex` bypasses TeX entirely, therefore no TeX code can be used in
17357 labels under this option. This is intended for use on old plot files or files
17358 that make frequent use of common characters like `$` and `%` that require
17359 special handling in TeX.
17361 The option `tex` sets the terminal to output its text for TeX to process.
17363 The option `latex` sets the terminal to output its text for processing by
17364 LaTeX. This allows things like \\frac for fractions which LaTeX knows about
17365 but TeX does not. Note that you must set the environment variable TEX to the
17366 name of your LaTeX executable (normally latex) if you use this option or use
17367 `mpost --tex=<name of LaTeX executable> ...`. Otherwise metapost will try and
17368 use TeX to process the text and it won't work.
17370 Changing font sizes in TeX has no effect on the size of mathematics, and there
17371 is no foolproof way to make such a change, except by globally setting a
17372 magnification factor. This is the purpose of the `magnification` option. It
17373 must be followed by a scaling factor. All text (NOT the graphs) will be scaled
17374 by this factor. Use this if you have math that you want at some size other
17375 than the default 10pt. Unfortunately, all math will be the same size, but see
17376 the discussion below on editing the MP output. `mag` will also work under
17377 `notex` but there seems no point in using it as the font size option (below)
17380 The option `psnfss` uses postscript fonts in combination with LaTeX. Since
17381 this option only makes sense, if LaTeX is being used, the `latex` option is selected
17382 automatically. This option includes the following packages for LaTeX:
17383 inputenc(latin1), fontenc(T1), mathptmx, helvet(scaled=09.2), courier, latexsym
17386 The option `psnfss-version7` uses also postscript fonts in LaTeX (option `latex`
17387 is also automatically selected), but uses the following packages with LaTeX:
17388 inputenc(latin1), fontenc(T1), times, mathptmx, helvet and courier.
17390 The option `nopsnfss` is the default and uses the standard font (cmr10 if not
17391 otherwise specified).
17393 The option `prologues` takes a value as an additional argument and adds the line
17394 `prologues:=<value>` to the metapost file. If a value of `2` is specified metapost
17395 uses postscript fonts to generate the eps-file, so that the result can be viewed
17396 using e.g. ghostscript. Normally the output of metapost uses TeX fonts and therefore
17397 has to be included in a (La)TeX file before you can look at it.
17399 The option `noprologues` is the default. No additional line specifying the prologue
17402 The option `a4paper` adds a `[a4paper]` to the documentclass. Normally letter paper
17403 is used (default). Since this option is only used in case of LaTeX, the `latex` option
17404 is selected automatically.
17406 The option `amstex` automatically selects the `latex` option and includes the following
17407 LaTeX packages: amsfonts, amsmath(intlimits). By default these packages are not
17410 A name in quotes selects the font that will be used when no explicit font is
17411 given in a @ref{label} or @ref{title}. A name recognized by TeX (a TFM file
17412 exists) must be used. The default is "cmr10" unless `notex` is selected,
17413 then it is "pcrr8r" (Courier). Even under `notex`, a TFM file is needed by
17414 Metapost. The file `pcrr8r.tfm` is the name given to Courier in LaTeX's psnfss
17415 package. If you change the font from the `notex` default, choose a font that
17416 matches the ASCII encoding at least in the range 32-126. `cmtt10` almost
17417 works, but it has a nonblank character in position 32 (space).
17419 The size can be any number between 5.0 and 99.99. If it is omitted, 10.0 is
17420 used. It is advisable to use `magstep` sizes: 10 times an integer or
17421 half-integer power of 1.2, rounded to two decimals, because those are the most
17422 available sizes of fonts in TeX systems.
17424 All the options are optional. If font information is given, it must be at the
17425 end, with size (if present) last. The size is needed to select a size for the
17426 font, even if the font name includes size information. For example,
17427 `set term mp "cmtt12"` selects cmtt12 shrunk to the default size 10. This
17428 is probably not what you want or you would have used cmtt10.
17430 The following common ascii characters need special treatment in TeX:
17432 $, &, #, %, _; |, <, >; ^, ~, \\, @{, and @}
17435 The five characters $, #, &, _, and % can simply be escaped, e.g., `\\$`.
17436 The three characters <, >, and | can be wrapped in math mode, e.g., `$<$`.
17437 The remainder require some TeX work-arounds. Any good book on TeX will give
17440 If you type your labels inside double quotes, backslashes in TeX code need to
17441 be escaped (doubled). Using single quotes will avoid having to do this, but
17442 then you cannot use `\\n` for line breaks. As of this writing, version 3.7 of
17443 gnuplot processes titles given in a `plot` command differently than in other
17444 places, and backslashes in TeX commands need to be doubled regardless of the
17447 Metapost pictures are typically used in TeX documents. Metapost deals with
17448 fonts pretty much the same way TeX does, which is different from most other
17449 document preparation programs. If the picture is included in a LaTeX document
17450 using the graphics package, or in a plainTeX document via epsf.tex, and then
17451 converted to PostScript with dvips (or other dvi-to-ps converter), the text in
17452 the plot will usually be handled correctly. However, the text may not appear
17453 if you send the Metapost output as-is to a PostScript interpreter.
17457 @noindent --- METAPOST INSTRUCTIONS ---
17459 @c ?commands set terminal mp detailed
17460 @c ?set terminal mp detailed
17461 @c ?set term mp detailed
17463 @c ?metapost detailed
17465 - Set your terminal to Metapost, e.g.:
17467 set terminal mp mono "cmtt12" 12
17471 - Select an output-file, e.g.:
17473 set output "figure.mp"
17477 - Create your pictures. Each plot (or multiplot group) will generate a
17478 separate Metapost beginfig...endfig group. Its default size will be 5 by 3
17479 inches. You can change the size by saying `set size 0.5,0.5` or whatever
17480 fraction of the default size you want to have.
17484 - Generate EPS files by running Metapost on the output of gnuplot:
17486 mpost figure.mp OR mp figure.mp
17489 The name of the Metapost program depends on the system, typically `mpost` for
17490 a Unix machine and `mp` on many others. Metapost will generate one EPS file
17493 - To include your pictures in your document you can use the graphics package
17494 in LaTeX or epsf.tex in plainTeX:
17496 \\usepackage@{graphics@} % LaTeX
17497 \\input epsf.tex % plainTeX
17500 If you use a driver other than dvips for converting TeX DVI output to PS, you
17501 may need to add the following line in your LaTeX document:
17503 \\DeclareGraphicsRule@{*@}@{eps@}@{*@}@{@}
17506 Each picture you made is in a separate file. The first picture is in, e.g.,
17507 figure.0, the second in figure.1, and so on.... To place the third picture in
17508 your document, for example, all you have to do is:
17510 \\includegraphics@{figure.2@} % LaTeX
17511 \\epsfbox@{figure.2@} % plainTeX
17515 The advantage, if any, of the mp terminal over a postscript terminal is
17516 editable output. Considerable effort went into making this output as clean as
17517 possible. For those knowledgeable in the Metapost language, the default line
17518 types and colors can be changed by editing the arrays `lt[]` and `col[]`.
17519 The choice of solid vs dashed lines, and color vs black lines can be change by
17520 changing the values assigned to the booleans `dashedlines` and `colorlines`.
17521 If the default `tex` option was in effect, global changes to the text of
17522 labels can be achieved by editing the `vebatimtex...etex` block. In
17523 particular, a LaTeX preamble can be added if desired, and then LaTeX's
17524 built-in size changing commands can be used for maximum flexibility. Be sure
17525 to set the appropriate MP configuration variable to force Metapost to run
17526 LaTeX instead of plainTeX."
17528 @node mgr, mif, mp, terminal_
17531 @c ?commands set terminal mgr
17532 @c ?set terminal mgr
17540 The `mgr` terminal driver supports the Mgr Window system. It has no options."
17542 @node mif, mtos, mgr, terminal_
17545 @c ?commands set terminal mif
17546 @c ?set terminal mif
17554 The `mif` terminal driver produces Frame Maker MIF format version 3.00. It
17555 plots in MIF Frames with the size 15*10 cm, and plot primitives with the same
17556 pen will be grouped in the same MIF group. Plot primitives in a `gnuplot`
17557 page will be plotted in a MIF Frame, and several MIF Frames are collected in
17558 one large MIF Frame. The MIF font used for text is "Times".
17560 Several options may be set in the MIF 3.00 driver.
17564 set terminal mif @{color | colour | monochrome@} @{polyline | vectors@}
17569 `colour` plots lines with line types >= 0 in colour (MIF sep. 2--7) and
17570 `monochrome` plots all line types in black (MIF sep. 0).
17571 `polyline` plots curves as continuous curves and `vectors` plots curves as
17572 collections of vectors.
17573 @ref{help} and `?` print online help on standard error output---both print a
17574 short description of the usage; @ref{help} also lists the options.
17578 set term mif colour polylines # defaults
17579 set term mif # defaults
17580 set term mif vectors
17585 @node mtos, next, mif, terminal_
17586 @subsubsection mtos
17588 @c ?commands set terminal mtos
17589 @c ?set terminal mtos
17597 The `mtos` terminal has no options. It sends data via a pipe to an external
17598 program called GPCLIENT. It runs under MULTITOS, Magic 3.x, MagicMAC. and
17599 MiNT. If you cannot find GPCLIENT, than mail to dirk@@lstm.uni-erlangen.de."
17601 @node next, Openstep_(next), mtos, terminal_
17602 @subsubsection next
17604 @c ?commands set terminal next
17605 @c ?set terminal next
17613 Several options may be set in the next driver.
17617 set terminal next @{<mode>@} @{<type> @} @{<color>@} @{<dashed>@}
17618 @{"<fontname>"@} @{<fontsize>@} title @{"<newtitle>"@}
17622 where <mode> is `default`, which sets all options to their defaults;
17623 <type> is either `new` or `old`, where `old` invokes the old single window;
17624 <color> is either `color` or `monochrome`;
17625 <dashed> is either `solid` or `dashed`;
17626 "<fontname>" is the name of a valid PostScript font;
17627 <fontsize> is the size of the font in PostScript points; and
17628 <title> is the title for the GnuTerm window.
17629 Defaults are `new`, `monochrome`, `dashed`, "Helvetica", 14pt.
17633 set term next default
17635 set term next color "Times-Roman" 14
17636 set term next color "Helvetica" 12 title "MyPlot"
17641 Pointsizes may be changed with `set linestyle`."
17643 @node Openstep_(next), pbm, next, terminal_
17644 @subsubsection Openstep (next)
17646 @c ?commands set terminal openstep
17647 @c ?set terminal openstep
17648 @c ?set term openstep
17649 @c ?terminal openstep
17663 Several options may be set in the openstep (next) driver.
17667 set terminal openstep @{<mode>@} @{<type> @} @{<color>@} @{<dashed>@}
17668 @{"<fontname>"@} @{<fontsize>@} title @{"<newtitle>"@}
17672 where <mode> is `default`, which sets all options to their defaults;
17673 <type> is either `new` or `old`, where `old` invokes the old single window;
17674 <color> is either `color` or `monochrome`;
17675 <dashed> is either `solid` or `dashed`;
17676 "<fontname>" is the name of a valid PostScript font;
17677 <fontsize> is the size of the font in PostScript points; and
17678 <title> is the title for the GnuTerm window.
17679 Defaults are `new`, `monochrome`, `dashed`, "Helvetica", 14pt.
17683 set term openstep default
17684 set term openstep 22
17685 set term openstep color "Times-Roman" 14
17686 set term openstep color "Helvetica" 12 title "MyPlot"
17687 set term openstep old
17691 Pointsizes may be changed with `set linestyle`."
17693 @node pbm, dospc, Openstep_(next), terminal_
17696 @c ?commands set terminal pbm
17697 @c ?set terminal pbm
17705 Several options may be set in the `pbm` terminal---the driver for PBMplus.
17709 set terminal pbm @{<fontsize>@} @{<mode>@} @{size <x>,<y>@}
17713 where <fontsize> is `small`, `medium`, or `large` and <mode> is `monochrome`,
17714 `gray` or `color`. The default plot size is 640 pixels wide and 480 pixels
17717 The output of the `pbm` driver depends upon <mode>: `monochrome` produces a
17718 portable bitmap (one bit per pixel), `gray` a portable graymap (three bits
17719 per pixel) and `color` a portable pixmap (color, four bits per pixel).
17721 The output of this driver can be used with various image conversion and
17722 manipulation utilities provided by NETPBM. Based on Jef Poskanzer's
17723 PBMPLUS package, NETPBM provides programs to convert the above PBM formats
17724 to GIF, TIFF, MacPaint, Macintosh PICT, PCX, X11 bitmap and many others.
17725 Complete information is available at http://netpbm.sourceforge.net/.
17729 set terminal pbm small monochrome # defaults
17730 set terminal pbm color medium size 800,600
17731 set output '| pnmrotate 45 | pnmtopng > tilted.png' # uses NETPBM"
17735 @node dospc, pdf, pbm, terminal_
17736 @subsubsection dospc
17738 @c ?commands set terminal dospc
17739 @c ?set terminal dospc
17747 The `dospc` terminal driver supports PCs with arbitrary graphics boards,
17748 which will be automatically detected. It should be used only if you are
17749 not using the gcc or Zortec C/C++ compilers."
17751 @node pdf, pstricks, dospc, terminal_
17754 @c ?commands set terminal pdf
17755 @c ?set terminal pdf
17763 This terminal produces files in the Adobe Portable Document Format
17764 (PDF), useable for printing or display with tools like Acrobat Reader
17768 set terminal pdf @{monochrome|color|colour@}
17770 @{fname "<font>"@} @{fsize <fontsize>@}
17771 @{font "<fontname>@{,<fontsize>@}"@}
17772 @{linewidth <lw>@} @{rounded|butt@}
17773 @{solid|dashed@} @{dl <dashlength>@}@}
17774 @{size <XX>@{unit@},<YY>@{unit@}@}
17778 The default is to use a different color for each line type. Selecting
17779 `monochome` will use black for all linetypes, in which case you probably
17780 want to select `dashed` to distinguish line types. Even in in mono mode
17781 you can still use explicit colors for filled areas or linestyles.
17783 where <font> is the name of the default font to use (default Helvetica)
17784 and <fontsize> is the font size (in points, default 12).
17785 For help on which fonts are available or how to install new ones, please
17786 see the documentation for your local installation of pdflib.
17788 The `enhanced` option enables enhanced text processing features
17789 (subscripts, superscripts and mixed fonts). See `enhanced`.
17791 The width of all lines in the plot can be increased by the factor <n>
17792 specified in `linewidth`. Similarly `dashlength` is a multiplier for the
17793 default dash spacing.
17795 `rounded` sets line caps and line joins to be rounded; `butt` is the
17796 default, butt caps and mitered joins.
17798 The default size for PDF output is 5 inches by 3 inches. The @ref{size} option
17799 changes this to whatever the user requests. By default the X and Y sizes
17800 are taken to be in inches, but other units are possible (currently only cm).
17804 @node pstricks, qms, pdf, terminal_
17805 @subsubsection pstricks
17807 @c ?commands set terminal pstricks
17808 @c ?set terminal pstricks
17809 @c ?set term pstricks
17810 @c ?terminal pstricks
17816 The `pstricks` driver is intended for use with the "pstricks.sty" macro
17817 package for LaTeX. It is an alternative to the `eepic` and `latex` drivers.
17818 You need "pstricks.sty", and, of course, a printer that understands
17819 PostScript, or a converter such as Ghostscript.
17821 PSTricks is available via anonymous ftp from the /pub directory at
17822 Princeton.edu. This driver definitely does not come close to using the full
17823 capability of the PSTricks package.
17827 set terminal pstricks @{hacktext | nohacktext@} @{unit | nounit@}
17831 The first option invokes an ugly hack that gives nicer numbers; the second
17832 has to do with plot scaling. The defaults are `hacktext` and `nounit`."
17834 @node qms, regis, pstricks, terminal_
17837 @c ?commands set terminal qms
17838 @c ?set terminal qms
17846 The `qms` terminal driver supports the QMS/QUIC Laser printer, the Talaris
17847 1200 and others. It has no options."
17849 @node regis, regis_, qms, terminal_
17850 @subsubsection regis
17852 @c ?commands set terminal regis
17853 @c ?set terminal regis
17861 The `regis` terminal device generates output in the REGIS graphics language.
17862 It has the option of using 4 (the default) or 16 colors.
17866 set terminal regis @{4 | 16@}"
17870 @node regis_, rgip, regis, terminal_
17871 @subsubsection regis
17873 @c ?commands set terminal regis
17874 @c ?set terminal regis
17882 The `regis` terminal device generates output in the REGIS graphics language.
17883 It has the option of using 4 (the default) or 16 colors.
17887 set terminal regis @{4 | 16@}"
17891 @node rgip, sun, regis_, terminal_
17892 @subsubsection rgip
17894 @c ?commands set terminal rgip
17895 @c ?set terminal rgip
17903 @c ?commands set terminal uniplex
17904 @c ?set terminal uniplex
17905 @c ?set term uniplex
17906 @c ?terminal uniplex
17912 The `rgip` and `uniplex` terminal drivers support RGIP metafiles. They can
17913 combine several graphs on a single page, but only one page is allowed in a
17918 set terminal rgip | uniplex @{portrait | landscape@}
17919 @{[<horiz>,<vert>]@} @{<fontsize>@}
17923 permissible values for the font size are in the range 1--8, with the default
17924 being 1. The default layout is landscape. Graphs are placed on the page in
17925 a `horiz`x`vert` grid, which defaults to [1,1].
17929 set terminal uniplex portrait [2,3]
17933 puts six graphs on a page in three rows of two in portrait orientation."
17935 @node sun, svg, rgip, terminal_
17938 @c ?commands set terminal sun
17939 @c ?set terminal sun
17947 The `sun` terminal driver supports the SunView window system. It has no
17950 @node svg, tek410x, sun, terminal_
17953 @c ?commands set terminal svg
17954 @c ?set terminal svg
17962 This terminal produces files in the W3C Scalable Vector Graphics format.
17966 set terminal svg @{size <x>,<y> @{|fixed|dynamic@}@}
17968 @{fname "<font>"@} @{fsize <fontsize>@}
17969 @{font "<fontname>@{,<fontsize>@}"@}
17970 @{fontfile <filename>@}
17971 @{rounded|butt@} @{solid|dashed@} @{linewidth <lw>@}
17975 where <x> and <y> are the size of the SVG plot to generate,
17976 `dynamic` allows a svg-viewer to resize plot, whereas the default
17977 setting, `fixed`, will request an absolute size.
17979 `linewidth <w>` increases the width of all lines used in the figure
17980 by a factor of <w>.
17982 <font> is the name of the default font to use (default Arial) and
17983 <fontsize> is the font size (in points, default 12). SVG viewing
17984 programs may substitute other fonts when the file is displayed.
17986 The svg terminal supports an enhanced text mode, which allows font
17987 and other formatting commands to be embedded in labels and other text
17988 strings. The enhanced text mode syntax is shared with other gnuplot
17989 terminal types. See `enhanced` for more details.
17991 SVG allows you to embed fonts directly into an SVG document, or to
17992 provide a hypertext link to the desired font. The `fontfile` option
17993 specifies a local file which is copied into the <defs> section of the
17994 resulting SVG output file. This file may either itself contain a font,
17995 or may contain the records necessary to create a hypertext reference to
17996 the desired font. Gnuplot will look for the requested file using the
17997 directory list in the GNUPLOT_FONTPATH environmental variable.
17998 NB: You must embed an svg font, not a TrueType or PostScript font."
18000 @node tek410x, tek410x_, svg, terminal_
18001 @subsubsection tek410x
18003 @c ?commands set terminal tek410x
18004 @c ?set terminal tek410x
18005 @c ?set term tek410x
18006 @c ?terminal tek410x
18012 The `tek410x` terminal driver supports the 410x and 420x family of Tektronix
18013 terminals. It has no options."
18015 @node tek410x_, tek40, tek410x, terminal_
18016 @subsubsection tek410x
18018 @c ?commands set terminal tek410x
18019 @c ?set terminal tek410x
18020 @c ?set term tek410x
18021 @c ?terminal tek410x
18027 The `tek410x` terminal driver supports the 410x and 420x family of Tektronix
18028 terminals. It has no options."
18030 @node tek40, texdraw, tek410x_, terminal_
18031 @subsubsection tek40
18033 @c ?commands set terminal tek40xx
18034 @c ?set terminal tek40xx
18035 @c ?set term tek40xx
18036 @c ?terminal tek40xx
18042 @c ?commands set terminal vttek
18043 @c ?set terminal vttek
18051 @c ?commands set terminal kc-tek40xx
18052 @c ?set terminal kc-tek40xx
18053 @c ?set term kc-tek40xx
18054 @c ?terminal kc-tek40xx
18055 @c ?term kc-tek40xx
18057 @tmindex kc-tek40xx
18060 @c ?commands set terminal km-tek40xx
18061 @c ?set terminal km-tek40xx
18062 @c ?set term km-tek40xx
18063 @c ?terminal km-tek40xx
18064 @c ?term km-tek40xx
18066 @tmindex km-tek40xx
18069 @c ?commands set terminal selanar
18070 @c ?set terminal selanar
18071 @c ?set term selanar
18072 @c ?terminal selanar
18078 @c ?commands set terminal bitgraph
18079 @c ?set terminal bitgraph
18080 @c ?set term bitgraph
18081 @c ?terminal bitgraph
18087 @c ?commands set terminal xterm
18088 @c ?set terminal xterm
18096 This family of terminal drivers supports a variety of VT-like terminals.
18097 `tek40xx` supports Tektronix 4010 and others as well as most TEK emulators;
18098 `vttek` supports VT-like tek40xx terminal emulators; `kc-tek40xx` supports
18099 MS-DOS Kermit Tek4010 terminal emulators in color: `km-tek40xx` supports them
18100 in monochrome; `selanar` supports Selanar graphics; and `bitgraph` supports
18101 BBN Bitgraph terminals. None have any options."
18103 @node texdraw, tgif, tek40, terminal_
18104 @subsubsection texdraw
18106 @c ?commands set terminal texdraw
18107 @c ?set terminal texdraw
18108 @c ?set term texdraw
18109 @c ?terminal texdraw
18115 The `texdraw` terminal driver supports the LaTeX texdraw environment. It is
18116 intended for use with "texdraw.sty" and "texdraw.tex" in the texdraw package.
18118 Points, among other things, are drawn using the LaTeX commands "\\Diamond" and
18119 "\\Box". These commands no longer belong to the LaTeX2e core; they are included
18120 in the latexsym package, which is part of the base distribution and thus part
18121 of any LaTeX implementation. Please do not forget to use this package.
18123 It has no options."
18125 @node tgif, tgif_, texdraw, terminal_
18126 @subsubsection tgif
18128 @c ?commands set terminal tgif
18129 @c ?set terminal tgif
18137 Tgif is an X11-based drawing tool---it has nothing to do with GIF.
18139 The `tgif` driver supports different pointsizes (with @ref{pointsize}),
18140 different label fonts and font sizes (e.g. `set label "Hallo" at x,y font
18141 "Helvetica,34"`) and multiple graphs on the page. The proportions of the
18142 axes are not changed.
18146 set terminal tgif @{portrait | landscape | default@} @{<[x,y]>@}
18147 @{monochrome | color@}
18148 @{@{linewidth | lw@} <LW>@}
18150 @{font "<fontname>"@} @{<fontsize>@}
18154 where <[x,y]> specifies the number of graphs in the x and y directions on the
18155 page, `color` enables color, `linewidth` scales all linewidths by <LW>,
18156 "<fontname>" is the name of a valid PostScript font, and <fontsize>
18157 specifies the size of the PostScript font.
18158 `defaults` sets all options to their defaults: `portrait`, `[1,1]`, `color`,
18159 `linwidth 1.0`, `dashed`, `"Helvetica"`, and `18`.
18161 The `solid` option is usually prefered if lines are colored, as they often
18162 are in the editor. Hardcopy will be black-and-white, so `dashed` should be
18165 Multiplot is implemented in two different ways.
18167 The first multiplot implementation is the standard gnuplot multiplot feature:
18171 set output "file.obj"
18183 See @ref{multiplot} for further information.
18185 The second version is the [x,y] option for the driver itself. The advantage
18186 of this implementation is that everything is scaled and placed automatically
18187 without the need for setting origins and sizes; the graphs keep their natural
18188 x/y proportions of 3/2 (or whatever is fixed by @ref{size}).
18190 If both multiplot methods are selected, the standard method is chosen and a
18191 warning message is given.
18193 Examples of single plots (or standard multiplot):
18195 set terminal tgif # defaults
18196 set terminal tgif "Times-Roman" 24
18197 set terminal tgif landscape
18198 set terminal tgif landscape solid
18202 Examples using the built-in multiplot mechanism:
18204 set terminal tgif portrait [2,4] # portrait; 2 plots in the x-
18205 # and 4 in the y-direction
18206 set terminal tgif [1,2] # portrait; 1 plot in the x-
18207 # and 2 in the y-direction
18208 set terminal tgif landscape [3,3] # landscape; 3 plots in both
18213 @node tgif_, tkcanvas, tgif, terminal_
18214 @subsubsection tgif
18216 @c ?commands set terminal tgif
18217 @c ?set terminal tgif
18225 Tgif is an X11-based drawing tool---it has nothing to do with GIF.
18227 The `tgif` driver supports different pointsizes (with @ref{pointsize}),
18228 different label fonts and font sizes (e.g. `set label "Hallo" at x,y font
18229 "Helvetica,34"`) and multiple graphs on the page. The proportions of the
18230 axes are not changed.
18234 set terminal tgif @{portrait | landscape | default@} @{<[x,y]>@}
18235 @{monochrome | color@}
18236 @{@{linewidth | lw@} <LW>@}
18238 @{font "<fontname>"@} @{<fontsize>@}
18242 where <[x,y]> specifies the number of graphs in the x and y directions on the
18243 page, `color` enables color, `linewidth` scales all linewidths by <LW>,
18244 "<fontname>" is the name of a valid PostScript font, and <fontsize>
18245 specifies the size of the PostScript font.
18246 `defaults` sets all options to their defaults: `portrait`, `[1,1]`, `color`,
18247 `linwidth 1.0`, `dashed`, `"Helvetica"`, and `18`.
18249 The `solid` option is usually prefered if lines are colored, as they often
18250 are in the editor. Hardcopy will be black-and-white, so `dashed` should be
18253 Multiplot is implemented in two different ways.
18255 The first multiplot implementation is the standard gnuplot multiplot feature:
18259 set output "file.obj"
18271 See @ref{multiplot} for further information.
18273 The second version is the [x,y] option for the driver itself. The advantage
18274 of this implementation is that everything is scaled and placed automatically
18275 without the need for setting origins and sizes; the graphs keep their natural
18276 x/y proportions of 3/2 (or whatever is fixed by @ref{size}).
18278 If both multiplot methods are selected, the standard method is chosen and a
18279 warning message is given.
18281 Examples of single plots (or standard multiplot):
18283 set terminal tgif # defaults
18284 set terminal tgif "Times-Roman" 24
18285 set terminal tgif landscape
18286 set terminal tgif landscape solid
18290 Examples using the built-in multiplot mechanism:
18292 set terminal tgif portrait [2,4] # portrait; 2 plots in the x-
18293 # and 4 in the y-direction
18294 set terminal tgif [1,2] # portrait; 1 plot in the x-
18295 # and 2 in the y-direction
18296 set terminal tgif landscape [3,3] # landscape; 3 plots in both
18301 @node tkcanvas, tpic, tgif_, terminal_
18302 @subsubsection tkcanvas
18304 @c ?commands set terminal tkcanvas
18305 @c ?set terminal tkcanvas
18306 @c ?set term tkcanvas
18307 @c ?terminal tkcanvas
18313 This terminal driver generates Tk canvas widget commands based on Tcl/Tk
18314 (default) or Perl. To use it, rebuild `gnuplot` (after uncommenting or
18315 inserting the appropriate line in "term.h"), then
18318 gnuplot> set term tkcanvas @{perltk@} @{interactive@}
18319 gnuplot> set output 'plot.file'
18323 After invoking "wish", execute the following sequence of Tcl/Tk commands:
18333 Or, for Perl/Tk use a program like this:
18337 my $top = MainWindow->new;
18338 my $c = $top->Canvas->pack;
18339 my $gnuplot = do "plot.pl";
18345 The code generated by `gnuplot` creates a procedure called "gnuplot"
18346 that takes the name of a canvas as its argument. When the procedure is
18347 called, it clears the canvas, finds the size of the canvas and draws the plot
18348 in it, scaled to fit.
18350 For 2-dimensional plotting (`plot`) two additional procedures are defined:
18351 "gnuplot_plotarea" will return a list containing the borders of the plotting
18352 area "xleft, xright, ytop, ybot" in canvas screen coordinates, while the ranges
18353 of the two axes "x1min, x1max, y1min, y1max, x2min, x2max, y2min, y2max" in plot
18354 coordinates can be obtained calling "gnuplot_axisranges".
18355 If the "interactive" option is specified, mouse clicking on a line segment
18356 will print the coordinates of its midpoint to stdout. Advanced actions
18357 can happen instead if the user supplies a procedure named
18358 "user_gnuplot_coordinates", which takes the following arguments:
18359 "win id x1s y1s x2s y2s x1e y1e x2e y2e x1m y1m x2m y2m",
18360 the name of the canvas and the id of the line segment followed by the
18361 coordinates of its start and end point in the two possible axis ranges; the
18362 coordinates of the midpoint are only filled for logarithmic axes.
18364 The current version of `tkcanvas` supports neither @ref{multiplot} nor @ref{replot}."
18366 @node tpic, unixpc, tkcanvas, terminal_
18367 @subsubsection tpic
18369 @c ?commands set terminal tpic
18370 @c ?set terminal tpic
18378 The `tpic` terminal driver supports the LaTeX picture environment with tpic
18379 \\specials. It is an alternative to the `latex` and `eepic` terminal drivers.
18380 Options are the point size, line width, and dot-dash interval.
18384 set terminal tpic <pointsize> <linewidth> <interval>
18388 where @ref{pointsize} and `linewidth` are integers in milli-inches and `interval`
18389 is a float in inches. If a non-positive value is specified, the default is
18390 chosen: pointsize = 40, linewidth = 6, interval = 0.1.
18392 All drivers for LaTeX offer a special way of controlling text positioning:
18393 If any text string begins with '@{', you also need to include a '@}' at the
18394 end of the text, and the whole text will be centered both horizontally
18395 and vertically by LaTeX. --- If the text string begins with '[', you need
18396 to continue it with: a position specification (up to two out of t,b,l,r),
18397 ']@{', the text itself, and finally, '@}'. The text itself may be anything
18398 LaTeX can typeset as an LR-box. \\rule@{@}@{@}'s may help for best positioning.
18401 About label positioning:
18402 Use gnuplot defaults (mostly sensible, but sometimes not really best):
18404 set title '\\LaTeX\\ -- $ \\gamma $'
18407 Force centering both horizontally and vertically:
18409 set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
18412 Specify own positioning (top here):
18414 set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
18417 The other label -- account for long ticlabels:
18419 set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
18423 @node unixpc, unixplot, tpic, terminal_
18424 @subsubsection unixpc
18426 @c ?commands set terminal unixpc
18427 @c ?set terminal unixpc
18428 @c ?set term unixpc
18429 @c ?terminal unixpc
18435 The `unixpc` terminal driver supports AT&T 3b1 and AT&T 7300 Unix PC. It has
18438 @node unixplot, vx384, unixpc, terminal_
18439 @subsubsection unixplot
18441 @c ?commands set terminal unixplot
18442 @c ?set terminal unixplot
18443 @c ?set term unixplot
18444 @c ?terminal unixplot
18450 The `unixplot` terminal driver generates output in the Unix "plot" graphics
18451 language. It has no options.
18453 This terminal cannot be compiled if the GNU version of plot is to be used;
18454 in that case, use the `gnugraph` terminal instead."
18456 @node vx384, vgagl, unixplot, terminal_
18457 @subsubsection vx384
18459 @c ?commands set terminal vx384
18460 @c ?set terminal vx384
18468 The `vx384` terminal driver supports the Vectrix 384 and Tandy color
18469 printers. It has no options."
18471 @node vgagl, VWS, vx384, terminal_
18472 @subsubsection vgagl
18474 @c ?commands set terminal vgagl
18475 @c ?set terminal vgagl
18483 The `vgagl` driver is a fast linux console driver with full mouse and pm3d
18484 support. It looks at the environment variable SVGALIB_DEFAULT_MODE for the
18485 default mode; if not set, it uses a 256 color mode with the highest
18486 available resolution.
18490 set terminal vgagl \\
18491 background [red] [[green] [blue]] \\
18492 [uniform | interpolate] \\
18498 The color mode can also be given with the mode option. Both Symbolic
18499 names as G1024x768x256 and integers are allowed. The `background` option
18500 takes either one or three integers in the range [0, 255]. If only one
18501 integers is supplied, it is taken as gray value for the background.
18502 If three integers are present, the background gets the corresponding
18504 The (mutually exclusive) options `interpolate` and `uniform` control
18505 if color interpolation is done while drawing triangles (on by default).
18507 A @ref{file} can be specified with the `dump "file"` option.
18508 If this option is present, (i.e the dump file name is not empty) pressing
18509 the key KP_Delete will write the file. This action cannot and cannot be
18510 rebound. The file is written in raw ppm (P6) format. Note that this option
18511 is reset each time the `set term` command is issued.
18513 To get high resolution modes, you will probably have to modify the
18514 configuration file of libvga, usually /etc/vga/libvga.conf. Using
18515 the VESA fb is a good choice, but this needs to be compiled in the
18518 The vgagl driver uses the first *available* vga mode from the following list:
18520 - the driver which was supplied when setting vgagl, e.g. `set term vgagl
18521 G1024x768x256` would first check, if the G1024x768x256 mode is available.
18522 - the environment variable SVGALIB_DEFAULT_MODE
18535 @node VWS, windows, vgagl, terminal_
18538 @c ?commands set terminal VWS
18539 @c ?set terminal VWS
18547 The `VWS` terminal driver supports the VAX Windowing System. It has
18548 no options. It will sense the display type (monochrome, gray scale,
18549 or color.) All line styles are plotted as solid lines."
18551 @node windows, x11, VWS, terminal_
18552 @subsubsection windows
18554 @c ?commands set terminal windows
18555 @c ?set terminal windows
18556 @c ?set term windows
18557 @c ?terminal windows
18563 Three options may be set in the `windows` terminal driver.
18567 set terminal windows @{color | monochrome@}
18568 @{enhanced | noenhanced@}
18569 @{@{font@} "fontname@{,fontsize@}" @{<fontsize>@}@}
18573 where `color` and `monochrome` select colored or mono output,
18574 `enhanced` enables enhanced text mode features (subscripts,
18575 superscripts and mixed fonts). See `enhanced` for more information.
18576 `"<fontname>"` is the name of a valid Windows font, and `<fontsize>`
18577 is the size of the font in points.
18579 Other options may be set with the graph-menu or the initialization file.
18581 The Windows version normally terminates immediately as soon as the end of
18582 any files given as command line arguments is reached (i.e. in non-interactive
18583 mode), unless you specify `-` as the last command line option.
18584 It will also not show the text-window at all, in this mode, only the plot.
18585 By giving the optional argument `-persist` (same as for gnuplot under x11;
18586 former Windows-only options `/noend` or `-noend` are still accepted as well),
18587 will not close gnuplot. Contrary to gnuplot on other operating systems,
18588 gnuplot's interactive command line is accessible after the -persist option.
18591 @noindent --- GRAPH-MENU ---
18593 @c ?commands set terminal windows graph-menu
18594 @c ?set terminal windows graph-menu
18595 @c ?set term windows graph-menu
18596 @c ?windows graph-menu
18598 @tmindex graph-menu
18601 The `gnuplot graph` window has the following options on a pop-up menu
18602 accessed by pressing the right mouse button or selecting `Options` from the
18605 `Bring to Top` when checked brings the graph window to the top after every
18608 `Color` when checked enables color linestyles. When unchecked it forces
18609 monochrome linestyles.
18611 `Copy to Clipboard` copies a bitmap and a Metafile picture.
18613 `Background...` sets the window background color.
18615 `Choose Font...` selects the font used in the graphics window.
18617 `Line Styles...` allows customization of the line colors and styles.
18619 `Print...` prints the graphics windows using a Windows printer driver and
18620 allows selection of the printer and scaling of the output. The output
18621 produced by `Print` is not as good as that from `gnuplot`'s own printer
18624 `Update wgnuplot.ini` saves the current window locations, window sizes, text
18625 window font, text window font size, graph window font, graph window font
18626 size, background color and linestyles to the initialization file
18630 @noindent --- PRINTING ---
18632 @c ?commands set terminal windows printing
18633 @c ?set terminal windows printing
18634 @c ?set term windows printing
18635 @c ?windows printing
18640 In order of preference, graphs may be be printed in the following ways.
18642 `1.` Use the `gnuplot` command @ref{terminal} to select a printer and @ref{output} to redirect output to a file.
18644 `2.` Select the `Print...` command from the `gnuplot graph` window. An extra
18645 command `screendump` does this from the text window.
18647 `3.` If `set output "PRN"` is used, output will go to a temporary file. When
18648 you exit from `gnuplot` or when you change the output with another @ref{output} command, a dialog box will appear for you to select a printer port.
18649 If you choose OK, the output will be printed on the selected port, passing
18650 unmodified through the print manager. It is possible to accidentally (or
18651 deliberately) send printer output meant for one printer to an incompatible
18655 @noindent --- TEXT-MENU ---
18657 @c ?commands set terminal windows text-menu
18658 @c ?set terminal windows text-menu
18659 @c ?set term windows text-menu
18660 @c ?windows text-menu
18665 The `gnuplot text` window has the following options on a pop-up menu accessed
18666 by pressing the right mouse button or selecting `Options` from the system
18669 `Copy to Clipboard` copies marked text to the clipboard.
18671 `Paste` copies text from the clipboard as if typed by the user.
18673 `Choose Font...` selects the font used in the text window.
18675 `System Colors` when selected makes the text window honor the System Colors
18676 set using the Control Panel. When unselected, text is black or blue on a
18679 `Update wgnuplot.ini` saves the current text window location, text window
18680 size, text window font and text window font size to the initialisation file
18685 If the menu file `WGNUPLOT.MNU` is found in the same directory as
18686 WGNUPLOT.EXE, then the menu specified in `WGNUPLOT.MNU` will be loaded.
18689 [Menu] starts a new menu with the name on the following line.
18691 [EndMenu] ends the current menu.
18693 [--] inserts a horizontal menu separator.
18695 [|] inserts a vertical menu separator.
18697 [Button] puts the next macro on a push button instead of a menu.
18699 Macros take two lines with the macro name (menu entry) on the first line and
18700 the macro on the second line. Leading spaces are ignored. Macro commands:
18702 [INPUT] --- Input string with prompt terminated by [EOS] or @{ENTER@}
18704 [EOS] --- End Of String terminator. Generates no output.
18706 [OPEN] --- Get name of file to open from list box, with title of list box
18707 terminated by [EOS], followed by default filename terminated by [EOS] or
18710 [SAVE] --- Get name of file to save. Similar to [OPEN]
18712 Macro character substitutions:
18714 @{ENTER@} --- Carriage Return '\\r'
18716 @{TAB@} --- Tab '\\011'
18718 @{ESC@} --- Escape '\\033'
18726 Macros are limited to 256 characters after expansion.
18729 @noindent --- WGNUPLOT.INI ---
18731 @c ?commands set terminal windows wgnuplot.ini
18732 @c ?set terminal windows wgnuplot.ini
18733 @c ?set term windows wgnuplot.ini
18734 @c ?windows wgnuplot.ini
18735 @cindex wgnuplot.ini
18736 @tmindex wgnuplot.ini
18739 Windows `gnuplot` will read some of its options from the `[WGNUPLOT]` section
18740 of `WGNUPLOT.INI` in user's %APPDATA% directory. A sample `WGNUPLOT.INI` file:
18746 TextFont=Terminal,9
18752 GraphBackground=255 255 255
18754 Axis=192 192 192 2 2
18758 Line4=255 0 255 0 3
18763 The `GraphFont` entry specifies the font name and size in points. The five
18764 numbers given in the `Border`, `Axis` and `Line` entries are the `Red`
18765 intensity (0--255), `Green` intensity, `Blue` intensity, `Color Linestyle`
18766 and `Mono Linestyle`. `Linestyles` are 0=SOLID, 1=DASH, 2=DOT, 3=DASHDOT,
18767 4=DASHDOTDOT. In the sample `WGNUPLOT.INI` file above, Line 2 is a green
18768 solid line in color mode, or a dashed line in monochrome mode. The default
18769 line width is 1 pixel. If `Linestyle` is negative, it specifies the width of
18770 a SOLID line in pixels. Line1 and any linestyle used with the `points` style
18771 must be SOLID with unit width."
18773 @node x11, x11_, windows, terminal_
18776 @c ?commands set terminal x11
18777 @c ?set terminal x11
18785 `gnuplot` provides the `x11` terminal type for use with X servers. This
18786 terminal type is set automatically at startup if the `DISPLAY` environment
18787 variable is set, if the `TERM` environment variable is set to `xterm`, or
18788 if the `-display` command line option is used.
18792 set terminal x11 @{<n>@}
18793 @{title "<string>"@}
18794 @{@{no@}enhanced@} @{font <fontspec>@}
18795 @{linewidth LW@} @{solid|dashed@}
18796 @{@{no@}persist@} @{@{no@}raise@} @{@{no@}ctrlq@}
18798 @{size XX,YY@} @{position XX,YY@}
18799 set terminal x11 @{reset@}
18803 Multiple plot windows are supported: `set terminal x11 <n>` directs the
18804 output to plot window number n. If n is not 0, the terminal number will be
18805 appended to the window title (unless a title has been supplied manually)
18806 and the icon will be labeled `Gnuplot <n>`. The active window may be
18807 distinguished by a change in cursor (from default to crosshair).
18809 The x11 terminal support enhanced text mode (see `enhanced`), subject
18810 to the available fonts. In order for font size commands embedded in text
18811 to have any effect, the default x11 font must be scalable. Thus the first
18812 example below will work as expected, but the second will not.
18815 set term x11 enhanced font "arial,15"
18816 set title '@{/=20 Big@} Medium @{/=5 Small@}'
18821 set term x11 enhanced font "terminal-14"
18822 set title '@{/=20 Big@} Medium @{/=5 Small@}'
18826 Plot windows remain open even when the `gnuplot` driver is changed to a
18827 different device. A plot window can be closed by pressing the letter q
18828 while that window has input focus, or by choosing `close` from a window
18829 manager menu. All plot windows can be closed by specifying @ref{reset}, which
18830 actually terminates the subprocess which maintains the windows (unless
18831 `-persist` was specified). The `close` command can be used to close
18832 individual plot windows by number. However, after a @ref{reset}, those plot
18833 windows left due to persist cannot be closed with the command `close`.
18834 A `close` without a number closes the current active plot window.
18836 The gnuplot outboard driver, gnuplot_x11, is searched in a default place
18837 chosen when the program is compiled. You can override that by defining
18838 the environment variable GNUPLOT_DRIVER_DIR to point to a different
18841 Plot windows will automatically be closed at the end of the session
18842 unless the `-persist` option was given.
18844 The options `persist` and @ref{raise} are unset by default, which means that
18845 the defaults (persist == no and raise == yes) or the command line options
18846 -persist / -raise or the Xresources are taken. If [no]persist or
18847 [no]raise are specified, they will override command line options and
18848 Xresources. Setting one of these options takes place immediately, so
18849 the behaviour of an already running driver can be modified. If the window
18850 does not get raised, see discussion in @ref{raise}.
18852 The option `title "<title name>"` will supply the title name of the window
18853 for the current plot window or plot window <n> if a number is given.
18854 Where (or if) this title is shown depends on your X window manager.
18856 The size option can be used to set the size of the plot window. The
18857 size option will only apply to newly created windows.
18859 The position option can be used to set the position of the plot window. The
18860 position option will only apply to newly created windows.
18862 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
18865 Linewidths and pointsizes may be changed from within `gnuplot` with
18868 For terminal type `x11`, `gnuplot` accepts (when initialized) the standard
18869 X Toolkit options and resources such as geometry, font, and name from the
18870 command line arguments or a configuration file. See the X(1) man page
18871 (or its equivalent) for a description of such options.
18873 @cindex X resources
18875 A number of other `gnuplot` options are available for the `x11` terminal.
18876 These may be specified either as command-line options when `gnuplot` is
18877 invoked or as resources in the configuration file ".Xdefaults". They are
18878 set upon initialization and cannot be altered during a `gnuplot` session.
18879 (except `persist` and @ref{raise})
18882 @noindent --- X11_FONTS ---
18884 @c ?commands set terminal x11 x11_fonts
18885 @c ?set terminal x11 x11_fonts
18886 @c ?set term x11 x11_fonts
18892 Upon initial startup, the default font is taken from the X11 resources
18893 as set in the system or user .Xdefaults file or on the command line.
18897 gnuplot*font: lucidasans-bold-12
18900 A new default font may be specified to the x11 driver from inside
18903 `set term x11 font "<fontspec>"`
18906 The driver first queries the X-server for a font of the exact name given.
18907 If this query fails, then it tries to interpret <fontspec> as
18908 "<font>,<size>,<slant>,<weight>" and to construct a full X11 font name
18911 -*-<font>-<weight>-<s>-*-*-<size>-*-*-*-*-*-<encoding>
18916 <font> is the base name of the font (e.g. Times or Symbol)
18917 <size> is the point size (defaults to 12 if not specified)
18918 <s> is `i` if <slant>=="italic" `o` if <slant>=="oblique" `r` otherwise
18919 <weight> is `medium` or `bold` if explicitly requested, otherwise `*`
18920 <encoding> is set based on the current character set (see @ref{encoding}).
18923 So `set term x11 font "arial,15,italic"` will be translated to
18924 -*-arial-*-i-*-*-15-*-*-*-*-*-iso8859-1 (assuming default encoding).
18925 The <size>, <slant>, and <weight> specifications are all optional.
18926 If you do not specify <slant> or <weight> then you will get whatever font
18927 variant the font server offers first.
18928 You may set a default enconding via the corresponding X11 resource. E.g.
18930 gnuplot*encoding: iso8859-15
18933 The driver also recognizes some common PostScript font names and
18934 replaces them with possible X11 or TrueType equivalents.
18935 This same sequence is used to process font requests from @ref{label}.
18937 If your gnuplot was built with configuration option --enable-x11-mbfonts,
18938 you can specify multi-byte fonts by using the prefix "mbfont:" on the font
18939 name. An additional font may be given, separated by a semicolon.
18940 Since multi-byte font encodings are interpreted according to the locale
18941 setting, you must make sure that the environmental variable LC_CTYPE is set
18942 to some appropriate locale value such as ja_JP.eucJP, ko_KR.EUC, or zh_CN.EUC.
18946 set term x11 font 'mbfont:kana14;k14'
18947 # 'kana14' and 'k14' are Japanese X11 font aliases, and ';'
18948 # is the separator of font names.
18949 set term x11 font 'mbfont:fixed,16,r,medium'
18950 # <font>,<size>,<slant>,<weight> form is also usable.
18951 set title '(mb strings)' font 'mbfont:*-fixed-medium-r-normal--14-*'
18955 The same syntax applies to the default font in Xresources settings,
18959 mbfont:-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0
18963 If gnuplot is built with --enable-x11-mbfonts, you can use two special
18964 PostScript font names 'Ryumin-Light-*' and 'GothicBBB-Medium-*' (standard
18965 Japanese PS fonts) without the prefix "mbfont:".
18969 @noindent --- COMMAND-LINE_OPTIONS ---
18971 @c ?commands set terminal x11 command-line-options
18972 @c ?set terminal x11 command-line-options
18973 @c ?set term x11 command-line-options
18974 @c ?x11 command-line-options
18975 @cindex command-line-options
18977 In addition to the X Toolkit options, the following options may be specified
18978 on the command line when starting `gnuplot` or as resources in your
18979 ".Xdefaults" file (note that @ref{raise} and `persist` can be overridden
18980 later by `set term x11 [no]raise [no]persist)`:
18983 `-mono` forces monochrome rendering on color displays.
18984 `-gray` requests grayscale rendering on grayscale or color displays.
18985 (Grayscale displays receive monochrome rendering by default.)
18986 `-clear` requests that the window be cleared momentarily before a
18987 new plot is displayed.
18988 `-tvtwm` requests that geometry specifications for position of the
18989 window be made relative to the currently displayed portion
18990 of the virtual root.
18991 `-raise` raises plot window after each plot
18992 `-noraise` does not raise plot window after each plot
18993 `-noevents` does not process mouse and key events
18994 `-ctrlq ` closes window on ctrl-q rather than q
18995 `-persist` plot windows survive after main gnuplot program exits
18999 @cindex X resources
19001 The options are shown above in their command-line syntax. When entered as
19002 resources in ".Xdefaults", they require a different syntax.
19011 `gnuplot` also provides a command line option (`-pointsize <v>`) and a
19012 resource, `gnuplot*pointsize: <v>`, to control the size of points plotted
19013 with the `points` plotting style. The value `v` is a real number (greater
19014 than 0 and less than or equal to ten) used as a scaling factor for point
19015 sizes. For example, `-pointsize 2` uses points twice the default size, and
19016 `-pointsize 0.5` uses points half the normal size.
19018 The `-noevents` switch disables all mouse and key event processing (except
19019 for `q` and `<space>` for closing the window). This is useful for programs
19020 which use the x11 driver independent of the gnuplot main program.
19022 The `-ctrlq` switch changes the hot-key that closes a plot window from `q`
19023 to `<ctrl>q`. This is useful is you are using the keystroke-capture feature
19024 `pause mouse keystroke`, since it allows the character `q` to be captured
19025 just as all other alphanumeric characters. The `-ctrlq` switch similarly
19026 replaces the <space> hot-key with <ctrl><space> for the same reason.
19030 @noindent --- MONOCHROME_OPTIONS ---
19032 @c ?commands set terminal x11 monochrome_options
19033 @c ?set terminal x11 monochrome_options
19034 @c ?set term x11 monochrome_options
19035 @c ?x11 monochrome_options
19036 @cindex monochrome_options
19038 @cindex X resources
19040 For monochrome displays, `gnuplot` does not honor foreground or background
19041 colors. The default is black-on-white. `-rv` or `gnuplot*reverseVideo: on`
19042 requests white-on-black.
19046 @noindent --- COLOR_RESOURCES ---
19048 @c ?commands set terminal x11 color_resources
19049 @c ?set terminal x11 color_resources
19050 @c ?set term x11 color_resources
19051 @c ?x11 color_resources
19052 @cindex color_resources
19054 @cindex X resources
19056 For color displays, `gnuplot` honors the following resources (shown here
19057 with their default values) or the greyscale resources. The values may be
19058 color names as listed in the X11 rgb.txt file on your system, hexadecimal
19059 RGB color specifications (see X11 documentation), or a color name followed
19060 by a comma and an `intensity` value from 0 to 1. For example, `blue, 0.5`
19061 means a half intensity blue.
19064 gnuplot*background: white
19065 gnuplot*textColor: black
19066 gnuplot*borderColor: black
19067 gnuplot*axisColor: black
19068 gnuplot*line1Color: red
19069 gnuplot*line2Color: green
19070 gnuplot*line3Color: blue
19071 gnuplot*line4Color: magenta
19072 gnuplot*line5Color: cyan
19073 gnuplot*line6Color: sienna
19074 gnuplot*line7Color: orange
19075 gnuplot*line8Color: coral
19080 The command-line syntax for these is simple only for background,
19081 which maps directly to the usual X11 toolkit option "-bg". All
19082 others can only be set on the command line by use of the generic
19083 "-xrm" resource override option
19088 gnuplot -background coral
19091 to change the background color.
19094 gnuplot -xrm 'gnuplot*line1Color:blue'
19097 to override the first linetype color.
19101 @noindent --- GRAYSCALE_RESOURCES ---
19103 @c ?commands set terminal x11 grayscale_resources
19104 @c ?set terminal x11 grayscale_resources
19105 @c ?set term x11 grayscale_resources
19106 @c ?x11 grayscale_resources
19107 @cindex grayscale_resources
19109 @cindex X resources
19111 When `-gray` is selected, `gnuplot` honors the following resources for
19112 grayscale or color displays (shown here with their default values). Note
19113 that the default background is black.
19116 gnuplot*background: black
19117 gnuplot*textGray: white
19118 gnuplot*borderGray: gray50
19119 gnuplot*axisGray: gray50
19120 gnuplot*line1Gray: gray100
19121 gnuplot*line2Gray: gray60
19122 gnuplot*line3Gray: gray80
19123 gnuplot*line4Gray: gray40
19124 gnuplot*line5Gray: gray90
19125 gnuplot*line6Gray: gray50
19126 gnuplot*line7Gray: gray70
19127 gnuplot*line8Gray: gray30
19134 @noindent --- LINE_RESOURCES ---
19136 @c ?commands set terminal x11 line_resources
19137 @c ?set terminal x11 line_resources
19138 @c ?set term x11 line_resources
19139 @c ?x11 line_resources
19140 @cindex line_resources
19142 @cindex X resources
19144 `gnuplot` honors the following resources for setting the width (in pixels) of
19145 plot lines (shown here with their default values.) 0 or 1 means a minimal
19146 width line of 1 pixel width. A value of 2 or 3 may improve the appearance of
19150 gnuplot*borderWidth: 2
19151 gnuplot*axisWidth: 0
19152 gnuplot*line1Width: 0
19153 gnuplot*line2Width: 0
19154 gnuplot*line3Width: 0
19155 gnuplot*line4Width: 0
19156 gnuplot*line5Width: 0
19157 gnuplot*line6Width: 0
19158 gnuplot*line7Width: 0
19159 gnuplot*line8Width: 0
19164 `gnuplot` honors the following resources for setting the dash style used for
19165 plotting lines. 0 means a solid line. A two-digit number `jk` (`j` and `k`
19166 are >= 1 and <= 9) means a dashed line with a repeated pattern of `j` pixels
19167 on followed by `k` pixels off. For example, '16' is a dotted line with one
19168 pixel on followed by six pixels off. More elaborate on/off patterns can be
19169 specified with a four-digit value. For example, '4441' is four on, four off,
19170 four on, one off. The default values shown below are for monochrome displays
19171 or monochrome rendering on color or grayscale displays.
19172 Color displays default to dashed:off
19175 gnuplot*dashed: off
19176 gnuplot*borderDashes: 0
19177 gnuplot*axisDashes: 16
19178 gnuplot*line1Dashes: 0
19179 gnuplot*line2Dashes: 42
19180 gnuplot*line3Dashes: 13
19181 gnuplot*line4Dashes: 44
19182 gnuplot*line5Dashes: 15
19183 gnuplot*line6Dashes: 4441
19184 gnuplot*line7Dashes: 42
19185 gnuplot*line8Dashes: 13
19192 @noindent --- X11 PM3D_RESOURCES ---
19194 @c ?commands set terminal x11 pm3d_resources
19195 @c ?set terminal x11 pm3d_resources
19196 @c ?set term x11 pm3d_resources
19197 @c ?x11 pm3d_resources
19198 @cindex pm3d_resources
19201 @cindex X resources
19203 Choosing the appropriate visual class and number of colors is a crucial
19204 point in X11 applications and a bit awkward, since X11 supports six visual
19205 types in different depths.
19207 By default `gnuplot` uses the default visual of the screen. The number of
19208 colors which can be allocated depends on the visual class chosen. On a
19209 visual class with a depth > 12bit, gnuplot starts with a maximal number
19210 of 0x200 colors. On a visual class with a depth > 8bit (but <= 12 bit)
19211 the maximal number of colors is 0x100, on <= 8bit displays the maximum
19212 number of colors is 240 (16 are left for line colors).
19214 Gnuplot first starts to allocate the maximal number of colors as stated
19215 above. If this fails, the number of colors is reduced by the factor 2
19216 until gnuplot gets all colors which are requested. If dividing `maxcolors`
19217 by 2 repeatedly results in a number which is smaller than `mincolors`
19218 `gnuplot` tries to install a private colormap. In this case the window
19219 manager is responsible for swapping colormaps when the pointer is moved
19220 in and out the x11 driver's window.
19222 The default for `mincolors` is maxcolors / (num_colormaps > 1 ? 2 : 8),
19223 where num_colormaps is the number of colormaps which are currently used
19224 by gnuplot (usually 1, if only one x11 window is open).
19226 Some systems support multiple (different) visual classes together on one
19227 screen. On these systems it might be necessary to force gnuplot to use a
19228 specific visual class, e.g. the default visual might be 8bit PseudoColor
19229 but the screen would also support 24bit TrueColor which would be the
19232 The information about an Xserver's capabilities can be obtained with the
19233 program `xdpyinfo`. For the visual names below you can choose one of
19234 StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, DirectColor.
19235 If an Xserver supports a requested visual type at different depths,
19236 `gnuplot` chooses the visual class with the highest depth (deepest).
19237 If the requested visual class matches the default visual and multiple
19238 classes of this type are supported, the default visual is preferred.
19240 Example: on an 8bit PseudoColor visual you can force a private color map
19241 by specifying `gnuplot*maxcolors: 240` and `gnuplot*mincolors: 240`.
19245 gnuplot*maxcolors: <integer>
19246 gnuplot*mincolors: <integer>
19247 gnuplot*visual: <visual name>
19254 @noindent --- X11 OTHER_RESOURCES ---
19256 @c ?commands set terminal x11 other_resources
19257 @c ?set terminal x11 other_resources
19258 @c ?set term x11 other_resources
19259 @c ?x11 other_resources
19260 @cindex X resources
19262 By default the contents of the current plot window are exported to the X11
19263 clipboard in response to X events in the window. Setting the resource
19264 'gnuplot*exportselection' to 'off' or 'false' will disable this.
19266 By default text rotation is done using a method that is fast, but can
19267 corrupt nearby colors depending on the background. If this is a problem,
19268 you can set the resource 'gnuplot.fastrotate' to 'off'
19272 gnuplot*exportselection: off
19273 gnuplot*fastrotate: on
19280 @node x11_, xlib, x11, terminal_
19283 @c ?commands set terminal x11
19284 @c ?set terminal x11
19292 `gnuplot` provides the `x11` terminal type for use with X servers. This
19293 terminal type is set automatically at startup if the `DISPLAY` environment
19294 variable is set, if the `TERM` environment variable is set to `xterm`, or
19295 if the `-display` command line option is used.
19299 set terminal x11 @{<n>@}
19300 @{title "<string>"@}
19301 @{@{no@}enhanced@} @{font <fontspec>@}
19302 @{linewidth LW@} @{solid|dashed@}
19303 @{@{no@}persist@} @{@{no@}raise@} @{@{no@}ctrlq@}
19305 @{size XX,YY@} @{position XX,YY@}
19306 set terminal x11 @{reset@}
19310 Multiple plot windows are supported: `set terminal x11 <n>` directs the
19311 output to plot window number n. If n is not 0, the terminal number will be
19312 appended to the window title (unless a title has been supplied manually)
19313 and the icon will be labeled `Gnuplot <n>`. The active window may be
19314 distinguished by a change in cursor (from default to crosshair).
19316 The x11 terminal support enhanced text mode (see `enhanced`), subject
19317 to the available fonts. In order for font size commands embedded in text
19318 to have any effect, the default x11 font must be scalable. Thus the first
19319 example below will work as expected, but the second will not.
19322 set term x11 enhanced font "arial,15"
19323 set title '@{/=20 Big@} Medium @{/=5 Small@}'
19328 set term x11 enhanced font "terminal-14"
19329 set title '@{/=20 Big@} Medium @{/=5 Small@}'
19333 Plot windows remain open even when the `gnuplot` driver is changed to a
19334 different device. A plot window can be closed by pressing the letter q
19335 while that window has input focus, or by choosing `close` from a window
19336 manager menu. All plot windows can be closed by specifying @ref{reset}, which
19337 actually terminates the subprocess which maintains the windows (unless
19338 `-persist` was specified). The `close` command can be used to close
19339 individual plot windows by number. However, after a @ref{reset}, those plot
19340 windows left due to persist cannot be closed with the command `close`.
19341 A `close` without a number closes the current active plot window.
19343 The gnuplot outboard driver, gnuplot_x11, is searched in a default place
19344 chosen when the program is compiled. You can override that by defining
19345 the environment variable GNUPLOT_DRIVER_DIR to point to a different
19348 Plot windows will automatically be closed at the end of the session
19349 unless the `-persist` option was given.
19351 The options `persist` and @ref{raise} are unset by default, which means that
19352 the defaults (persist == no and raise == yes) or the command line options
19353 -persist / -raise or the Xresources are taken. If [no]persist or
19354 [no]raise are specified, they will override command line options and
19355 Xresources. Setting one of these options takes place immediately, so
19356 the behaviour of an already running driver can be modified. If the window
19357 does not get raised, see discussion in @ref{raise}.
19359 The option `title "<title name>"` will supply the title name of the window
19360 for the current plot window or plot window <n> if a number is given.
19361 Where (or if) this title is shown depends on your X window manager.
19363 The size option can be used to set the size of the plot window. The
19364 size option will only apply to newly created windows.
19366 The position option can be used to set the position of the plot window. The
19367 position option will only apply to newly created windows.
19369 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
19372 Linewidths and pointsizes may be changed from within `gnuplot` with
19375 For terminal type `x11`, `gnuplot` accepts (when initialized) the standard
19376 X Toolkit options and resources such as geometry, font, and name from the
19377 command line arguments or a configuration file. See the X(1) man page
19378 (or its equivalent) for a description of such options.
19380 @cindex X resources
19382 A number of other `gnuplot` options are available for the `x11` terminal.
19383 These may be specified either as command-line options when `gnuplot` is
19384 invoked or as resources in the configuration file ".Xdefaults". They are
19385 set upon initialization and cannot be altered during a `gnuplot` session.
19386 (except `persist` and @ref{raise})
19389 @noindent --- X11_FONTS ---
19391 @c ?commands set terminal x11 x11_fonts
19392 @c ?set terminal x11 x11_fonts
19393 @c ?set term x11 x11_fonts
19399 Upon initial startup, the default font is taken from the X11 resources
19400 as set in the system or user .Xdefaults file or on the command line.
19404 gnuplot*font: lucidasans-bold-12
19407 A new default font may be specified to the x11 driver from inside
19410 `set term x11 font "<fontspec>"`
19413 The driver first queries the X-server for a font of the exact name given.
19414 If this query fails, then it tries to interpret <fontspec> as
19415 "<font>,<size>,<slant>,<weight>" and to construct a full X11 font name
19418 -*-<font>-<weight>-<s>-*-*-<size>-*-*-*-*-*-<encoding>
19423 <font> is the base name of the font (e.g. Times or Symbol)
19424 <size> is the point size (defaults to 12 if not specified)
19425 <s> is `i` if <slant>=="italic" `o` if <slant>=="oblique" `r` otherwise
19426 <weight> is `medium` or `bold` if explicitly requested, otherwise `*`
19427 <encoding> is set based on the current character set (see @ref{encoding}).
19430 So `set term x11 font "arial,15,italic"` will be translated to
19431 -*-arial-*-i-*-*-15-*-*-*-*-*-iso8859-1 (assuming default encoding).
19432 The <size>, <slant>, and <weight> specifications are all optional.
19433 If you do not specify <slant> or <weight> then you will get whatever font
19434 variant the font server offers first.
19435 You may set a default enconding via the corresponding X11 resource. E.g.
19437 gnuplot*encoding: iso8859-15
19440 The driver also recognizes some common PostScript font names and
19441 replaces them with possible X11 or TrueType equivalents.
19442 This same sequence is used to process font requests from @ref{label}.
19444 If your gnuplot was built with configuration option --enable-x11-mbfonts,
19445 you can specify multi-byte fonts by using the prefix "mbfont:" on the font
19446 name. An additional font may be given, separated by a semicolon.
19447 Since multi-byte font encodings are interpreted according to the locale
19448 setting, you must make sure that the environmental variable LC_CTYPE is set
19449 to some appropriate locale value such as ja_JP.eucJP, ko_KR.EUC, or zh_CN.EUC.
19453 set term x11 font 'mbfont:kana14;k14'
19454 # 'kana14' and 'k14' are Japanese X11 font aliases, and ';'
19455 # is the separator of font names.
19456 set term x11 font 'mbfont:fixed,16,r,medium'
19457 # <font>,<size>,<slant>,<weight> form is also usable.
19458 set title '(mb strings)' font 'mbfont:*-fixed-medium-r-normal--14-*'
19462 The same syntax applies to the default font in Xresources settings,
19466 mbfont:-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0
19470 If gnuplot is built with --enable-x11-mbfonts, you can use two special
19471 PostScript font names 'Ryumin-Light-*' and 'GothicBBB-Medium-*' (standard
19472 Japanese PS fonts) without the prefix "mbfont:".
19476 @noindent --- COMMAND-LINE_OPTIONS ---
19478 @c ?commands set terminal x11 command-line-options
19479 @c ?set terminal x11 command-line-options
19480 @c ?set term x11 command-line-options
19481 @c ?x11 command-line-options
19482 @cindex command-line-options
19484 In addition to the X Toolkit options, the following options may be specified
19485 on the command line when starting `gnuplot` or as resources in your
19486 ".Xdefaults" file (note that @ref{raise} and `persist` can be overridden
19487 later by `set term x11 [no]raise [no]persist)`:
19490 `-mono` forces monochrome rendering on color displays.
19491 `-gray` requests grayscale rendering on grayscale or color displays.
19492 (Grayscale displays receive monochrome rendering by default.)
19493 `-clear` requests that the window be cleared momentarily before a
19494 new plot is displayed.
19495 `-tvtwm` requests that geometry specifications for position of the
19496 window be made relative to the currently displayed portion
19497 of the virtual root.
19498 `-raise` raises plot window after each plot
19499 `-noraise` does not raise plot window after each plot
19500 `-noevents` does not process mouse and key events
19501 `-ctrlq ` closes window on ctrl-q rather than q
19502 `-persist` plot windows survive after main gnuplot program exits
19506 @cindex X resources
19508 The options are shown above in their command-line syntax. When entered as
19509 resources in ".Xdefaults", they require a different syntax.
19518 `gnuplot` also provides a command line option (`-pointsize <v>`) and a
19519 resource, `gnuplot*pointsize: <v>`, to control the size of points plotted
19520 with the `points` plotting style. The value `v` is a real number (greater
19521 than 0 and less than or equal to ten) used as a scaling factor for point
19522 sizes. For example, `-pointsize 2` uses points twice the default size, and
19523 `-pointsize 0.5` uses points half the normal size.
19525 The `-noevents` switch disables all mouse and key event processing (except
19526 for `q` and `<space>` for closing the window). This is useful for programs
19527 which use the x11 driver independent of the gnuplot main program.
19529 The `-ctrlq` switch changes the hot-key that closes a plot window from `q`
19530 to `<ctrl>q`. This is useful is you are using the keystroke-capture feature
19531 `pause mouse keystroke`, since it allows the character `q` to be captured
19532 just as all other alphanumeric characters. The `-ctrlq` switch similarly
19533 replaces the <space> hot-key with <ctrl><space> for the same reason.
19537 @noindent --- MONOCHROME_OPTIONS ---
19539 @c ?commands set terminal x11 monochrome_options
19540 @c ?set terminal x11 monochrome_options
19541 @c ?set term x11 monochrome_options
19542 @c ?x11 monochrome_options
19543 @cindex monochrome_options
19545 @cindex X resources
19547 For monochrome displays, `gnuplot` does not honor foreground or background
19548 colors. The default is black-on-white. `-rv` or `gnuplot*reverseVideo: on`
19549 requests white-on-black.
19553 @noindent --- COLOR_RESOURCES ---
19555 @c ?commands set terminal x11 color_resources
19556 @c ?set terminal x11 color_resources
19557 @c ?set term x11 color_resources
19558 @c ?x11 color_resources
19559 @cindex color_resources
19561 @cindex X resources
19563 For color displays, `gnuplot` honors the following resources (shown here
19564 with their default values) or the greyscale resources. The values may be
19565 color names as listed in the X11 rgb.txt file on your system, hexadecimal
19566 RGB color specifications (see X11 documentation), or a color name followed
19567 by a comma and an `intensity` value from 0 to 1. For example, `blue, 0.5`
19568 means a half intensity blue.
19571 gnuplot*background: white
19572 gnuplot*textColor: black
19573 gnuplot*borderColor: black
19574 gnuplot*axisColor: black
19575 gnuplot*line1Color: red
19576 gnuplot*line2Color: green
19577 gnuplot*line3Color: blue
19578 gnuplot*line4Color: magenta
19579 gnuplot*line5Color: cyan
19580 gnuplot*line6Color: sienna
19581 gnuplot*line7Color: orange
19582 gnuplot*line8Color: coral
19587 The command-line syntax for these is simple only for background,
19588 which maps directly to the usual X11 toolkit option "-bg". All
19589 others can only be set on the command line by use of the generic
19590 "-xrm" resource override option
19595 gnuplot -background coral
19598 to change the background color.
19601 gnuplot -xrm 'gnuplot*line1Color:blue'
19604 to override the first linetype color.
19608 @noindent --- GRAYSCALE_RESOURCES ---
19610 @c ?commands set terminal x11 grayscale_resources
19611 @c ?set terminal x11 grayscale_resources
19612 @c ?set term x11 grayscale_resources
19613 @c ?x11 grayscale_resources
19614 @cindex grayscale_resources
19616 @cindex X resources
19618 When `-gray` is selected, `gnuplot` honors the following resources for
19619 grayscale or color displays (shown here with their default values). Note
19620 that the default background is black.
19623 gnuplot*background: black
19624 gnuplot*textGray: white
19625 gnuplot*borderGray: gray50
19626 gnuplot*axisGray: gray50
19627 gnuplot*line1Gray: gray100
19628 gnuplot*line2Gray: gray60
19629 gnuplot*line3Gray: gray80
19630 gnuplot*line4Gray: gray40
19631 gnuplot*line5Gray: gray90
19632 gnuplot*line6Gray: gray50
19633 gnuplot*line7Gray: gray70
19634 gnuplot*line8Gray: gray30
19641 @noindent --- LINE_RESOURCES ---
19643 @c ?commands set terminal x11 line_resources
19644 @c ?set terminal x11 line_resources
19645 @c ?set term x11 line_resources
19646 @c ?x11 line_resources
19647 @cindex line_resources
19649 @cindex X resources
19651 `gnuplot` honors the following resources for setting the width (in pixels) of
19652 plot lines (shown here with their default values.) 0 or 1 means a minimal
19653 width line of 1 pixel width. A value of 2 or 3 may improve the appearance of
19657 gnuplot*borderWidth: 2
19658 gnuplot*axisWidth: 0
19659 gnuplot*line1Width: 0
19660 gnuplot*line2Width: 0
19661 gnuplot*line3Width: 0
19662 gnuplot*line4Width: 0
19663 gnuplot*line5Width: 0
19664 gnuplot*line6Width: 0
19665 gnuplot*line7Width: 0
19666 gnuplot*line8Width: 0
19671 `gnuplot` honors the following resources for setting the dash style used for
19672 plotting lines. 0 means a solid line. A two-digit number `jk` (`j` and `k`
19673 are >= 1 and <= 9) means a dashed line with a repeated pattern of `j` pixels
19674 on followed by `k` pixels off. For example, '16' is a dotted line with one
19675 pixel on followed by six pixels off. More elaborate on/off patterns can be
19676 specified with a four-digit value. For example, '4441' is four on, four off,
19677 four on, one off. The default values shown below are for monochrome displays
19678 or monochrome rendering on color or grayscale displays.
19679 Color displays default to dashed:off
19682 gnuplot*dashed: off
19683 gnuplot*borderDashes: 0
19684 gnuplot*axisDashes: 16
19685 gnuplot*line1Dashes: 0
19686 gnuplot*line2Dashes: 42
19687 gnuplot*line3Dashes: 13
19688 gnuplot*line4Dashes: 44
19689 gnuplot*line5Dashes: 15
19690 gnuplot*line6Dashes: 4441
19691 gnuplot*line7Dashes: 42
19692 gnuplot*line8Dashes: 13
19699 @noindent --- X11 PM3D_RESOURCES ---
19701 @c ?commands set terminal x11 pm3d_resources
19702 @c ?set terminal x11 pm3d_resources
19703 @c ?set term x11 pm3d_resources
19704 @c ?x11 pm3d_resources
19705 @cindex pm3d_resources
19708 @cindex X resources
19710 Choosing the appropriate visual class and number of colors is a crucial
19711 point in X11 applications and a bit awkward, since X11 supports six visual
19712 types in different depths.
19714 By default `gnuplot` uses the default visual of the screen. The number of
19715 colors which can be allocated depends on the visual class chosen. On a
19716 visual class with a depth > 12bit, gnuplot starts with a maximal number
19717 of 0x200 colors. On a visual class with a depth > 8bit (but <= 12 bit)
19718 the maximal number of colors is 0x100, on <= 8bit displays the maximum
19719 number of colors is 240 (16 are left for line colors).
19721 Gnuplot first starts to allocate the maximal number of colors as stated
19722 above. If this fails, the number of colors is reduced by the factor 2
19723 until gnuplot gets all colors which are requested. If dividing `maxcolors`
19724 by 2 repeatedly results in a number which is smaller than `mincolors`
19725 `gnuplot` tries to install a private colormap. In this case the window
19726 manager is responsible for swapping colormaps when the pointer is moved
19727 in and out the x11 driver's window.
19729 The default for `mincolors` is maxcolors / (num_colormaps > 1 ? 2 : 8),
19730 where num_colormaps is the number of colormaps which are currently used
19731 by gnuplot (usually 1, if only one x11 window is open).
19733 Some systems support multiple (different) visual classes together on one
19734 screen. On these systems it might be necessary to force gnuplot to use a
19735 specific visual class, e.g. the default visual might be 8bit PseudoColor
19736 but the screen would also support 24bit TrueColor which would be the
19739 The information about an Xserver's capabilities can be obtained with the
19740 program `xdpyinfo`. For the visual names below you can choose one of
19741 StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, DirectColor.
19742 If an Xserver supports a requested visual type at different depths,
19743 `gnuplot` chooses the visual class with the highest depth (deepest).
19744 If the requested visual class matches the default visual and multiple
19745 classes of this type are supported, the default visual is preferred.
19747 Example: on an 8bit PseudoColor visual you can force a private color map
19748 by specifying `gnuplot*maxcolors: 240` and `gnuplot*mincolors: 240`.
19752 gnuplot*maxcolors: <integer>
19753 gnuplot*mincolors: <integer>
19754 gnuplot*visual: <visual name>
19761 @noindent --- X11 OTHER_RESOURCES ---
19763 @c ?commands set terminal x11 other_resources
19764 @c ?set terminal x11 other_resources
19765 @c ?set term x11 other_resources
19766 @c ?x11 other_resources
19767 @cindex X resources
19769 By default the contents of the current plot window are exported to the X11
19770 clipboard in response to X events in the window. Setting the resource
19771 'gnuplot*exportselection' to 'off' or 'false' will disable this.
19773 By default text rotation is done using a method that is fast, but can
19774 corrupt nearby colors depending on the background. If this is a problem,
19775 you can set the resource 'gnuplot.fastrotate' to 'off'
19779 gnuplot*exportselection: off
19780 gnuplot*fastrotate: on
19787 @node xlib, xlib_, x11_, terminal_
19788 @subsubsection xlib
19790 @c ?commands set terminal xlib
19791 @c ?set terminal xlib
19799 The `xlib` terminal driver supports the X11 Windows System. It generates
19800 gnuplot_x11 commands, but sends them to the output file specified by
19801 `set output '<filename>'`. `set term x11` is equivalent to
19802 `set output "|gnuplot_x11 -noevents"; set term xlib.`
19803 `xlib` takes the same set of options as `x11`."
19805 @node xlib_, , xlib, terminal_
19806 @subsubsection xlib
19808 @c ?commands set terminal xlib
19809 @c ?set terminal xlib
19817 The `xlib` terminal driver supports the X11 Windows System. It generates
19818 gnuplot_x11 commands, but sends them to the output file specified by
19819 `set output '<filename>'`. `set term x11` is equivalent to
19820 `set output "|gnuplot_x11 -noevents"; set term xlib.`
19821 `xlib` takes the same set of options as `x11`."
19823 @node Graphical_User_Interfaces, Bugs, Terminal_types, Top
19824 @chapter Graphical User Interfaces
19826 @c ?graphical user interfaces
19829 Several graphical user interfaces have been written for `gnuplot` and one for
19830 win32 is included in this distribution. In addition, there is a Python
19832 @uref{http://py-gnuplot.darwinports.com/,http://py-gnuplot.darwinports.com/
19835 Also several X11 interfaces exist.
19836 One of them is called xgfe. It uses the Qt library and can be found on
19837 @uref{http://www.flash.net/~dmishee/xgfe/xgfe.html,http://www.flash.net/~dmishee/xgfe/xgfe.html
19840 In addition three Tcl/Tk located at the usual Tcl/Tk repositories exist.
19842 Bruce Ravel (ravel@@phys.washington.edu) has written a new version of
19843 gnuplot-mode for GNU emacs and XEmacs. This version is based on
19844 the gnuplot.el file by Gershon Elber.
19845 While the gnuplot CVS repository has its own copy the most recent
19846 version of this package is available from
19847 @uref{http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/,http://feff.phys.washington.edu/~ravel/software/gnuplot-mode/
19855 @node Bugs, Concept_Index, Graphical_User_Interfaces, Top
19860 Bugs reported since the current release as well as older ones
19861 may be located via the official distribution site on SourceForge.
19863 Please e-mail bug reports to the gnuplot-bugs mailing list.
19864 Or upload the report to the gnuplot web site on SourceForge.
19865 Please give complete information on the version of gnuplot you are using
19866 and, if possible, a test script that demonstrates the bug.
19867 See @ref{Seeking-assistance}.
19869 The sections below list problems known to be present in gnuplot version 4.2 at
19870 the time of release. Some of these are actually bugs in external support
19871 libraries and may have been fixed indepently of any changes in gnuplot.
19875 * Gnuplot_limitations::
19876 * External_libraries::
19879 @node Gnuplot_limitations, External_libraries, Bugs, Bugs
19880 @section Gnuplot limitations
19899 Floating point exceptions (floating point number too large/small, divide by
19900 zero, etc.) may occasionally be generated by user defined functions. Some of
19901 the demos in particular may cause numbers to exceed the floating point range.
19902 Whether the system ignores such exceptions (in which case `gnuplot` labels
19903 the corresponding point as undefined) or aborts `gnuplot` depends on the
19904 compiler/runtime environment.
19906 The gamma and bessel functions do not work for complex arguments.
19908 If a command line contains a "load" command, then anything on the line after
19909 the "load <filename>" is ignored.
19911 Only one color palette at a time is active for any given x11 plot window.
19912 This means that multiplots whose constituent plots use different palettes
19913 will not display correctly in x11.
19915 Coordinates specified as "time" wrap at 24 hours, and have a precision limited
19916 to 1 second. This is in particular a limitation in using time format to
19917 handle geographic coordinates.
19919 Error bars are not handled properly in polar/spherical coordinate plot modes.
19921 The 'nohidden3d' option that is supposed to exempt individual plots from the
19922 global property 'set hidden3d' does not work for parametric curves.
19925 @node External_libraries, , Gnuplot_limitations, Bugs
19926 @section External libraries
19928 @c ?bugs external_libraries
19939 @cindex internationalization
19945 External library GD (used by PNG/JPEG/GIF drivers):
19946 Versions of libgd through 2.0.33 contain various bugs in mapping the characters
19947 of Adobe's Symbol font. Also it is possible to trigger a library segfault if
19948 an anti-aliased line crosses an upper corner of the canvas.
19950 External library PDFlib (used by PDF driver):
19951 Gnuplot can be linked against libpdf versions 4, 5, or 6. However, these
19952 versions differ in their handling of piped I/O. Therefore gnuplot scripts
19953 using piped output to PDF may work only for some versions of PDFlib.
19955 External library svgalib (used by linux and vgagl driver):
19956 Requires gnuplot to be suid root (bad!) and has many bugs that are specific
19957 to the video card or graphics driver used in X11.
19959 Internationalization (locale settings):
19960 Gnuplot uses the C runtime library routine setlocale() to control
19961 locale-specific formatting of input and output number, times, and date strings.
19962 The locales available, and the level of support for locale features such as
19963 "thousands' grouping separator", depend on the internationalization support
19964 provided by your individual machine.
19965 @node Concept_Index, Command_Index, Bugs, Top
19966 @unnumbered Concept Index
19969 @node Command_Index, Options_Index, Concept_Index, Top
19970 @unnumbered Command Index
19973 @node Options_Index, Function_Index, Command_Index, Top
19974 @unnumbered Options Index
19977 @node Function_Index, Terminal_Index, Options_Index, Top
19978 @unnumbered Function Index
19981 @node Terminal_Index, , Function_Index, Top
19982 @unnumbered Terminal Index