Maemo "optification" was added
[gnuplot] / docs / gnuplot.texi
1 \input texinfo   @c -*-texinfo-*-
2
3 @c %**start of header
4 @setfilename gnuplot.info
5 @settitle Gnuplot: An Interactive Plotting Program
6 @setchapternewpage odd
7 @c %**end of header
8
9 @c define the command and options indeces
10 @defindex cm
11 @defindex op
12 @defindex tm
13
14 @dircategory Math
15 @direntry
16 * GNUPLOT: (gnuplot).             An Interactive Plotting Program
17 @end direntry
18
19 @ifnottex
20 @node Top, gnuplot, (dir), (dir)
21 @top Master Menu
22 @end ifnottex
23
24 @example
25                        GNUPLOT
26
27             An Interactive Plotting Program
28              Thomas Williams & Colin Kelley
29           Version 4.2 organized by: Hans-Bernhard Broeker
30
31  Copyright (C) 1986 - 1993, 1998, 2004   Thomas Williams, Colin Kelley
32
33        Mailing list for comments: gnuplot-info@@lists.sourceforge.net
34      Mailing list for bug reports: gnuplot-bugs@@lists.sourceforge.net
35
36          This manual was originally prepared by Dick Crawford
37                    Version 4.2 - 1 Oct 2006
38
39
40 Major contributors (alphabetic order):
41 @end example
42
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>
47
48 @itemize @bullet
49 @item
50 Hans-Bernhard Broeker
51 @item
52 John Campbell
53 @item
54 Robert Cunningham
55 @item
56 David Denholm
57 @item
58 Gershon Elber
59 @item
60 Roger Fearick
61 @item
62 Carsten Grammes
63 @item
64 Lucas Hart
65 @item
66 Lars Hecking
67 @item
68 Thomas Koenig
69 @item
70 David Kotz
71 @item
72 Ed Kubaitis
73 @item
74 Russell Lang
75 @item
76 Alexander Lehmann
77 @item
78 Alexander Mai
79 @item
80 Ethan A Merritt
81 @item
82 Petr Mikulik
83 @item
84 Carsten Steger
85 @item
86 Tom Tkacik
87 @item
88 Jos Van der Woude
89 @item
90 Alex Woo
91 @item
92 James R. Van Zandt
93 @item
94 Johannes Zellner
95 @end itemize
96
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>
100 @c ^</h2><p>
101 @c ^<h3> This manual was prepared by Dick Crawford</h3><p>
102 @c ^<h3> Last revised: February 2007</h3><p>
103 @c ^<hr>
104
105 @menu
106 * gnuplot::                     
107 * Commands::                    
108 * Terminal_types::              
109 * Graphical_User_Interfaces::   
110 * Bugs::                        
111 * Concept_Index::               
112 * Command_Index::               
113 * Options_Index::               
114 * Function_Index::              
115 * Terminal_Index::              
116 @end menu
117
118 @node gnuplot, Commands, Top, Top
119 @chapter gnuplot
120
121
122 @menu
123 * Copyright::                   
124 * Introduction::                
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::        
131 * Comments::                    
132 * Coordinates::                 
133 * Datastrings::                 
134 * Environment::                 
135 * Expressions::                 
136 * Glossary::                    
137 * linetype::                    
138 * mouse_input::                 
139 * Plotting::                    
140 * Start-up::                    
141 * String_constants_and_string_variables::  
142 * Substitution_and_Command_line_macros::  
143 * Syntax::                      
144 * Time/Date_data::              
145 @end menu
146
147 @node Copyright, Introduction, gnuplot, gnuplot
148 @section Copyright
149
150 @cindex copyright
151
152 @cindex license
153
154 @example
155     Copyright (C) 1986 - 1993, 1998, 2004, 2007  Thomas Williams, Colin Kelley
156
157 @end example
158
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.
164
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,
169 provided you
170 @example
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
178    software.
179 @end example
180
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.
184
185 This software is provided "as is" without express or implied warranty
186 to the extent permitted by applicable law.
187
188
189 @example
190       AUTHORS
191
192 @end example
193
194 @example
195       Original Software:
196          Thomas Williams,  Colin Kelley.
197
198 @end example
199
200 @example
201       Gnuplot 2.0 additions:
202          Russell Lang, Dave Kotz, John Campbell.
203
204 @end example
205
206 @example
207       Gnuplot 3.0 additions:
208          Gershon Elber and many others.
209
210 @end example
211
212 @example
213       Gnuplot 4.0 additions:
214          See list of contributors at head of this document.
215
216 @end example
217
218 @node Introduction, Seeking-assistance, Copyright, gnuplot
219 @section Introduction
220
221 @cindex introduction
222
223 @c ?
224 `gnuplot` is a command-driven interactive function and data plotting program.
225
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`
232 for more details.
233
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.,
240
241 @example
242       load "filename"
243       cd 'dir'
244
245 @end example
246
247 although there are some subtle differences (see `syntax` for more details).
248
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.
253
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.
262
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
269 brackets.
270
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.
273
274 The new `gnuplot` user should begin by reading about `plotting` (if on-line,
275 type `help plotting`).
276
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
279 }
280
281 @node Seeking-assistance, New_features_introduced_in_version_4.2, Introduction, gnuplot
282 @section Seeking-assistance
283
284 @c ^ <a name="Seeking-assistance"></a>
285 @cindex help-desk
286
287 @cindex seeking-assistance
288
289 There is a mailing list for `gnuplot` users.  Note, however, that the
290 newsgroup
291 @example
292       comp.graphics.apps.gnuplot
293 @end example
294
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
300 }
301
302 The address for mailing to list members is:
303 @example
304       gnuplot-info@@lists.sourceforge.net
305
306 @end example
307
308 Bug reports and code contributions should be mailed to:
309 @example
310       gnuplot-bugs@@lists.sourceforge.net
311
312 @end example
313
314 The list of those interested in beta-test versions is:
315 @example
316       gnuplot-beta@@lists.sourceforge.net
317
318 @end example
319
320 There is also the canonical (if occasionally out-of-date) gnuplot web page at
321
322 @uref{http://www.gnuplot.info,http://www.gnuplot.info
323 }
324
325 Before seeking help, please check the
326
327 @uref{http://www.gnuplot.info/faq/,FAQ (Frequently Asked Questions) list.
328 }
329
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.
336
337
338 @node New_features_introduced_in_version_4.2, Backwards_compatibility, Seeking-assistance, gnuplot
339 @section New features introduced in version 4.2
340
341 @cindex new-features
342
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
347 NEWS file.
348
349
350 @menu
351 * New_plot_styles::             
352 * Input_from_binary_data_files::  
353 * New_plot_elements::           
354 * String_handling::             
355 * Macros::                      
356 * Auto-layout_of_multiple_plots_on_a_page::  
357 * Internal_variables::          
358 * New_or_revised_terminal_drivers::  
359 * Canvas_size::                 
360 @end menu
361
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
364
365
366
367 @menu
368 * Histogram::                   
369 * Label_plots::                 
370 * Image_data::                  
371 * Filled_curves::               
372 * Vectors::                     
373 @end menu
374
375 @node Histogram, Label_plots, New_plot_styles, New_plot_styles
376 @subsubsection Histogram
377
378 Histograms, or bar charts, can be produced.
379 See `histograms`.
380
381
382 @node Label_plots, Image_data, Histogram, New_plot_styles
383 @subsubsection Label plots
384
385 In coordination with the new `datastrings` feature described below, gnuplot
386 can draw a label at each vertex of a curve.
387 See `labels`.
388
389
390 @node Image_data, Filled_curves, Label_plots, New_plot_styles
391 @subsubsection Image data
392
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`.
396
397
398 @node Filled_curves, Vectors, Image_data, New_plot_styles
399 @subsubsection Filled curves
400
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.
403 See `filledcurves`.
404
405
406 @node Vectors,  , Filled_curves, New_plot_styles
407 @subsubsection Vectors
408
409 Gnuplot can draw plots with vectors with a small arrowhead, requiring four or
410 six columns of data for 2D or 3D, respectively.
411 See `vectors`.
412
413
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
416
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`.
422
423
424 @node New_plot_elements, String_handling, Input_from_binary_data_files, New_features_introduced_in_version_4.2
425 @subsection New plot elements
426
427
428
429 @menu
430 * RGB_colors::                  
431 * Arbitrary_rectangles::        
432 @end menu
433
434 @node RGB_colors, Arbitrary_rectangles, New_plot_elements, New_plot_elements
435 @subsubsection RGB colors
436
437 Explicit RGB colors can be specified for all plot elements instead of
438 specifying a predefined linetype.
439 See @ref{colorspec}.
440
441
442 @node Arbitrary_rectangles,  , RGB_colors, New_plot_elements
443 @subsubsection Arbitrary rectangles
444
445 You can place rectangles with desired fill style and border anywhere in a 2D
446 plot.
447 See `set object rectangle`.
448
449
450 @node String_handling, Macros, New_plot_elements, New_features_introduced_in_version_4.2
451 @subsection String handling
452
453
454 @menu
455 * String_and_text_data_read_from_datafiles::  
456 * User-defined_string_variables::  
457 @end menu
458
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
461
462 Gnuplot can now read and process text fields in datafiles.
463 See `datastrings`.
464
465 @node User-defined_string_variables,  , String_and_text_data_read_from_datafiles, String_handling
466 @subsubsection User-defined string variables, operators, and functions
467
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.
471 See @ref{variables}.
472
473
474 @node Macros, Auto-layout_of_multiple_plots_on_a_page, String_handling, New_features_introduced_in_version_4.2
475 @subsection Macros
476
477 Gnuplot supports command line macro expansion  by '@@stringvariablename'.
478 See @ref{macros}.
479
480
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
483
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.
486 See @ref{multiplot}.
487
488
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
491
492 Gnuplot now exports several "read-only" variables such as GPVAL_TERM,
493 GPVAL_X_MIN, etc.
494 See @ref{variables}.
495
496
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
499
500
501 @menu
502 * `wxt`::                       
503 * `emf`::                       
504 * `gif`::                       
505 * @ref{postscript}::            
506 * `ai`::                        
507 * `epslatex`::                  
508 * `windows`::                   
509 @end menu
510
511 @node `wxt`, `emf`, New_or_revised_terminal_drivers, New_or_revised_terminal_drivers
512 @subsubsection `wxt`
513
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
519 enhanced text.
520
521 @node `emf`, `gif`, `wxt`, New_or_revised_terminal_drivers
522 @subsubsection `emf`
523
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.
527
528 @node `gif`, @ref{postscript}, `emf`, New_or_revised_terminal_drivers
529 @subsubsection `gif`, `jpeg`, `png`
530
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
533 of plots.
534
535 @node @ref{postscript}, `ai`, `gif`, New_or_revised_terminal_drivers
536 @subsubsection @ref{postscript}
537
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`.
541
542 @node `ai`, `epslatex`, @ref{postscript}, New_or_revised_terminal_drivers
543 @subsubsection `ai`
544
545 The Adobe Illustrator `ai` driver is outdated. Since Adobe Illustrator
546 understands PostScript files, `set terminal post level1 ...` should be used
547 instead.
548
549 @node `epslatex`, `windows`, `ai`, New_or_revised_terminal_drivers
550 @subsubsection `epslatex`, `pslatex`, `pstex`
551
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}
554 terminal.
555
556 @node `windows`,  , `epslatex`, New_or_revised_terminal_drivers
557 @subsubsection `windows`
558
559 The `windows` terminal now supports the `enhanced text` mode.
560
561
562 @node Canvas_size,  , New_or_revised_terminal_drivers, New_features_introduced_in_version_4.2
563 @subsection Canvas size
564
565 @c ?canvas size
566 @cindex canvas
567
568 @c ?set term size
569
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:
574
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.
578
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.
584
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.
589
590 Example:
591
592 @example
593       set size 0.5, 0.5
594       set term png size 600, 400
595       set output "figure.png"
596       plot "data" with lines
597
598 @end example
599
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
604 version 4.0.
605
606
607 @node Backwards_compatibility, Features_introduced_in_version_4.0, New_features_introduced_in_version_4.2, gnuplot
608 @section Backwards compatibility
609
610 @c ?backwards compatibility
611 @cindex compatibility
612
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:
616
617 @example
618       ./configure --disable-backwards-compatibility
619
620 @end example
621
622 Notice: Deprecated syntax items may be disabled permanently in some future
623 version of gnuplot.
624
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:
629
630 Deprecated:
631 @example
632       set title "Old" 0,-1
633       set data linespoints
634       plot 1 2 4               # horizontal line at y=1
635 @end example
636
637 New:
638 @example
639       TITLE = "New"
640       set title TITLE offset char 0, char -1
641       set style data linespoints
642       plot 1 linetype 2 pointtype 4
643
644 @end example
645
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.
651
652 Please see @ref{size}, @ref{size} and also the documentation for
653 individual terminals.
654
655
656 @node Features_introduced_in_version_4.0, Batch/Interactive_Operation, Backwards_compatibility, gnuplot
657 @section Features introduced in version 4.0
658
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.
662
663
664 @menu
665 * Mouse_and_hotkey_support_in_interactive_terminals::  
666 * New_terminals::               
667 * New_plot_style_@ref{pm3d}::   
668 * Filled_boxes::                
669 * New_plot_option_smooth_frequency::  
670 * Improved_text_options::       
671 * More_text_encodings::         
672 * Arrows::                      
673 * Data_file_format::            
674 * New_commands::                
675 * Other_changes_and_additions::  
676 * Accompanying_documentation::  
677 @end menu
678
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
681
682
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`.
688
689 Sample script: mousevariables.dem
690
691
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
694
695
696 `aqua`: New terminal for Mac OS X. Requires AquaTerm 1.0 or later.
697
698 `epslatex`: New terminal. Prepares eps figures for inclusion in LaTeX
699 documents.
700
701 `gif`: Consolidated with png/jpeg terminals. Requires libgd.
702
703 `ggi`: New full-screen interactive terminal for Linux. Interface to the
704 General Graphics Interface Library.
705
706 `pdf`: New terminal exporting Adobe Portable Document Format. Requires libpdf.
707
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.
711
712 `svg`: New terminal exporting Scalable Vector Graphics.
713
714
715 @node New_plot_style_@ref{pm3d}, Filled_boxes, New_terminals, Features_introduced_in_version_4.0
716 @subsection New plot style @ref{pm3d}
717
718
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}.
722
723 Sample scripts: pm3d.dem pm3dcolors.dem pm3dgamma.dem
724
725
726 @node Filled_boxes, New_plot_option_smooth_frequency, New_plot_style_@ref{pm3d}, Features_introduced_in_version_4.0
727 @subsection Filled boxes
728
729
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`.
733
734 Sample scripts: fillstyle.dem candlesticks.dem
735
736
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
739
740
741 Input data can be filtered through several built-in routines for interpolation
742 or approximation of data.  See @ref{smooth}, `frequency`, `unique`.
743
744 Sample scripts: steps.dem mgr.dem
745
746
747 @node Improved_text_options, More_text_encodings, New_plot_option_smooth_frequency, Features_introduced_in_version_4.0
748 @subsection Improved text options
749
750
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.
757 See `enhanced text`.
758
759 Sample scripts: textcolor.dem textrotate.dem
760
761
762 @node More_text_encodings, Arrows, Improved_text_options, Features_introduced_in_version_4.0
763 @subsection More text encodings
764
765
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.
770
771
772 @node Arrows, Data_file_format, More_text_encodings, Features_introduced_in_version_4.0
773 @subsection Arrows
774
775
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`.
779
780 Sample scripts: arrowstyle.dem vector.dem
781
782
783 @node Data_file_format, New_commands, Arrows, Features_introduced_in_version_4.0
784 @subsection Data file format
785
786
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).
794
795
796 @node New_commands, Other_changes_and_additions, Data_file_format, Features_introduced_in_version_4.0
797 @subsection New commands
798
799
800 `set view map` selects a top-view 2D projection of 3D surface plot.
801
802 `set term push` and `set term pop` save and restore the current terminal type.
803
804 `load` and @ref{save} commands accept piped input and output, respectively.
805
806
807 @node Other_changes_and_additions, Accompanying_documentation, New_commands, Features_introduced_in_version_4.0
808 @subsection Other changes and additions
809
810
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.
815
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}.
821
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.
825
826
827 @node Accompanying_documentation,  , Other_changes_and_additions, Features_introduced_in_version_4.0
828 @subsection Accompanying documentation
829
830
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.
833
834 Improved FAQ. Please read it before asking your question in a public forum.
835
836 There are plenty of new demos *.dem in the demo/ directory. Please run them,
837 for example by
838 @example
839       load "all.dem"
840 @end example
841
842 before asking for help.  Plots produced by the demo scripts can also be viewed
843 at
844 @uref{http://www.gnuplot.info/demo/,http://www.gnuplot.info/demo/
845 }
846
847
848 @node Batch/Interactive_Operation, Command-line-editing, Features_introduced_in_version_4.0, gnuplot
849 @section Batch/Interactive Operation
850
851 @cindex batch/interactive
852
853 `gnuplot` may be executed in either batch or interactive modes, and the two
854 may even be mixed together on many systems.
855
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.
862
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.
865
866 Examples:
867
868 To launch an interactive session:
869 @example
870       gnuplot
871
872 @end example
873
874 To launch a batch session using two command files "input1" and "input2":
875 @example
876       gnuplot input1 input2
877
878 @end example
879
880 To launch an interactive session after an initialization file "header" and
881 followed by another command file "trailer":
882 @example
883       gnuplot header - trailer
884
885 @end example
886
887 @node Command-line-editing, Comments, Batch/Interactive_Operation, gnuplot
888 @section Command-line-editing
889
890 @cindex line-editing
891
892 @cindex editing
893
894 @cindex command-line-editing
895
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.
901
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.)
905
906
907 The editing commands are as follows:
908
909
910 @example
911       `Line-editing`:
912
913 @end example
914
915 @example
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.
926
927 @end example
928
929 @example
930       `History`:
931
932 @end example
933
934 @example
935       ^P    moves back through history.
936       ^N    moves forward through history.
937
938 @end example
939
940
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:
947
948
949 @example
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.
956
957 @end example
958
959
960 The Atari version of readline defines some additional key aliases:
961
962
963 @example
964       Undo            - same as ^L.
965       Home            - same as ^A.
966       Ctrl Home       - same as ^E.
967       Esc             - same as ^U.
968       Help            - @ref{help} plus return.
969       Ctrl Help       - @ref{help}.
970
971 @end example
972
973
974 @node Comments, Coordinates, Command-line-editing, gnuplot
975 @section Comments
976
977 @cindex comments
978
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.
983
984 See also `set datafile commentschars` for specifying comment characters in
985 data files.
986
987 @node Coordinates, Datastrings, Comments, gnuplot
988 @section Coordinates
989
990 @cindex coordinates
991
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:
995
996 @example
997       @{<system>@} <x>, @{<system>@} <y> @{,@{<system>@} <z>@}
998
999 @end example
1000
1001 Each <system> can either be `first`, `second`, `graph`, `screen`, or
1002 `character`.
1003
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
1013 font size.
1014
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.
1017
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,
1023
1024 @example
1025       set logscale x
1026       set arrow 100,5 rto 10,2
1027
1028 @end example
1029
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.
1032
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.
1037
1038 @node Datastrings, Environment, Coordinates, gnuplot
1039 @section Datastrings
1040
1041 @cindex datastrings
1042
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:
1049
1050 @example
1051   1.000 2.000 "Third column is all of this text" 4.00
1052
1053 @end example
1054
1055 Text fields can be positioned within a 2-D or 3-D plot using the commands:
1056
1057 @example
1058   plot 'datafile' using 1:2:4 with labels
1059   splot 'datafile using 1:2:3:4 with labels
1060
1061 @end example
1062
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.
1070
1071 @example
1072   set xtics
1073   plot 'datafile' using 3:4:xticlabels(1) with linespoints
1074
1075 @end example
1076
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:
1082
1083 @example
1084   plot 'datafile' using 1:(f($2)/$4) title 2 with lines
1085
1086 @end example
1087
1088 See `set style labels`, `using xticlabels`, @ref{title}, @ref{using}.
1089
1090 @node Environment, Expressions, Datastrings, gnuplot
1091 @section Environment
1092
1093 @cindex environment
1094
1095 A number of shell environment variables are understood by `gnuplot`.  None of
1096 these are required, but may be useful.
1097
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.
1102
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).
1105
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`
1109 if desired.
1110
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
1115 start-up`.
1116
1117 On Unix, PAGER is used as an output filter for help messages.
1118
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.
1121
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
1125 800x600, then use:
1126 @example
1127       set PCTRM=S800
1128 @end example
1129
1130 If PCTRM is not set, standard VGA is used.
1131
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.
1135
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.
1142
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.
1147
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.
1152
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`.
1158
1159 @node Expressions, Glossary, Environment, gnuplot
1160 @section Expressions
1161
1162 @cindex expressions
1163
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.
1168
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.
1172
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.
1181
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.
1185 @cindex NaN
1186
1187
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
1190 integers.
1191
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.
1195
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.
1202
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.
1208
1209 @menu
1210 * Functions::                   
1211 * Operators::                   
1212 * Gnuplot-defined_variables::   
1213 * User-defined_variables_and_functions::  
1214 @end menu
1215
1216 @node Functions, Operators, Expressions, Expressions
1217 @subsection Functions
1218
1219 @c ?expressions functions
1220 @cindex functions
1221 @opindex functions
1222
1223
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.
1227
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.
1232
1233
1234
1235 @menu
1236 * abs::                         
1237 * acos::                        
1238 * acosh::                       
1239 * arg::                         
1240 * asin::                        
1241 * asinh::                       
1242 * atan::                        
1243 * atan2::                       
1244 * atanh::                       
1245 * besj0::                       
1246 * besj1::                       
1247 * besy0::                       
1248 * besy1::                       
1249 * ceil::                        
1250 * cos::                         
1251 * cosh::                        
1252 * erf::                         
1253 * erfc::                        
1254 * exp::                         
1255 * floor::                       
1256 * gamma::                       
1257 * ibeta::                       
1258 * inverf::                      
1259 * igamma::                      
1260 * imag::                        
1261 * invnorm::                     
1262 * int::                         
1263 * lambertw::                    
1264 * lgamma::                      
1265 * log::                         
1266 * log10::                       
1267 * norm::                        
1268 * rand::                        
1269 * real::                        
1270 * sgn::                         
1271 * sin::                         
1272 * sinh::                        
1273 * sqrt::                        
1274 * tan::                         
1275 * tanh::                        
1276 * gprintf::                     
1277 * sprintf::                     
1278 * strlen::                      
1279 * strstrt::                     
1280 * substr::                      
1281 * strftime::                    
1282 * strptime::                    
1283 * system::                      
1284 * word::                        
1285 * words::                       
1286 * column::                      
1287 * defined::                     
1288 * exists::                      
1289 * stringcolumn::                
1290 * timecolumn::                  
1291 * tm_hour::                     
1292 * tm_mday::                     
1293 * tm_min::                      
1294 * tm_mon::                      
1295 * tm_sec::                      
1296 * tm_wday::                     
1297 * tm_yday::                     
1298 * tm_year::                     
1299 * valid::                       
1300 * Random_number_generator::     
1301 @end menu
1302
1303 @node abs, acos, Functions, Functions
1304 @subsubsection abs
1305
1306 @c ?expressions functions abs
1307 @c ?functions abs
1308 @cindex abs
1309 @findex abs
1310
1311
1312 The `abs(x)` function returns the absolute value of its argument.  The
1313 returned value is of the same type as the argument.
1314
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) ].
1317
1318 @node acos, acosh, abs, Functions
1319 @subsubsection acos
1320
1321 @c ?expressions functions acos
1322 @c ?functions acos
1323 @cindex acos
1324 @findex acos
1325
1326
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
1329 @ref{angles}.
1330
1331 @node acosh, arg, acos, Functions
1332 @subsubsection acosh
1333
1334 @c ?expressions functions acosh
1335 @c ?functions acosh
1336 @cindex acosh
1337 @findex acosh
1338
1339
1340 The `acosh(x)` function returns the inverse hyperbolic cosine of its argument
1341 in radians.
1342
1343 @node arg, asin, acosh, Functions
1344 @subsubsection arg
1345
1346 @c ?expressions functions arg
1347 @c ?functions arg
1348 @cindex arg
1349 @findex arg
1350
1351
1352 The `arg(x)` function returns the phase of a complex number in radians or
1353 degrees, as selected by @ref{angles}.
1354
1355 @node asin, asinh, arg, Functions
1356 @subsubsection asin
1357
1358 @c ?expressions functions asin
1359 @c ?functions asin
1360 @cindex asin
1361 @findex asin
1362
1363
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}.
1366
1367 @node asinh, atan, asin, Functions
1368 @subsubsection asinh
1369
1370 @c ?expressions functions asinh
1371 @c ?functions asinh
1372 @cindex asinh
1373 @findex asinh
1374
1375
1376 The `asinh(x)` function returns the inverse hyperbolic sin of its argument in
1377 radians.
1378
1379 @node atan, atan2, asinh, Functions
1380 @subsubsection atan
1381
1382 @c ?expressions functions atan
1383 @c ?functions atan
1384 @cindex atan
1385 @findex atan
1386
1387
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
1390 @ref{angles}.
1391
1392 @node atan2, atanh, atan, Functions
1393 @subsubsection atan2
1394
1395 @c ?expressions functions atan2
1396 @c ?functions atan2
1397 @cindex atan2
1398 @findex atan2
1399
1400
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.
1404
1405 @node atanh, besj0, atan2, Functions
1406 @subsubsection atanh
1407
1408 @c ?expressions functions atanh
1409 @c ?functions atanh
1410 @cindex atanh
1411 @findex atanh
1412
1413
1414 The `atanh(x)` function returns the inverse hyperbolic tangent of its
1415 argument in radians.
1416
1417 @node besj0, besj1, atanh, Functions
1418 @subsubsection besj0
1419
1420 @c ?expressions functions besj0
1421 @c ?functions besj0
1422 @cindex besj0
1423 @findex besj0
1424
1425
1426 The `besj0(x)` function returns the j0th Bessel function of its argument.
1427 @ref{besj0} expects its argument to be in radians.
1428
1429 @node besj1, besy0, besj0, Functions
1430 @subsubsection besj1
1431
1432 @c ?expressions functions besj1
1433 @c ?functions besj1
1434 @cindex besj1
1435 @findex besj1
1436
1437
1438 The `besj1(x)` function returns the j1st Bessel function of its argument.
1439 @ref{besj1} expects its argument to be in radians.
1440
1441 @node besy0, besy1, besj1, Functions
1442 @subsubsection besy0
1443
1444 @c ?expressions functions besy0
1445 @c ?functions besy0
1446 @cindex besy0
1447 @findex besy0
1448
1449
1450 The `besy0(x)` function returns the y0th Bessel function of its argument.
1451 @ref{besy0} expects its argument to be in radians.
1452
1453 @node besy1, ceil, besy0, Functions
1454 @subsubsection besy1
1455
1456 @c ?expressions functions besy1
1457 @c ?functions besy1
1458 @cindex besy1
1459 @findex besy1
1460
1461
1462 The `besy1(x)` function returns the y1st Bessel function of its argument.
1463 @ref{besy1} expects its argument to be in radians.
1464
1465 @node ceil, cos, besy1, Functions
1466 @subsubsection ceil
1467
1468 @c ?expressions functions ceil
1469 @c ?functions ceil
1470 @cindex ceil
1471 @findex ceil
1472
1473
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.
1477
1478 @node cos, cosh, ceil, Functions
1479 @subsubsection cos
1480
1481 @c ?expressions functions cos
1482 @c ?functions cos
1483 @cindex cos
1484 @findex cos
1485
1486
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}.
1489
1490 @node cosh, erf, cos, Functions
1491 @subsubsection cosh
1492
1493 @c ?expressions functions cosh
1494 @c ?functions cosh
1495 @cindex cosh
1496 @findex cosh
1497
1498
1499 The `cosh(x)` function returns the hyperbolic cosine of its argument.  @ref{cosh}
1500 expects its argument to be in radians.
1501
1502 @node erf, erfc, cosh, Functions
1503 @subsubsection erf
1504
1505 @c ?expressions functions erf
1506 @c ?functions erf
1507 @cindex erf
1508 @findex erf
1509
1510
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}.
1514
1515 @node erfc, exp, erf, Functions
1516 @subsubsection erfc
1517
1518 @c ?expressions functions erfc
1519 @c ?functions erfc
1520 @cindex erfc
1521 @findex erfc
1522
1523
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}.
1527
1528 @node exp, floor, erfc, Functions
1529 @subsubsection exp
1530
1531 @c ?expressions functions exp
1532 @c ?functions exp
1533 @cindex exp
1534 @findex exp
1535
1536
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.
1541
1542 @node floor, gamma, exp, Functions
1543 @subsubsection floor
1544
1545 @c ?expressions functions floor
1546 @c ?functions floor
1547 @cindex floor
1548 @findex floor
1549
1550
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.
1554
1555 @node gamma, ibeta, floor, Functions
1556 @subsubsection gamma
1557
1558 @c ?expressions functions gamma
1559 @c ?functions gamma
1560 @cindex gamma
1561 @findex gamma
1562
1563
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.
1567
1568 @node ibeta, inverf, gamma, Functions
1569 @subsubsection ibeta
1570
1571 @c ?expressions functions ibeta
1572 @c ?functions ibeta
1573 @cindex ibeta
1574 @findex ibeta
1575
1576
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.
1580
1581 @node inverf, igamma, ibeta, Functions
1582 @subsubsection inverf
1583
1584 @c ?expressions functions inverf
1585 @c ?functions inverf
1586 @cindex inverf
1587 @findex inverf
1588
1589
1590 The `inverf(x)` function returns the inverse error function of the real part
1591 of its argument.   See `erf` and @ref{invnorm}.
1592
1593 @node igamma, imag, inverf, Functions
1594 @subsubsection igamma
1595
1596 @c ?expressions functions igamma
1597 @c ?functions igamma
1598 @cindex igamma
1599 @findex igamma
1600
1601
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.
1607
1608 @node imag, invnorm, igamma, Functions
1609 @subsubsection imag
1610
1611 @c ?expressions functions imag
1612 @c ?functions imag
1613 @cindex imag
1614 @findex imag
1615
1616
1617 The `imag(x)` function returns the imaginary part of its argument as a real
1618 number.
1619
1620 @node invnorm, int, imag, Functions
1621 @subsubsection invnorm
1622
1623 @c ?expressions functions invnorm
1624 @c ?functions invnorm
1625 @cindex invnorm
1626 @findex invnorm
1627
1628
1629 The `invnorm(x)` function returns the inverse cumulative normal (Gaussian)
1630 distribution function of the real part of its argument.  See @ref{norm}.
1631
1632 @node int, lambertw, invnorm, Functions
1633 @subsubsection int
1634
1635 @c ?expressions functions int
1636 @c ?functions int
1637 @cindex int
1638 @findex int
1639
1640
1641 The `int(x)` function returns the integer part of its argument, truncated
1642 toward zero.
1643
1644 @node lambertw, lgamma, int, Functions
1645 @subsubsection lambertw
1646
1647 @c ?expressions functions lambertw
1648 @c ?functions lambertw
1649 @cindex lambertw
1650 @findex lambertw
1651
1652
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).
1656
1657 @node lgamma, log, lambertw, Functions
1658 @subsubsection lgamma
1659
1660 @c ?expressions functions lgamma
1661 @c ?functions lgamma
1662 @cindex lgamma
1663 @findex lgamma
1664
1665
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.
1669
1670 @node log, log10, lgamma, Functions
1671 @subsubsection log
1672
1673 @c ?expressions functions log
1674 @c ?functions log
1675 @cindex log
1676 @findex log
1677
1678
1679 The `log(x)` function returns the natural logarithm (base `e`) of its
1680 argument.  See @ref{log10}.
1681
1682 @node log10, norm, log, Functions
1683 @subsubsection log10
1684
1685 @c ?expressions functions log10
1686 @c ?functions log10
1687 @cindex log10
1688 @findex log10
1689
1690
1691 The `log10(x)` function returns the logarithm (base 10) of its argument.
1692
1693 @node norm, rand, log10, Functions
1694 @subsubsection norm
1695
1696 @c ?expressions functions norm
1697 @c ?functions norm
1698 @cindex norm
1699 @findex norm
1700
1701
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}.
1704
1705 @node rand, real, norm, Functions
1706 @subsubsection rand
1707
1708 @c ?expressions functions rand
1709 @c ?functions rand
1710 @cindex rand
1711 @findex rand
1712
1713
1714 `rand(0)`  returns a pseudo random number in the interval [0:1] generated
1715 @example
1716            from the current value of two internal 32-bit seeds.
1717 @end example
1718
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.
1725
1726 @node real, sgn, rand, Functions
1727 @subsubsection real
1728
1729 @c ?expressions functions real
1730 @c ?functions real
1731 @cindex real
1732 @findex real
1733
1734
1735 The `real(x)` function returns the real part of its argument.
1736
1737 @node sgn, sin, real, Functions
1738 @subsubsection sgn
1739
1740 @c ?expressions functions sgn
1741 @c ?functions sgn
1742 @cindex sgn
1743 @findex sgn
1744
1745
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.
1749
1750 @node sin, sinh, sgn, Functions
1751 @subsubsection sin
1752
1753 @c ?expressions functions sin
1754 @c ?functions sin
1755 @cindex sin
1756 @findex sin
1757
1758
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}.
1761
1762 @node sinh, sqrt, sin, Functions
1763 @subsubsection sinh
1764
1765 @c ?expressions functions sinh
1766 @c ?functions sinh
1767 @cindex sinh
1768 @findex sinh
1769
1770
1771 The `sinh(x)` function returns the hyperbolic sine of its argument.  @ref{sinh}
1772 expects its argument to be in radians.
1773
1774 @node sqrt, tan, sinh, Functions
1775 @subsubsection sqrt
1776
1777 @c ?expressions functions sqrt
1778 @c ?functions sqrt
1779 @cindex sqrt
1780 @findex sqrt
1781
1782
1783 The `sqrt(x)` function returns the square root of its argument.
1784
1785 @node tan, tanh, sqrt, Functions
1786 @subsubsection tan
1787
1788 @c ?expressions functions tan
1789 @c ?functions tan
1790 @cindex tan
1791 @findex tan
1792
1793
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}.
1796
1797 @node tanh, gprintf, tan, Functions
1798 @subsubsection tanh
1799
1800 @c ?expressions functions tanh
1801 @c ?functions tanh
1802 @cindex tanh
1803 @findex tanh
1804
1805
1806 The `tanh(x)` function returns the hyperbolic tangent of its argument.  @ref{tanh}
1807 expects its argument to be in radians.
1808
1809
1810
1811
1812 @node gprintf, sprintf, tanh, Functions
1813 @subsubsection gprintf
1814
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`.
1821
1822 @node sprintf, strlen, gprintf, Functions
1823 @subsubsection sprintf
1824
1825 @c ?expressions functions sprintf
1826 @c ?functions sprintf
1827 @cindex sprintf
1828 @findex sprintf
1829
1830
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.
1836
1837 @node strlen, strstrt, sprintf, Functions
1838 @subsubsection strlen
1839
1840 @c ?expressions functions strlen
1841 @c ?functions strlen
1842 @cindex strlen
1843 @findex strlen
1844
1845
1846 `strlen("string")` returns the number of characters in the string.
1847
1848 @node strstrt, substr, strlen, Functions
1849 @subsubsection strstrt
1850
1851 @c ?expressions functions strstrt
1852 @c ?functions strstrt
1853 @cindex strstrt
1854 @findex strstrt
1855
1856
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.
1861
1862 @node substr, strftime, strstrt, Functions
1863 @subsubsection substr
1864
1865 @c ?expressions functions substr
1866 @c ?functions substr
1867 @cindex substr
1868 @findex substr
1869
1870
1871 @cindex substring
1872
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.
1877
1878 @node strftime, strptime, substr, Functions
1879 @subsubsection strftime
1880
1881 @c ?expressions functions strftime
1882 @c ?functions strftime
1883 @cindex strftime
1884 @findex strftime
1885
1886
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}.
1890
1891 @node strptime, system, strftime, Functions
1892 @subsubsection strptime
1893
1894 @c ? expressions functions strptime
1895 @c ?functions strptime
1896 @cindex strptime
1897 @findex strptime
1898
1899
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}.
1903
1904 @node system, word, strptime, Functions
1905 @subsubsection system
1906
1907 @c ?expressions functions system
1908 @c ?functions system
1909 @c ?system function
1910 @cindex system
1911 @cmindex system
1912
1913
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.
1917
1918 This can be used to import external functions into gnuplot scripts using
1919 'f(x) = real(system(sprintf("somecommand %f", x)))'.
1920
1921 @node word, words, system, Functions
1922 @subsubsection word
1923
1924 @c ?expressions functions word
1925 @c ?functions word
1926 @cindex word
1927 @findex word
1928
1929
1930 @cindex word
1931 @findex word
1932
1933
1934 `word("string",n)` returns the nth word in string. For example,
1935 `word("one two three",2)` returns the string "two".
1936
1937 @node words, column, word, Functions
1938 @subsubsection words
1939
1940 @c ?expressions functions words
1941 @c ?functions words
1942 @cindex words
1943 @findex words
1944
1945
1946 @cindex words
1947 @findex words
1948
1949
1950 `words("string")` returns the number of words in string. For example,
1951 `words(" a b c d")` returns the 4.
1952
1953
1954
1955
1956 @node column, defined, words, Functions
1957 @subsubsection column
1958
1959 @c ?expressions functions column
1960 @c ?functions column
1961 @cindex column
1962 @findex column
1963
1964
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}.
1968
1969 @node defined, exists, column, Functions
1970 @subsubsection defined
1971
1972 @c ?expressions functions defined
1973 @c ?functions defined
1974 @cindex defined
1975 @findex defined
1976
1977
1978 `defined(X)` [DEPRECATED] returns 1 if a variable named X has been defined, otherwise
1979 it returns 0.
1980
1981 @node exists, stringcolumn, defined, Functions
1982 @subsubsection exists
1983
1984 @c ?expressions functions exists
1985 @c ?functions exists
1986 @cindex exists
1987 @findex exists
1988
1989
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.
1993
1994 @node stringcolumn, timecolumn, exists, Functions
1995 @subsubsection stringcolumn
1996
1997 @c ?expressions functions stringcolumn
1998 @c ?functions stringcolumn
1999 @cindex stringcolumn
2000 @findex stringcolumn
2001
2002
2003 @c ?expressions functions strcol
2004 @c ?functions strcol
2005 @cindex strcol
2006
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.
2009 See @ref{using}.
2010
2011 @node timecolumn, tm_hour, stringcolumn, Functions
2012 @subsubsection timecolumn
2013
2014 @c ?expressions functions timecolumn
2015 @c ?functions timecolumn
2016 @cindex timecolumn
2017 @findex timecolumn
2018
2019
2020 `timecolumn(x)` may be used only in expressions as part of @ref{using}
2021 manipulations to fits or datafile plots.   See @ref{using}.
2022
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".
2026
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.
2031
2032 @node tm_hour, tm_mday, timecolumn, Functions
2033 @subsubsection tm_hour
2034
2035 @c ?expressions tm_hour
2036 @findex tm_hour
2037 @c ?functions tm_hour
2038 @cindex tm_hour
2039 @findex tm_hour
2040
2041
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.
2044
2045 @node tm_mday, tm_min, tm_hour, Functions
2046 @subsubsection tm_mday
2047
2048 @c ?expressions tm_mday
2049 @findex tm_mday
2050 @c ?functions tm_mday
2051 @cindex tm_mday
2052 @findex tm_mday
2053
2054
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)
2057 as a real.
2058
2059 @node tm_min, tm_mon, tm_mday, Functions
2060 @subsubsection tm_min
2061
2062 @c ?expressions tm_min
2063 @findex tm_min
2064 @c ?functions tm_min
2065 @cindex tm_min
2066 @findex tm_min
2067
2068
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.
2071
2072 @node tm_mon, tm_sec, tm_min, Functions
2073 @subsubsection tm_mon
2074
2075 @c ?expressions tm_mon
2076 @findex tm_mon
2077 @c ?functions tm_mon
2078 @cindex tm_mon
2079 @findex tm_mon
2080
2081
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.
2084
2085 @node tm_sec, tm_wday, tm_mon, Functions
2086 @subsubsection tm_sec
2087
2088 @c ?expressions tm_sec
2089 @findex tm_sec
2090 @c ?functions tm_sec
2091 @cindex tm_sec
2092 @findex tm_sec
2093
2094
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.
2097
2098 @node tm_wday, tm_yday, tm_sec, Functions
2099 @subsubsection tm_wday
2100
2101 @c ?expressions tm_wday
2102 @findex tm_wday
2103 @c ?functions tm_wday
2104 @cindex tm_wday
2105 @findex tm_wday
2106
2107
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
2110 a real.
2111
2112 @node tm_yday, tm_year, tm_wday, Functions
2113 @subsubsection tm_yday
2114
2115 @c ?expressions tm_yday
2116 @findex tm_yday
2117 @c ?functions tm_yday
2118 @cindex tm_yday
2119 @findex tm_yday
2120
2121
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)
2124 as a real.
2125
2126 @node tm_year, valid, tm_yday, Functions
2127 @subsubsection tm_year
2128
2129 @c ?expressions tm_year
2130 @findex tm_year
2131 @c ?functions tm_year
2132 @cindex tm_year
2133 @findex tm_year
2134
2135
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.
2138
2139 @node valid, Random_number_generator, tm_year, Functions
2140 @subsubsection valid
2141
2142 @c ?expressions functions valid
2143 @c ?functions valid
2144 @cindex valid
2145 @findex valid
2146
2147
2148 `valid(x)` may be used only in expressions as part of @ref{using} manipulations
2149 to fits or datafile plots.  See @ref{using}.
2150
2151 See also
2152 @uref{http://www.gnuplot.info/demo/airfoil.html,airfoil.dem: use of functions and complex variables for airfoils demo.
2153 }
2154
2155
2156 @node Random_number_generator,  , valid, Functions
2157 @subsubsection Random number generator
2158
2159 @c ?expressions random
2160 @c ?functions random
2161 @cindex random
2162
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:
2167 @example
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.
2173
2174 @end example
2175
2176
2177 @node Operators, Gnuplot-defined_variables, Functions, Expressions
2178 @subsection Operators
2179
2180 @c ?expressions operators
2181 @cindex operators
2182
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.
2187
2188 Parentheses may be used to change order of evaluation.
2189
2190 @menu
2191 * Unary::                       
2192 * Binary::                      
2193 * Ternary::                     
2194 @end menu
2195
2196 @node Unary, Binary, Operators, Operators
2197 @subsubsection Unary
2198
2199 @c ?expressions operators unary
2200 @c ?operators unary
2201 @cindex unary
2202
2203 The following is a list of all the unary operators and their usages:
2204
2205
2206 @example
2207     Symbol      Example    Explanation
2208       -           -a          unary minus
2209       +           +a          unary plus (no-operation)
2210       ~           ~a        * one's complement
2211       !           !a        * logical negation
2212       !           a!        * factorial
2213       $           $3        * call arg/column during @ref{using} manipulation
2214 @end example
2215
2216 @cindex factorial
2217
2218 @cindex negation
2219
2220 @cindex one's complement
2221
2222 @cindex operator precedence
2223
2224
2225 (*) Starred explanations indicate that the operator requires an integer
2226 argument.
2227
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,
2230 but (-2)**2 = 4.
2231
2232 The factorial operator returns a real number to allow a greater range.
2233
2234 @node Binary, Ternary, Unary, Operators
2235 @subsubsection Binary
2236
2237 @c ?expressions operators binary
2238 @c ?operators binary
2239 The following is a list of all the binary operators and their usages:
2240
2241
2242 @example
2243     Symbol       Example      Explanation
2244       **          a**b          exponentiation
2245       *           a*b           multiplication
2246       /           a/b           division
2247       %           a%b         * modulo
2248       +           a+b           addition
2249       -           a-b           subtraction
2250       ==          a==b          equality
2251       !=          a!=b          inequality
2252       <           a<b           less than
2253       <=          a<=b          less than or equal to
2254       >           a>b           greater than
2255       >=          a>=b          greater than or equal to
2256       &           a&b         * bitwise AND
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
2264 @end example
2265
2266 @cindex bitwise operators
2267
2268 @cindex string operators
2269
2270 @cindex modulo
2271
2272 @cindex exponentiation
2273
2274
2275
2276 (*) Starred explanations indicate that the operator requires integer
2277 arguments.
2278 Capital letters A and B indicate that the operator requires string arguments.
2279
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.
2283
2284 @node Ternary,  , Binary, Operators
2285 @subsubsection Ternary
2286
2287 @c ?expressions operators ternary
2288 @c ?operators ternary
2289 @cindex ternary
2290
2291 There is a single ternary operator:
2292
2293
2294 @example
2295     Symbol       Example      Explanation
2296       ?:          a?b:c     ternary operation
2297
2298 @end example
2299
2300
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.
2305
2306 The ternary operator is very useful both in constructing piecewise functions
2307 and in plotting points only when certain conditions are met.
2308
2309 Examples:
2310
2311 Plot a function that is to equal sin(x) for 0 <= x < 1, 1/x for 1 <= x < 2,
2312 and undefined elsewhere:
2313 @example
2314       f(x) = 0<=x && x<1 ? sin(x) : 1<=x && x<2 ? 1/x : 1/0
2315       plot f(x)
2316 @end example
2317
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.)
2324
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:
2327
2328 @example
2329       plot 'file' using 1:( $4<0 ? 1/0 : ($2+$3)/2 )
2330
2331 @end example
2332
2333 Please see @ref{using} for an explanation of the @ref{using} syntax.
2334
2335
2336 @node Gnuplot-defined_variables, User-defined_variables_and_functions, Operators, Expressions
2337 @subsection Gnuplot-defined variables
2338
2339 @c ?gnuplot-defined variables
2340 The variable `pi` is defined to be pi, see
2341 @example
2342       print pi
2343
2344 @end example
2345
2346 Additionally, gnuplot may define some variables under various operations.
2347
2348 Working with interactive terminals with `mouse` functionality defines
2349 variables with names that begin "MOUSE_", see @ref{variables} for details.
2350
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`.
2355
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.
2361
2362 See @ref{variables}, @ref{variables}, and @ref{fit}.
2363
2364
2365 @node User-defined_variables_and_functions,  , Gnuplot-defined_variables, Expressions
2366 @subsection User-defined variables and functions
2367
2368 @c ?expressions user-defined
2369 @c ?user-defined variables
2370 @cindex user-defined
2371
2372 @cindex variables
2373 @opindex variables
2374
2375
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.
2378
2379 User-defined function syntax:
2380 @example
2381       <func-name>( <dummy1> @{,<dummy2>@} ... @{,<dummy5>@} ) = <expression>
2382
2383 @end example
2384
2385 where <expression> is defined in terms of <dummy1> through <dummy5>.
2386
2387 User-defined variable syntax:
2388 @example
2389       <variable-name> = <constant-expression>
2390
2391 @end example
2392
2393 Examples:
2394 @example
2395       w = 2
2396       q = floor(tan(pi/2 - 0.1))
2397       f(x) = sin(w*x)
2398       sinc(x) = sin(pi*x)/(pi*x)
2399       delta(t) = (t == 0)
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)
2405
2406 @end example
2407
2408 @example
2409       file = "mydata.inp"
2410       file(n) = sprintf("run_%d.dat",n)
2411
2412 @end example
2413
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.
2417
2418 @cindex NaN
2419
2420 @cindex pi
2421
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:
2425
2426 @example
2427       NaN = GPVAL_NaN
2428       pi  = GPVAL_pi
2429
2430 @end example
2431
2432 Other variables may be defined under various gnuplot operations like mousing in
2433 interactive terminals or fitting; see @ref{variables} for details.
2434
2435 You can check for existence of a given variable V by the exists("V")
2436 expression. For example
2437 @example
2438       a = 10
2439       if (exists("a")) print "a is defined"
2440       if (!exists("b")) print "b is not defined"
2441
2442 @end example
2443
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 "_".
2446
2447 See @ref{functions}, @ref{functions}, @ref{variables}, @ref{macros}.
2448
2449 @node Glossary, linetype, Expressions, gnuplot
2450 @section Glossary
2451
2452 @cindex glossary
2453
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.
2459
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.
2462
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.
2466
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.
2469
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.
2473
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".
2477
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.
2481
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
2485 border.
2486
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}.
2490
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.
2497
2498 @node linetype, mouse_input, Glossary, gnuplot
2499 @section linetype, colors, and styles
2500
2501 @cindex linetype
2502
2503 @cindex colors
2504
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.
2515
2516 Examples:
2517
2518 @example
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
2522
2523 @end example
2524
2525 @cindex colors
2526
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.
2530
2531 Examples:
2532
2533 @example
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
2539
2540 @end example
2541
2542 See @ref{colornames}, @ref{palette}, @ref{cbrange}.
2543
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.
2550
2551 Example:
2552
2553 @example
2554      set term postscript dashed color
2555      plot 'foo' lt 3, 'baz' lt 3 linecolor 1, 'bar' lt 3 lc rgb 'gold'
2556
2557 @end example
2558
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.
2564
2565 Examples:
2566
2567 @example
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
2572
2573 @end example
2574
2575 See `linestyle`, `set style line`.
2576
2577 @menu
2578 * colorspec::                   
2579 @end menu
2580
2581 @node colorspec,  , linetype, linetype
2582 @subsection colorspec
2583
2584 @cindex colorspec
2585
2586 @cindex rgbcolor
2587
2588 @cindex lc
2589
2590 @cindex linecolor
2591
2592 @cindex tc
2593
2594 @cindex textcolor
2595
2596 @cindex colors
2597
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.
2600
2601 Syntax:
2602
2603 @example
2604       ... @{linetype | lt@} <colorspec>
2605       ... @{linecolor | lc@} <colorspec>
2606       ... @{textcolor | tc@} <colorspec>
2607
2608 @end example
2609
2610 where <colorspec> has one of the following forms:
2611
2612 @example
2613       rgbcolor "colorname"
2614       rgbcolor "#RRGGBB"
2615       rgbcolor variable
2616       palette frac <val>      # <val> runs from 0 to 1
2617       palette cb <value>      # <val> lies within cbrange
2618       palette z
2619       variable                # color index is read from input file
2620
2621 @end example
2622
2623 "colorname" refers to one of the color names built in to gnuplot. For a list
2624 of the available names, see @ref{colornames}.
2625
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).
2631
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).
2636
2637 Example:
2638
2639 @example
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
2642
2643 @end example
2644
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
2651 palette.
2652
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.
2657
2658 @menu
2659 * linecolor_variable::          
2660 @end menu
2661
2662 @node linecolor_variable,  , colorspec, colorspec
2663 @subsubsection linecolor variable
2664
2665 @c ?linecolor variable
2666 @c ?lc variable
2667 @c ?textcolor variable
2668 @c ?tc 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
2674 keyword `variable`. 
2675
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`.
2680
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
2687 pseudocolumn -2.
2688
2689 Examples:
2690 @example
2691       # Use the third column of data to assign colors to individual points
2692       plot 'data' using 1:2:3 with points lc variable
2693
2694 @end example
2695
2696 @example
2697       # Use the data set index to choose a linestyle color
2698       plot 'data' using 1:2:(column(-2)) with lines lc variable
2699
2700 @end example
2701
2702
2703 @node mouse_input, Plotting, linetype, gnuplot
2704 @section mouse input
2705
2706 @c ?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`.
2715
2716 @menu
2717 * bind::                        
2718 * Mouse_variables::             
2719 @end menu
2720
2721 @node bind, Mouse_variables, mouse_input, mouse_input
2722 @subsection bind
2723
2724 @c ?commands bind
2725 @cindex bind
2726
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.
2734
2735 You get the list of all hotkeys by typing @ref{bind} or by hitting 'h' in the
2736 graph window.
2737
2738 Note that multikey-bindings with modifiers have to be quoted.
2739
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.
2745
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}.
2752
2753 Syntax:
2754 @example
2755       bind @{allwindows@} [<key-sequence>] ["<gnuplot commands>"]
2756       bind!
2757
2758 @end example
2759
2760 Examples:
2761
2762 - set bindings:
2763
2764 @example
2765     bind a "replot"
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'
2770
2771 @end example
2772
2773 - show bindings:
2774 @example
2775     bind "ctrl-a"          # shows the binding for ctrl-a
2776     bind                   # shows all bindings
2777
2778 @end example
2779
2780 - remove bindings:
2781 @example
2782     bind "ctrl-alt-a" ""   # removes binding for ctrl-alt-a
2783                              (note that builtins cannot be removed)
2784     bind!                  # installs default (builtin) bindings
2785
2786 @end example
2787
2788 - bind a key to toggle something:
2789 @example
2790   v=0
2791   bind "ctrl-r" "v=v+1;if(v%2)set term x11 noraise; else set term x11 raise"
2792
2793 @end example
2794
2795 Modifiers (ctrl / alt) are case insensitive, keys not:
2796 @example
2797     ctrl-alt-a == CtRl-alT-a
2798     ctrl-alt-a != ctrl-alt-A
2799
2800 @end example
2801
2802 List of modifiers (alt == meta):
2803 @example
2804     ctrl, alt
2805
2806 @end example
2807
2808 List of supported special keys:
2809
2810 @example
2811    "BackSpace", "Tab", "Linefeed", "Clear", "Return", "Pause", "Scroll_Lock",
2812    "Sys_Req", "Escape", "Delete", "Home", "Left", "Up", "Right", "Down",
2813    "PageUp", "PageDown", "End", "Begin",
2814
2815 @end example
2816
2817 @example
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",
2822    "KP_Divide",
2823
2824 @end example
2825
2826 @example
2827    "KP_1" - "KP_9", "F1" - "F12"
2828
2829 @end example
2830
2831 See also help for `mouse` and @ref{if}.
2832
2833
2834 @node Mouse_variables,  , bind, mouse_input
2835 @subsection Mouse variables
2836
2837 @c ?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.
2847
2848 @example
2849       plot 'something'
2850       pause mouse
2851       if (defined(MOUSE_BUTTON)) call 'something_else'; \
2852       else print "No mouse click."
2853
2854 @end example
2855
2856 It is also possible to track keystrokes in the plot window using the mousing
2857 code.
2858
2859 @example
2860       plot 'something'
2861       pause mouse keypress
2862       print "Keystroke ", MOUSE_KEY, " at ", MOUSE_X, " ", MOUSE_Y
2863
2864 @end example
2865
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.
2871
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}.
2874
2875
2876
2877 @node Plotting, Start-up, mouse_input, gnuplot
2878 @section Plotting
2879
2880 @cindex plotting
2881
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
2886 command.
2887
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.
2890
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.
2896
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.
2905
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.
2911
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.
2915
2916 @node Start-up, String_constants_and_string_variables, Plotting, gnuplot
2917 @section Start-up
2918
2919 @c ^ <a name="start-up"></a>
2920 @cindex startup
2921
2922 @cindex start
2923
2924 @cindex .gnuplot
2925
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.
2935
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.
2939
2940 @node String_constants_and_string_variables, Substitution_and_Command_line_macros, Start-up, gnuplot
2941 @section String constants and string variables
2942
2943 @cindex strings
2944
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
2949 same plot title:
2950
2951 @example
2952       four = "4"
2953       graph4 = "Title for plot #4"
2954       graph(n) = sprintf("Title for plot #%d",n)
2955
2956 @end example
2957
2958 @example
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)
2963
2964 @end example
2965
2966 Since integers are promoted to strings when operated on by the string
2967 concatenation operator, the following method also works:
2968
2969 @example
2970       N = 4
2971       plot 'data.'.N title "Title for plot #".N
2972
2973 @end example
2974
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:
2979
2980 @example
2981       plot = "my_datafile.dat"
2982       title = "My Title"
2983       plot plot title title
2984
2985 @end example
2986
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.
2990
2991 @example
2992      if ("A"."B" eq "AB") print "TRUE"
2993
2994 @end example
2995
2996 See also the two string formatting functions @ref{gprintf} and @ref{sprintf}.
2997
2998 @cindex substring
2999
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.
3007
3008 @node Substitution_and_Command_line_macros, Syntax, String_constants_and_string_variables, gnuplot
3009 @section Substitution and Command line macros
3010
3011 @cindex substitution
3012
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).
3017
3018 @menu
3019 * Substitution_of_system_commands_in_backquotes::  
3020 * Substitution_of_string_variables_as_macros::  
3021 * String_variables::            
3022 @end menu
3023
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
3026
3027 @c ?substitution backquotes
3028 @cindex backquotes
3029
3030 @c ?system commands
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}.
3035
3036 Command-line substitution can be used anywhere on the `gnuplot` command
3037 line, except inside strings delimited by single quotes.
3038
3039 Example:
3040
3041 This will run the program `leastsq` and replace `leastsq` (including
3042 backquotes) on the command line with its output:
3043 @example
3044       f(x) = `leastsq`
3045
3046 @end example
3047
3048 or, in VMS
3049 @example
3050       f(x) = `run leastsq`
3051
3052 @end example
3053
3054 These will generate labels with the current time and userid:
3055 @example
3056       set label "generated on `date +%Y-%m-%d` by `whoami`" at 1,1
3057       set timestamp "generated on %Y-%m-%d by `whoami`"
3058
3059 @end example
3060
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
3063
3064 @c ?substitution macros
3065 @cindex macros
3066 @opindex macros
3067
3068
3069 @cindex exists
3070 @findex exists
3071
3072
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.
3080 For example:
3081
3082 @example
3083       set macros
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
3089
3090 @end example
3091
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
3094
3095 @example
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
3098
3099 @end example
3100
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:
3104
3105 @example
3106       C = "pi"
3107       if (exists(C)) print C," = ", @@C
3108
3109 @end example
3110
3111 Macro expansion does not occur inside either single or double quotes.
3112 However macro expansion does occur inside backquotes.
3113
3114 @node String_variables,  , Substitution_of_string_variables_as_macros, Substitution_and_Command_line_macros
3115 @subsection String variables, macros, and command line substitution
3116
3117 @cindex mixing_macros_backquotes
3118
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
3122
3123 @example
3124       filename = "mydata.inp"
3125       lines = ` wc --lines @@filename | sed "s/ .*//" `
3126
3127 @end example
3128
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
3131
3132 @example
3133       mycomputer = "`uname -n`"
3134
3135 @end example
3136
3137 results in the string returned by the system command `uname -n` being stored
3138 in the string variable mycomputer.
3139
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.
3143
3144 @example
3145        machine_id = "uname -n"
3146        mycomputer = "`@@machine_id`"  # doesn't work!!
3147
3148 @end example
3149
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.
3155
3156 @example
3157       machine_id = sprintf('"`uname -n`"')
3158       mycomputer = @@machine_id
3159
3160 @end example
3161
3162 @node Syntax, Time/Date_data, Substitution_and_Command_line_macros, gnuplot
3163 @section Syntax
3164
3165 @cindex syntax
3166
3167 @cindex specify
3168
3169 @cindex punctuation
3170
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.
3175
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.
3181
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`
3192 commands.
3193
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.
3197
3198 (Parentheses and commas are also used as usual in function notation.)
3199
3200 Square brackets are used to delimit ranges given in `set`, `plot`
3201 or `splot` commands.
3202
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.
3206
3207 Semicolons are used to separate commands given on a single command line.
3208
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.
3211
3212 At present you should not embed \n inside @{@} when using the PostScript
3213 terminal in `enhanced text` mode.
3214
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.
3217
3218 @menu
3219 * Quote_Marks::                 
3220 @end menu
3221
3222 @node Quote_Marks,  , Syntax, Syntax
3223 @subsection Quote Marks
3224
3225 @cindex quotes
3226
3227 @c ?syntax quotes
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).
3230
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.
3234
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.
3238
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.
3244
3245 Text justification is the same for each line of a multi-line string.
3246 Thus the center-justified string
3247 @example
3248       "This is the first line of text.\nThis is the second line."
3249 @end example
3250
3251 will produce
3252 @example
3253                        This is the first line of text.
3254                           This is the second line.
3255 @end example
3256
3257 but
3258 @example
3259       'This is the first line of text.\nThis is the second line.'
3260 @end example
3261
3262 will produce
3263 @example
3264           This is the first line of text.\nThis is the second line.
3265
3266 @end example
3267
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`.
3271
3272 Back-quotes are used to enclose system commands for substitution into the
3273 command line.  See `substitution`.
3274
3275 @node Time/Date_data,  , Syntax, gnuplot
3276 @section Time/Date data
3277
3278 @c ^ <a name="Time/Date data"></a>
3279 @c ^ <a name="Time/date"></a>
3280 @cindex time/date
3281
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`,
3284 etc.
3285
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.
3293
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.
3300
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
3305 numerical form.
3306
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.
3309
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.
3315
3316 The following example demonstrates time/date plotting.
3317
3318 Suppose the file "data" contains records like
3319
3320 @example
3321       03/21/95 10:00  6.02e23
3322
3323 @end example
3324
3325 This file can be plotted by
3326
3327 @example
3328       set xdata time
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
3334
3335 @end example
3336
3337 which will produce xtic labels that look like "03/21".
3338
3339 See the descriptions of each command for more details.
3340
3341 @node Commands, Terminal_types, gnuplot, Top
3342 @chapter Commands
3343
3344 @cindex commands
3345
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.
3350
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
3353 lines`".
3354
3355 In the syntax descriptions, braces (@{@}) denote optional arguments and a
3356 vertical bar (|) separates mutually exclusive choices.
3357
3358 @menu
3359 * cd::                          
3360 * call::                        
3361 * clear::                       
3362 * exit::                        
3363 * fit::                         
3364 * help::                        
3365 * history::                     
3366 * if::                          
3367 * load::                        
3368 * lower::                       
3369 * pause::                       
3370 * plot::                        
3371 * print::                       
3372 * pwd::                         
3373 * quit::                        
3374 * raise::                       
3375 * replot::                      
3376 * reread::                      
3377 * reset::                       
3378 * save::                        
3379 * set-show::                    
3380 * shell::                       
3381 * splot::                       
3382 * system_::                     
3383 * test::                        
3384 * undefine::                    
3385 * unset::                       
3386 * update::                      
3387 @end menu
3388
3389 @node cd, call, Commands, Commands
3390 @section cd
3391
3392 @c ?commands cd
3393 @cindex cd
3394 @cmindex cd
3395
3396
3397 The @ref{cd} command changes the working directory.
3398
3399 Syntax:
3400 @example
3401       cd '<directory-name>'
3402
3403 @end example
3404
3405 The directory name must be enclosed in quotes.
3406
3407 Examples:
3408 @example
3409       cd 'subdir'
3410       cd ".."
3411
3412 @end example
3413
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,
3417 @example
3418       cd "c:\newdata"
3419 @end example
3420
3421 fails, but
3422 @example
3423       cd 'c:\newdata'
3424       cd "c:\\newdata"
3425 @end example
3426
3427 works as expected.
3428
3429 @node call, clear, cd, Commands
3430 @section call
3431
3432 @c ?commands call
3433 @cindex call
3434 @cmindex call
3435
3436
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.
3450
3451 The @ref{call} command _must_ be the last command on a multi-command line.
3452
3453 Syntax:
3454 @example
3455       call "<input-file>" <parameter-0> <parm-1> ... <parm-9>
3456
3457 @end example
3458
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).
3462
3463 Example:
3464
3465 If the file 'calltest.gp' contains the line:
3466 @example
3467       print "argc=$# p0=$0 p1=$1 p2=$2 p3=$3 p4=$4 p5=$5 p6=$6 p7=x$7x"
3468
3469 @end example
3470
3471 entering the command:
3472 @example
3473       call 'calltest.gp' "abcd" 1.2 + "'quoted'" -- "$2"
3474
3475 @end example
3476
3477 will display:
3478 @example
3479       argc=7 p0=abcd p1=1.2 p2=+ p3='quoted' p4=- p5=- p6=$2 p7=xx
3480
3481 @end example
3482
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.
3486
3487 @node clear, exit, call, Commands
3488 @section clear
3489
3490 @c ?commands clear
3491 @cindex clear
3492 @cmindex clear
3493
3494
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.
3498
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.
3501
3502 Example:
3503 @example
3504       set multiplot
3505       plot sin(x)
3506       set origin 0.5,0.5
3507       set size 0.4,0.4
3508       clear
3509       plot cos(x)
3510       unset multiplot
3511
3512 @end example
3513
3514 Please see @ref{multiplot}, @ref{size}, and @ref{origin} for details of these
3515 commands.
3516
3517 @node exit, fit, clear, Commands
3518 @section exit
3519
3520 @c ?commands exit
3521 @cindex exit
3522 @cmindex exit
3523
3524
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).
3528
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.
3532
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:
3536
3537 @example
3538       bind "ctrl-x" "unset output; exit gnuplot"
3539
3540 @end example
3541
3542 See help for `batch/interactive` for more details.
3543
3544 @node fit, help, exit, Commands
3545 @section fit
3546
3547 @c ?commands fit
3548 @cindex fit
3549 @cmindex fit
3550
3551
3552 @cindex least-squares
3553
3554 @cindex Marquardt
3555
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.
3561
3562 Syntax:
3563 @example
3564       fit @{[xrange] @{[yrange]@}@} <function> '<datafile>'
3565           @{datafile-modifiers@}
3566           via '<parameter file>' | <var1>@{,<var2>,...@}
3567
3568 @end example
3569
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
3572 @example
3573       [@{dummy_variable=@}@{<min>@}@{:<max>@}],
3574 @end example
3575
3576 analogous to `plot`; see @ref{ranges}.
3577
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).
3580
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}.
3584
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.
3594
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)`.
3601
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}.
3605
3606 The `via` qualifier specifies which parameters are to be adjusted, either
3607 directly, or by referencing a parameter file.
3608
3609 Examples:
3610 @example
3611       f(x) = a*x**2 + b*x + c
3612       g(x,y) = a*x**2 + b*y**2 + c*x*y
3613       FIT_LIMIT = 1e-6
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
3618
3619 @end example
3620
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.
3627
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.
3632
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
3640 of the fit.
3641
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}
3644 for details.
3645
3646 @menu
3647 * adjustable_parameters::       
3648 * short_introduction::          
3649 * error_estimates::             
3650 * control::                     
3651 * multi-branch::                
3652 * starting_values::             
3653 * tips::                        
3654 @end menu
3655
3656 @node adjustable_parameters, short_introduction, fit, fit
3657 @subsection adjustable parameters
3658
3659 @c ?commands fit parameters
3660 @c ?fit parameters
3661 @c ?commands fit adjustable_parameters
3662 @c ?fit adjustable_parameters
3663 @cindex fit_parameters
3664
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.
3668
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.
3674
3675 In a parameter file, each parameter to be varied and a corresponding initial
3676 value are specified, one per line, in the form
3677 @example
3678       varname = value
3679
3680 @end example
3681
3682 Comments, marked by '#', and blank lines are permissible.  The
3683 special form
3684 @example
3685       varname = value       # FIXED
3686
3687 @end example
3688
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.
3693
3694
3695 @node short_introduction, error_estimates, adjustable_parameters, fit
3696 @subsection short introduction
3697
3698 @c ?commands fit beginners_guide
3699 @c ?fit beginners_guide
3700 @c ?fit guide
3701 @cindex fitting
3702
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.
3711
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).
3723
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
3730 @example
3731      z=a*sin(c*x) + b*cos(c*x).
3732 @end example
3733
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.
3737
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
3751 reason.
3752
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`.
3758
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.
3764
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
3767 than @ref{fit}.
3768
3769 @node error_estimates, control, short_introduction, fit
3770 @subsection error estimates
3771
3772 @c ?commands fit error_estimates
3773 @c ?fit error_estimates
3774 @c ?fit errors
3775 In @ref{fit}, the term "error" is used in two different contexts, data error
3776 estimates and parameter error estimates.
3777
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.
3785
3786 The 'statistical overview' describes some of the @ref{fit} output and gives some
3787 background for the 'practical guidelines'.
3788
3789 @menu
3790 * statistical_overview::        
3791 * practical_guidelines::        
3792 @end menu
3793
3794 @node statistical_overview, practical_guidelines, error_estimates, error_estimates
3795 @subsubsection statistical overview
3796
3797 @c ?commands fit error statistical_overview
3798 @c ?fit error statistical_overview
3799 @cindex statistical_overview
3800
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
3814 deviations.
3815
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
3819 of deviations.
3820
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
3828 @example
3829       FIT_NDF = Number of degrees of freedom
3830       FIT_WSSR = Weighted sum-of-squares residual
3831       FIT_STDFIT = sqrt(WSSR/NDF)
3832
3833 @end example
3834
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.
3840
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.
3851
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.
3862
3863 @node practical_guidelines,  , statistical_overview, error_estimates
3864 @subsubsection practical guidelines
3865
3866 @c ?commands fit error practical_guidelines
3867 @c ?fit error practical_guidelines
3868 @cindex practical_guidelines
3869
3870 @cindex guidelines
3871
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.
3876
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.
3881
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.
3891
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.
3894
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.
3900
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
3906 another model.
3907
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.
3914
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
3918 matrix.
3919
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.
3925
3926 @node control, multi-branch, error_estimates, fit
3927 @subsection control
3928
3929 @c ?commands fit control
3930 @c ?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'.
3935
3936 @menu
3937 * control_variables::           
3938 * environment_variables::       
3939 @end menu
3940
3941 @node control_variables, environment_variables, control, control
3942 @subsubsection control variables
3943
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
3947 @example
3948       FIT_LIMIT
3949 @end example
3950
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
3953 'converged'.
3954
3955 The maximum number of iterations may be limited by declaring a value for
3956 @example
3957       FIT_MAXITER
3958 @end example
3959
3960 A value of 0 (or not defining it at all)  means that there is no limit.
3961
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
3966 your own one with
3967 @example
3968       FIT_START_LAMBDA
3969 @end example
3970
3971 Specifying FIT_START_LAMBDA as zero or less will re-enable the automatic
3972 selection. The variable
3973 @example
3974       FIT_LAMBDA_FACTOR
3975 @end example
3976
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
3980 10.0.
3981
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.
3984
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}.
3992
3993 @node environment_variables,  , control_variables, control
3994 @subsubsection environment variables
3995
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.
4000
4001 @example
4002       FIT_LOG
4003 @end example
4004
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`.
4008
4009 @example
4010       FIT_SCRIPT
4011 @end example
4012
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.
4016
4017 @node multi-branch, starting_values, control, fit
4018 @subsection multi-branch
4019
4020 @c ?commands fit multi-branch
4021 @c ?fit multi-branch
4022 @cindex multi-branch
4023
4024 @cindex branch
4025
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
4031 variable.
4032
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
4036 @example
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
4039
4040 @end example
4041
4042 For a more complicated example, see the file "hexa.fnc" used by the
4043 "fit.dem" demo.
4044
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.
4050
4051 @node starting_values, tips, multi-branch, fit
4052 @subsection starting values
4053
4054 @c ?commands fit starting_values
4055 @c ?fit starting_values
4056 @cindex starting_values
4057
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.
4062
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.
4068
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.
4077
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.
4083
4084 @node tips,  , starting_values, fit
4085 @subsection tips
4086
4087 @c ?commands fit tips
4088 @c ?fit tips
4089 @cindex tips
4090
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
4093 has sunk in.
4094
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
4099 file.
4100
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.
4108
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).
4112
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.
4120
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.
4125
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,
4135 you are correct.
4136
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.
4141
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!"
4144
4145 @node help, history, fit, Commands
4146 @section help
4147
4148 @c ?commands help
4149 @cindex help
4150 @cmindex help
4151
4152
4153 The @ref{help} command displays on-line help. To specify information on a
4154 particular topic use the syntax:
4155
4156 @example
4157       help @{<topic>@}
4158
4159 @end example
4160
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.
4167
4168 If a question mark (?) is given as the topic, the list of topics currently
4169 available is printed on the screen.
4170
4171 @node history, if, help, Commands
4172 @section history
4173
4174 @c ?commands history
4175 @cindex history
4176 @cmindex history
4177
4178
4179 `history` command lists or saves previous entries in the history of the
4180 command line editing, or executes an entry.
4181
4182 Here you find 'usage by examples':
4183
4184 @example
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 :-))
4197
4198 @end example
4199
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.
4203
4204 @node if, load, history, Commands
4205 @section if
4206
4207 @c ?commands if
4208 @cindex if
4209 @cmindex if
4210
4211
4212 The @ref{if} command allows commands to be executed conditionally.
4213
4214 Syntax:
4215 @example
4216       if (<condition>) <command-line> [; else if (<condition>) ...; else ...]
4217
4218 @end example
4219
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.
4225
4226 Examples:
4227 @example
4228       pi=3
4229       if (pi!=acos(-1)) print "?Fixing pi!"; pi=acos(-1); print pi
4230 @end example
4231
4232 will display:
4233 @example
4234       ?Fixing pi!
4235       3.14159265358979
4236 @end example
4237
4238 but
4239 @example
4240       if (1==2) print "Never see this"; print "Or this either"
4241 @end example
4242
4243 will not display anything.
4244
4245 else:
4246 @example
4247       v=0
4248       v=v+1; if (v%2) print "2" ; else if (v%3) print "3"; else print "fred"
4249 @end example
4250
4251 (repeat the last line repeatedly!)
4252
4253 See @ref{reread} for an example of how @ref{if} and @ref{reread} can be used together to
4254 perform a loop.
4255
4256 @node load, lower, if, Commands
4257 @section load
4258
4259 @c ?commands load
4260 @cindex load
4261 @cmindex load
4262
4263
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}.
4270
4271 The `load` command _must_ be the last command on a multi-command line.
4272
4273 Syntax:
4274 @example
4275       load "<input-file>"
4276
4277 @end example
4278
4279 The name of the input file must be enclosed in quotes.
4280
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.
4284
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 '<'.
4287
4288 Examples:
4289 @example
4290       load 'work.gnu'
4291       load "func.dat"
4292       load "< loadfile_generator.sh"
4293
4294 @end example
4295
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.
4299
4300 @node lower, pause, load, Commands
4301 @section lower
4302
4303 @c ?commands lower
4304 @cindex lower
4305 @cmindex lower
4306
4307
4308 Syntax:
4309 @example
4310       lower @{plot_window_nb@}
4311
4312 @end example
4313
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.
4318
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.
4323
4324 The optional parameter is ignored for single plot-window terminals, i.e. `pm`
4325 and `win`.
4326
4327 @node pause, plot, lower, Commands
4328 @section pause
4329
4330 @c ?commands pause
4331 @cindex pause
4332 @cmindex pause
4333
4334
4335 @c ?pause mouse
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.
4339
4340 Syntax:
4341 @example
4342       pause <time> @{"<string>"@}
4343       pause mouse @{<endcondition>@}@{, <endcondition>@} @{"<string>"@}
4344
4345 @end example
4346
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}.
4352
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`.
4356
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 
4364 conditions. 
4365
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}.
4368
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).
4372
4373 Examples:
4374 @example
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"
4383
4384 @end example
4385
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:
4389
4390 @example
4391       printf "I will resume after you hit the Tab key in the plot window"
4392       load "wait_for_tab"
4393
4394 @end example
4395
4396 File "wait_for_tab" contains the lines
4397
4398 @example
4399       pause mouse key
4400       if (MOUSE_KEY != 9) reread
4401
4402 @end example
4403
4404
4405 @node plot, print, pause, Commands
4406 @section plot
4407
4408 @c ?commands plot
4409 @cindex plot
4410 @cmindex plot
4411
4412
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`.
4420
4421 Syntax:
4422 @example
4423       plot @{<ranges>@}
4424            @{<function> | @{"<datafile>" @{datafile-modifiers@}@}@}
4425            @{axes <axes>@} @{<title-spec>@} @{with <style>@}
4426            @{, @{definitions,@} <function> ...@}
4427
4428 @end example
4429
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`).
4434
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.
4437
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
4443 axes (bottom left).
4444
4445 Examples:
4446 @example
4447       plot sin(x)
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
4452
4453 @end example
4454
4455 See also `show plot`.
4456
4457 @menu
4458 * data::                        
4459 * errorbars::                   
4460 * errorlines::                  
4461 * parametric::                  
4462 * ranges::                      
4463 * title::                       
4464 * with::                        
4465 @end menu
4466
4467 @node data, errorbars, plot, plot
4468 @subsection data
4469
4470 @c ?commands plot datafile
4471 @c ?plot datafile
4472 @cindex data-file
4473
4474 @cindex datafile
4475 @opindex datafile
4476
4477
4478 @cindex data
4479
4480 @cindex file
4481
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.
4484
4485 Syntax:
4486 @example
4487       plot '<file_name>' @{binary <binary list>@}
4488                          @{matrix@}
4489                          @{index <index list>@}
4490                          @{every <every list>@}
4491                          @{thru <thru expression>@}
4492                          @{using <using list>@}
4493                          @{smooth <option>@}
4494
4495 @end example
4496
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.)
4505
4506
4507 ASCII DATA FILES:
4508
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).
4516
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:
4522 @example
4523       1.0 "second column" 3.0
4524
4525 @end example
4526
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.
4530
4531 Only one column (the y value) need be provided.  If x is omitted, `gnuplot`
4532 provides integer values starting at 0.
4533
4534 In datafiles, blank records (records with no characters other than blanks and
4535 a newline and/or carriage return) are significant.
4536
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).
4539
4540 Two blank records in a row indicate a break between separate data sets.
4541 See @ref{index}.
4542
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
4551 the problem:
4552
4553 @example
4554       reset; plot '-', '-' axes x2y1
4555       1 1
4556       19 19
4557       e
4558       1 1
4559       19 19
4560       e
4561
4562 @end example
4563
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.
4567
4568
4569 BINARY DATA FILES:
4570
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.
4576
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.
4582
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.
4593
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.
4599
4600 Matrix binary is the default binary format when no keywords specific to
4601 general binary are given, i.e., `array`, `record`, `format`, `filetype`.
4602
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.
4608
4609 See `datafile binary` for more details.
4610
4611 @menu
4612 * binary::                      
4613 * binary_general::              
4614 * every::                       
4615 * example_datafile::            
4616 * index::                       
4617 * smooth::                      
4618 * special-filenames::           
4619 * thru::                        
4620 * using::                       
4621 @end menu
4622
4623 @node binary, binary_general, data, data
4624 @subsubsection binary
4625
4626 @c ?commands plot datafile binary
4627 @c ?plot datafile binary
4628 @c ?splot datafile binary
4629 @c ?plot binary
4630 @c ?splot binary
4631 @c ?data-file binary
4632 @c ?datafile binary
4633 @cindex binary
4634
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.
4640
4641 See `binary matrix` or `binary general` for more details.
4642
4643 @node binary_general, every, binary, data
4644 @subsubsection binary general
4645
4646 @c ?commands plot datafile binary general
4647 @c ?commands splot datafile binary general
4648 @c ?plot binary general
4649 @c ?splot binary general
4650 @c ?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.
4656
4657 Syntax:
4658 @example
4659       plot '<file_name>' @{binary <binary list>@} ...
4660       splot '<file_name>' @{binary <binary list>@} ...
4661
4662 @end example
4663
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`
4667 for more details.)
4668
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
4673 below.
4674
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.
4682
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.
4692
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.
4706
4707
4708 @noindent --- ARRAY ---
4709
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
4721 individual records.
4722
4723 Currently, syntax allows for up to three-dimensional arrays.  However, no
4724 conventions have yet been made for handling three-dimensional coordinates.
4725
4726
4727 @noindent --- RECORD ---
4728
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.
4734
4735
4736 @noindent --- FORMAT ---
4737
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.
4745
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.
4753
4754
4755 @noindent --- ENDIAN ---
4756
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
4762 are
4763
4764 @example
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.)
4770
4771 @end example
4772
4773 Gnuplot can support "middle" ("pdp") endian if it is compiled with that option.
4774
4775
4776 @noindent --- FILETYPE ---
4777
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`.
4783
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.
4786
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`
4789 for details.)
4790
4791
4792 @noindent --- AVS ---
4793
4794 @c ?binary general filetype avs
4795 @c ?filetype avs
4796 @cindex avs
4797
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.
4802
4803
4804 @noindent --- EDF ---
4805
4806 @c ?binary general filetype edf
4807 @c ?filetype edf
4808 @cindex edf
4809
4810 @c ?filetype ehf
4811 @cindex ehf
4812
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
4816 can be found at
4817
4818 @example
4819   http://www.esrf.fr/computing/expg/subgroups/general/format/Format.html
4820
4821 @end example
4822
4823 See also `binary`.
4824
4825
4826 @noindent --- KEYWORDS ---
4827
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.
4832
4833
4834 @noindent --- SCAN ---
4835
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
4847 x dimension.
4848
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.
4851
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.
4856
4857
4858 @noindent --- TRANSPOSE ---
4859
4860 @c ?binary general keywords transpose
4861 Shorthand notation for `scan=yx` or `scan=yxz`.
4862
4863
4864 @noindent --- DX, DY, DZ ---
4865
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.
4875
4876 The following keywords also apply only when generating coordinates.  However
4877 they may also be used with matrix binary files.
4878
4879
4880 @noindent --- FLIPX, FLIPY, FLIPZ ---
4881
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
4885 dimensions x, y, z.
4886
4887
4888 @noindent --- ORIGIN  ---
4889
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
4894 and flip.
4895
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.
4902
4903
4904 @noindent --- CENTER ---
4905
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`.
4910
4911
4912 @noindent --- ROTATE ---
4913
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.
4918
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
4921 Cartesian plane.
4922
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.
4925
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
4928 `center`.
4929
4930
4931 @noindent --- PERPENDICULAR ---
4932
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.
4938
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.)
4948
4949
4950 @noindent --- BINARY EXAMPLES ---
4951
4952 @cindex binary_examples
4953
4954 @c ?binary examples
4955 @c ?binary general examples
4956 Examples:
4957
4958 @example
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
4962
4963 @end example
4964
4965 @example
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
4970
4971 @end example
4972
4973 @example
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
4981
4982 @end example
4983
4984 @example
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
4989
4990 @end example
4991
4992 See also `binary matrix`.
4993
4994 @node every, example_datafile, binary_general, data
4995 @subsubsection every
4996
4997 @c ?commands plot datafile every
4998 @c ?plot datafile every
4999 @c ?plot every
5000 @c ?data-file every
5001 @c ?datafile every
5002 @cindex every
5003
5004 The @ref{every} keyword allows a periodic sampling of a data set to be plotted.
5005
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`).
5008
5009 Syntax:
5010 @example
5011       plot 'file' every @{<point_incr>@}
5012                           @{:@{<block_incr>@}
5013                             @{:@{<start_point>@}
5014                               @{:@{<start_block>@}
5015                                 @{:@{<end_point>@}
5016                                   @{:<end_block>@}@}@}@}@}
5017
5018 @end example
5019
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`>.
5024
5025 The first datum in each block is numbered '0', as is the first block in the
5026 file.
5027
5028 Note that records containing unplottable information are counted.
5029
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.
5033
5034 Examples:
5035 @example
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
5040
5041 @end example
5042
5043 See
5044 @uref{http://www.gnuplot.info/demo/simple.html,simple plot demos (simple.dem)
5045 }
5046 ,
5047 @uref{http://www.gnuplot.info/demo/surface1.html,Non-parametric splot demos
5048 }
5049 , and
5050 @uref{http://gnuplot.sourceforge.net/demo/surface2.html,Parametric splot demos
5051 }
5052 .
5053
5054 @node example_datafile, index, every, data
5055 @subsubsection example datafile
5056
5057 @c ?commands plot datafile example
5058 @c ?plot datafile example
5059 @c ?plot example
5060 @c ?datafile example
5061 @c ?data-file example
5062 @cindex example
5063
5064 This example plots the data in the file "population.dat" and a theoretical
5065 curve:
5066
5067 @example
5068       pop(x) = 103*exp((1965-x)/10)
5069       plot [1960:1990] 'population.dat', pop(x)
5070
5071 @end example
5072
5073 The file "population.dat" might contain:
5074
5075 @example
5076       # Gnu population in Antarctica since 1965
5077          1965   103
5078          1970   55
5079          1975   34
5080          1980   24
5081          1985   10
5082
5083 @end example
5084
5085 @c ^ <img align=bottom src="http://www.gnuplot.info/doc/population.gif" alt="[population.gif]" width=640 height=480>
5086
5087 @node index, smooth, example_datafile, data
5088 @subsubsection index
5089
5090 @c ?commands plot datafile index
5091 @c ?plot datafile index
5092 @c ?plot index
5093 @c ?data-file index
5094 @c ?datafile index
5095 @cindex index
5096
5097 The @ref{index} keyword allows you to select specific data sets in a multi-data-set
5098 file for plotting.
5099
5100 Syntax:
5101 @example
5102       plot 'file' index <m>@{@{:<n>@}:<p>@}
5103
5104 @end example
5105
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.
5112
5113 Example:
5114 @example
5115       plot 'file' index 4:5
5116
5117 @end example
5118
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`.
5125
5126 Example:
5127 @example
5128       plot 'file' using 1:(column(-2)==4 ? $2 : NaN)        # very awkward
5129       plot 'file' using 1:2:(column(-2)) linecolor variable # very useful!
5130
5131 @end example
5132
5133 @c ^ See also web page
5134 @uref{http://www.gnuplot.info/demo/multimsh.html, splot with indices demo.
5135 }
5136
5137 @node smooth, special-filenames, index, data
5138 @subsubsection smooth
5139
5140 @c ?commands plot datafile smooth
5141 @c ?plot datafile smooth
5142 @c ?plot smooth
5143 @c ?data-file smooth
5144 @c ?datafile smooth
5145 @cindex smooth
5146
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.
5151
5152 Syntax:
5153 @example
5154       smooth @{unique | frequency | csplines | acsplines | bezier | sbezier@}
5155
5156 @end example
5157
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).
5164
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.
5167
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}.
5172
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.
5176
5177 The @ref{smooth} options have no effect on function plots.
5178
5179
5180 @noindent --- ACSPLINES ---
5181
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
5187 @c ?plot acsplines
5188 @c ?smooth acsplines
5189 @cindex acsplines
5190
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.,
5197 @example
5198       plot 'data-file' using 1:2:(1.0) smooth acsplines
5199
5200 @end example
5201
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
5211 weights.
5212
5213 Example:
5214 @example
5215       sw(x,S)=1/(x*x*S)
5216       plot 'data_file' using 1:2:(sw($3,100)) smooth acsplines
5217
5218 @end example
5219
5220
5221 @noindent --- BEZIER ---
5222
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
5228 @c ?plot bezier
5229 @c ?smooth bezier
5230 @cindex bezier
5231
5232 The `bezier` option approximates the data with a Bezier curve of degree n
5233 (the number of data points) that connects the endpoints.
5234
5235
5236 @noindent --- CSPLINES ---
5237
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
5243 @c ?plot csplines
5244 @c ?smooth csplines
5245 @cindex csplines
5246
5247 The `csplines` option connects consecutive points by natural cubic splines
5248 after rendering the data monotonic (see `smooth unique`).
5249
5250
5251 @noindent --- SBEZIER ---
5252
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
5258 @c ?plot sbezier
5259 @c ?smooth sbezier
5260 @cindex sbezier
5261
5262 The `sbezier` option first renders the data monotonic (`unique`) and then
5263 applies the `bezier` algorithm.
5264
5265
5266 @noindent --- UNIQUE ---
5267
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
5273 @c ?plot unique
5274 @c ?smooth unique
5275 @cindex unique
5276
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.
5280 @c ^ See this
5281 @uref{http://www.gnuplot.info/demo/mgr.html,demos
5282 }
5283 @c ^ web page.
5284
5285
5286 @noindent --- FREQUENCY ---
5287
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
5293 @c ?plot frequency
5294 @c ?smooth frequency
5295 @cindex frequency
5296
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.
5300
5301 @node special-filenames, thru, smooth, data
5302 @subsubsection special-filenames
5303
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
5309
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!
5318
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
5324
5325 @example
5326       plot '-' index 0, '-' index 1
5327       2
5328       4
5329       6
5330
5331 @end example
5332
5333
5334 @example
5335       10
5336       12
5337       14
5338       e
5339       2
5340       4
5341       6
5342
5343 @end example
5344
5345
5346 @example
5347       10
5348       12
5349       14
5350       e
5351
5352 @end example
5353
5354 does indeed work,
5355
5356 @example
5357       plot '-', '-'
5358       2
5359       4
5360       6
5361       e
5362       10
5363       12
5364       14
5365       e
5366
5367 @end example
5368
5369 is a lot easier to type.
5370
5371 If you use `'-'` with @ref{replot}, you may need to enter the data more than once
5372 (see @ref{replot}).
5373
5374 A blank filename ('') specifies that the previous filename should be reused.
5375 This can be useful with things like
5376
5377 @example
5378       plot 'a/very/long/filename' using 1:2, '' using 1:3, '' using 1:4
5379
5380 @end example
5381
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.)
5384
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
5387 example,
5388
5389 @example
5390       pop(x) = 103*exp(-x/10)
5391       plot "< awk '@{print $1-1965, $2@}' population.dat", pop(x)
5392
5393 @end example
5394
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
5399 the comma):
5400
5401 @example
5402       plot "< awk '$0 !~ /^#/ @{print $1-1965, $2@}' population.dat"
5403
5404 @end example
5405
5406 While this approach is most flexible, it is possible to achieve simple
5407 filtering with the @ref{using} or @ref{thru} keywords.
5408
5409 @node thru, using, special-filenames, data
5410 @subsubsection thru
5411
5412 @c ?commands plot datafile thru
5413 @c ?plot datafile thru
5414 @c ?plot thru
5415 @c ?data-file thru
5416 @c ?datafile thru
5417 @cindex thru
5418
5419 The @ref{thru} function is provided for backward compatibility.
5420
5421 Syntax:
5422 @example
5423       plot 'file' thru f(x)
5424
5425 @end example
5426
5427 It is equivalent to:
5428
5429 @example
5430       plot 'file' using 1:(f($2))
5431
5432 @end example
5433
5434 While the latter appears more complex, it is much more flexible.  The more
5435 natural
5436
5437 @example
5438       plot 'file' thru f(y)
5439
5440 @end example
5441
5442 also works (i.e. you can use y as the dummy variable).
5443
5444 @ref{thru} is parsed for `splot` and @ref{fit} but has no effect.
5445
5446 @node using,  , thru, data
5447 @subsubsection using
5448
5449 @c ?commands plot datafile using
5450 @c ?plot datafile using
5451 @c ?plot using
5452 @c ?data-file using
5453 @c ?datafile using
5454 @cindex using
5455
5456 The most common datafile modifier is @ref{using}.
5457
5458 Syntax:
5459 @example
5460       plot 'file' using @{<entry> @{:<entry> @{:<entry> ...@}@}@} @{'format'@}
5461
5462 @end example
5463
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`.
5468
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.
5471
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.
5477
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
5481 dataset.
5482
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`.
5485
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.
5492
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.
5501
5502 Note that the use of "\t", "\n", or "\f" requires use of double-quotes
5503 rather than single-quotes.
5504
5505
5506 @noindent --- USING_EXAMPLES ---
5507
5508 @cindex examples
5509
5510 @c ?commands plot datafile using examples
5511 @c ?plot datafile using examples
5512 @c ?datafile using examples
5513 @c ?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 ","`.
5517 @example
5518       plot 'file' using 1:($2+$3) '%lf,%lf,%lf'
5519
5520 @end example
5521
5522 In this example the data are read from the file "MyData" using a more
5523 complicated format:
5524 @example
5525       plot 'MyData' using "%*lf%lf%*20[^\n]%lf"
5526
5527 @end example
5528
5529 The meaning of this format is:
5530
5531 @example
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)
5536
5537 @end example
5538
5539 One trick is to use the ternary `?:` operator to filter data:
5540
5541 @example
5542       plot 'file' using 1:($3>10 ? $2 : 1/0)
5543
5544 @end example
5545
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.
5550 @cindex NaN
5551
5552
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.
5558
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.
5564
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.
5573
5574 In fact, it is often possible to plot a file with lots of lines of garbage at
5575 the top simply by specifying
5576
5577 @example
5578       plot 'file' using 1:2
5579
5580 @end example
5581
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.
5586 }
5587
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}.
5591
5592
5593 @noindent --- USING TITLE ---
5594
5595 @c ?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.
5601
5602 @example
5603    plot 'data' using 1:($2/$3) title column(N)
5604
5605 @end example
5606
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.
5610
5611
5612
5613 @noindent --- XTICLABELS ---
5614
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
5620
5621 @example
5622   plot 'datafile' using <xcol>:<ycol>:xticlabels(<labelcol>) with <plotstyle>
5623
5624 @end example
5625
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>)`.
5633
5634 Example:
5635
5636 @example
5637       splot "data" using 2:4:6:xtic(1):ytic(3):ztic(6)
5638
5639 @end example
5640
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.
5644
5645
5646 @noindent --- X2TICLABELS ---
5647
5648 @c ?using x2ticlabels
5649 @c ?plot using x2ticlabels
5650 See `plot using xticlabels`.
5651
5652
5653 @noindent --- YTICLABELS ---
5654
5655 @c ?using yticlabels
5656 @c ?plot using yticlabels
5657 See `plot using xticlabels`.
5658
5659
5660 @noindent --- Y2TICLABELS ---
5661
5662 @c ?using y2ticlabels
5663 @c ?plot using y2ticlabels
5664 See `plot using xticlabels`.
5665
5666
5667 @noindent --- ZTICLABELS ---
5668
5669 @c ?using zticlabels
5670 @c ?plot using zticlabels
5671 See `plot using xticlabels`.
5672
5673 @node errorbars, errorlines, data, plot
5674 @subsection errorbars
5675
5676 @c ?commands plot errorbars
5677 @c ?commands splot errorbars
5678 @c ?plot errorbars
5679 @c ?splot errorbars
5680 @cindex errorbars
5681
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.
5685
5686 In the default situation, `gnuplot` expects to see three, four, or six
5687 numbers on each line of the data file---either
5688
5689 @example
5690       (x, y, ydelta),
5691       (x, y, ylow, yhigh),
5692       (x, y, xdelta),
5693       (x, y, xlow, xhigh),
5694       (x, y, xdelta, ydelta), or
5695       (x, y, xlow, xhigh, ylow, yhigh).
5696
5697 @end example
5698
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,
5702
5703 @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
5707
5708 @end example
5709
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.
5713
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}).
5723
5724 The error bars have crossbars at each end unless @ref{bars} is used
5725 (see @ref{bars} for details).
5726
5727 If autoscaling is on, the ranges will be adjusted to include the error bars.
5728
5729 See also
5730 @uref{http://gnuplot.sourceforge.net/demo/mgr.html,errorbar demos.
5731 }
5732
5733 See @ref{using}, @ref{with}, and @ref{style} for more information.
5734
5735 @node errorlines, parametric, errorbars, plot
5736 @subsection errorlines
5737
5738 @c ?commands plot errorlines
5739 @c ?commands splot errorlines
5740 @c ?plot errorlines
5741 @c ?splot errorlines
5742 @cindex errorlines
5743
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.
5747
5748 In the default situation, `gnuplot` expects to see three, four, or six
5749 numbers on each line of the data file---either
5750
5751 @example
5752       (x, y, ydelta),
5753       (x, y, ylow, yhigh),
5754       (x, y, xdelta),
5755       (x, y, xlow, xhigh),
5756       (x, y, xdelta, ydelta), or
5757       (x, y, xlow, xhigh, ylow, yhigh).
5758
5759 @end example
5760
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,
5764
5765 @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
5769
5770 @end example
5771
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.
5775
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.
5781
5782 The error bars have crossbars at each end unless @ref{bars} is used
5783 (see @ref{bars} for details).
5784
5785 If autoscaling is on, the ranges will be adjusted to include the error bars.
5786
5787 See @ref{using}, @ref{with}, and @ref{style} for more information.
5788
5789 @node parametric, ranges, errorlines, plot
5790 @subsection parametric
5791
5792 @c ?commands plot parametric
5793 @c ?commands splot parametric
5794 @c ?plot 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`.
5798
5799 Examples:
5800 @example
5801       plot sin(t),t**2
5802       splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
5803
5804 @end example
5805
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.
5812
5813 Other modifiers, such as @ref{with} and @ref{title}, may be specified only after the
5814 parametric function has been completed:
5815
5816 @example
5817       plot sin(t),t**2 title 'Parametric example' with linespoints
5818
5819 @end example
5820
5821 See also
5822 @uref{http://www.gnuplot.info/demo/param.html,Parametric Mode Demos.
5823 }
5824
5825 @node ranges, title, parametric, plot
5826 @subsection ranges
5827
5828 @c ?commands plot ranges
5829 @c ?commands splot ranges
5830 @c ?plot ranges
5831 @c ?splot ranges
5832 @cindex ranges
5833
5834 The optional ranges specify the region of the graph that will be displayed.
5835
5836 Syntax:
5837 @example
5838       [@{<dummy-var>=@}@{@{<min>@}:@{<max>@}@}]
5839       [@{@{<min>@}:@{<max>@}@}]
5840
5841 @end example
5842
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 *.
5847
5848 In non-parametric mode, the order in which ranges must be given is @ref{xrange}
5849 and @ref{yrange}.
5850
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:
5855
5856 @example
5857       plot [-pi:pi] [-1.3:1.3] [-1:1] sin(t),t**2
5858
5859 @end example
5860
5861 Note that the x2range and y2range cannot be specified here---@ref{x2range}
5862 and @ref{y2range} must be used.
5863
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.
5867
5868 `*` can be used to allow autoscaling of either of min and max.  See also
5869 @ref{autoscale}.
5870
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.
5874
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}.
5878
5879 Examples:
5880
5881 This uses the current ranges:
5882 @example
5883       plot cos(x)
5884
5885 @end example
5886
5887 This sets the x range only:
5888 @example
5889       plot [-10:30] sin(pi*x)/(pi*x)
5890
5891 @end example
5892
5893 This is the same, but uses t as the dummy-variable:
5894 @example
5895       plot [t = -10 :30]  sin(pi*t)/(pi*t)
5896
5897 @end example
5898
5899 This sets both the x and y ranges:
5900 @example
5901       plot [-pi:pi] [-3:3]  tan(x), 1/x
5902
5903 @end example
5904
5905 This sets only the y range, and turns off autoscaling on both axes:
5906 @example
5907       plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)
5908
5909 @end example
5910
5911 This sets xmax and ymin only:
5912 @example
5913       plot [:200] [-pi:]  exp(sin(x))
5914
5915 @end example
5916
5917 This sets the x range for a timeseries:
5918 @example
5919       set timefmt "%d/%m/%y %H:%M"
5920       plot ["1/6/93 12:00":"5/6/93 12:00"] 'timedata.dat'
5921
5922 @end example
5923
5924
5925 @node title, with, ranges, plot
5926 @subsection title
5927
5928 @c ?commands plot title
5929 @c ?commands splot title
5930 @c ?plot title
5931 @c ?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.
5935
5936 Syntax:
5937 @example
5938       title "<title>" | notitle ["<ignored title>"]
5939
5940 @end example
5941
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.
5948
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.
5953
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.
5958
5959 The layout of the key itself (position, title justification, etc.) can be
5960 controlled by @ref{key}.  Please see @ref{key} for details.
5961
5962 Examples:
5963
5964 This plots y=x with the title 'x':
5965 @example
5966       plot x
5967
5968 @end example
5969
5970 This plots x squared with title "x^2" and file "data.1" with title
5971 "measured data":
5972 @example
5973       plot x**2 title "x^2", 'data.1' t "measured data"
5974
5975 @end example
5976
5977 This puts an untitled circular border around a polar graph:
5978 @example
5979       set polar; plot my_function(t), 1 notitle
5980
5981 @end example
5982
5983 @node with,  , title, plot
5984 @subsection with
5985
5986 @c ?commands plot with
5987 @c ?commands splot with
5988 @c ?commands plot style
5989 @c ?commands splot style
5990 @c ?plot with
5991 @c ?plot style
5992 @c ?splot with
5993 @c ?splot style
5994 @cindex style
5995 @opindex style
5996
5997
5998 @cindex with
5999
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.
6002
6003 Syntax:
6004 @example
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@}
6013                         @{palette@}@}
6014                    @}
6015
6016 @end example
6017
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.
6029
6030 Default styles are chosen with the `set style function` and `set style data`
6031 commands.
6032
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.
6040
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.
6045
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,
6053 not six.
6054
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.
6060
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.
6064
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`.
6075
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.
6082
6083 Similarly, the keyword `nocontours` will turn off contouring for an individual
6084 plot even if the global property "set contour" is active.
6085
6086 The keywords may be abbreviated as indicated.
6087
6088 Note that the `linewidth`, @ref{pointsize} and @ref{palette} options are not supported
6089 by all terminals.
6090
6091 Examples:
6092
6093 This plots sin(x) with impulses:
6094 @example
6095       plot sin(x) with impulses
6096
6097 @end example
6098
6099 This plots x with points, x**2 with the default:
6100 @example
6101       plot x w points, x**2
6102
6103 @end example
6104
6105 This plots tan(x) with the default function style, file "data.1" with lines:
6106 @example
6107       plot [ ] [-2:5] tan(x), 'data.1' with l
6108
6109 @end example
6110
6111 This plots "leastsq.dat" with impulses:
6112 @example
6113       plot 'leastsq.dat' w i
6114
6115 @end example
6116
6117 This plots the data file "population" with boxes:
6118 @example
6119       plot 'population' with boxes
6120
6121 @end example
6122
6123 This plots "exper.dat" with errorbars and lines connecting the points
6124 (errorbars require three or four columns):
6125 @example
6126       plot 'exper.dat' w lines, 'exper.dat' notitle w errorbars
6127
6128 @end example
6129
6130 Another way to plot "exper.dat" with errorlines (errorbars require three
6131 or four columns):
6132 @example
6133       plot 'exper.dat' w errorlines
6134
6135 @end example
6136
6137 This plots sin(x) and cos(x) with linespoints, using the same line type but
6138 different point types:
6139 @example
6140       plot sin(x) with linesp lt 1 pt 3, cos(x) with linesp lt 1 pt 4
6141
6142 @end example
6143
6144 This plots file "data" with points of type 3 and twice usual size:
6145 @example
6146       plot 'data' with points pointtype 3 pointsize 2
6147
6148 @end example
6149
6150 This plots file "data" with variable pointsize read from column 4
6151 @example
6152       plot 'data' using 1:2:4 with points pt 5 pointsize variable
6153
6154 @end example
6155
6156 This plots two data sets with lines differing only by weight:
6157 @example
6158       plot 'd1' t "good" w l lt 2 lw 3, 'd2' t "bad" w l lt 2 lw 1
6159
6160 @end example
6161
6162 This plots filled curve of x*x and a color stripe:
6163 @example
6164       plot x*x with filledcurve closed, 40 with filledcurve y1=10
6165
6166 @end example
6167
6168 This plots x*x and a color box:
6169 @example
6170       plot x*x, (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y1=10 lt 8
6171
6172 @end example
6173
6174 This plots a surface with color lines:
6175 @example
6176       splot x*x-y*y with line palette
6177
6178 @end example
6179
6180 This plots two color surfaces at different altitudes:
6181 @example
6182       splot x*x-y*y with pm3d, x*x+y*y with pm3d at t
6183
6184 @end example
6185
6186
6187 @node print, pwd, plot, Commands
6188 @section print
6189
6190 @c ?commands print
6191 @cindex print
6192 @cmindex print
6193
6194
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.
6198
6199 Syntax:
6200 @example
6201       print <expression> @{, <expression>, ...@}
6202
6203 @end example
6204
6205 See `expressions`.  The output file can be set with @ref{print}.
6206
6207 @node pwd, quit, print, Commands
6208 @section pwd
6209
6210 @c ?commands pwd
6211 @cindex pwd
6212 @cmindex pwd
6213
6214
6215 The @ref{pwd} command prints the name of the working directory to the screen.
6216
6217 @node quit, raise, pwd, Commands
6218 @section quit
6219
6220 @c ?commands quit
6221 @cindex quit
6222 @cmindex quit
6223
6224
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.
6228
6229 @node raise, replot, quit, Commands
6230 @section raise
6231
6232 @c ?commands raise
6233 @cindex raise
6234 @cmindex raise
6235
6236
6237 Syntax:
6238 @example
6239       raise @{plot_window_nb@}
6240
6241 @end example
6242
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.
6247
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.
6252
6253 The optional parameter is ignored for single plot-windows terminal, i.e. `pm`
6254 and `win`.
6255
6256 @example
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).
6262
6263 @end example
6264
6265 @node replot, reread, raise, Commands
6266 @section replot
6267
6268 @c ?commands replot
6269 @cindex replot
6270 @cmindex replot
6271
6272
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.
6276
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`.
6283
6284 N.B.---use of
6285
6286 @example
6287       plot '-' ; ... ; replot
6288
6289 @end example
6290
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.
6295
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.
6298
6299 See also `command-line-editing` for ways to edit the last `plot` (`splot`)
6300 command.
6301
6302 See also `show plot` to show the whole current plotting command, and the
6303 possibility to copy it into the `history`.
6304
6305 @node reread, reset, replot, Commands
6306 @section reread
6307
6308 @c ?commands reread
6309 @cindex reread
6310 @cmindex reread
6311
6312
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.
6320
6321 Examples:
6322
6323 Suppose the file "looper" contains the commands
6324 @example
6325       a=a+1
6326       plot sin(x*a)
6327       pause -1
6328       if(a<5) reread
6329 @end example
6330
6331 and from within `gnuplot` you submit the commands
6332 @example
6333       a=0
6334       load 'looper'
6335 @end example
6336
6337 The result will be five plots (separated by the @ref{pause} message).
6338
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
6342 @example
6343       c_p = c_p+1
6344       plot "$0" using 1:c_p with lines linetype c_p
6345       if(c_p <  n_p) reread
6346 @end example
6347
6348 and from within `gnuplot` you submit the commands
6349 @example
6350       n_p=6
6351       c_p=1
6352       unset key
6353       set yrange [0:10]
6354       set multiplot
6355       call 'plotter' 'data'
6356       unset multiplot
6357 @end example
6358
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.
6364
6365
6366 @node reset, save, reread, Commands
6367 @section reset
6368
6369 @c ?commands reset
6370 @cindex reset
6371 @cmindex reset
6372
6373
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.
6380
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}.
6383
6384 @node save, set-show, reset, Commands
6385 @section save
6386
6387 @c ^ <a name="save set"></a>
6388 @c ?commands save
6389 @cindex save
6390 @cmindex save
6391
6392
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.
6396
6397 Syntax:
6398 @example
6399       save  @{<option>@} '<filename>'
6400
6401 @end example
6402
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.
6406
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.
6413
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`.
6421
6422 The filename must be enclosed in quotes.
6423
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.
6430
6431 Examples:
6432 @example
6433       save 'work.gnu'
6434       save functions 'func.dat'
6435       save var 'var.dat'
6436       save set 'options.dat'
6437       save term 'myterm.gnu'
6438       save '-'
6439       save '|grep title >t.gp'
6440
6441 @end example
6442
6443 @node set-show, shell, save, Commands
6444 @section set-show
6445
6446 @c ?commands set
6447 @c ?commands show
6448 @cindex set
6449
6450 @cindex show
6451
6452 @c ?show all
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.
6455
6456 The `show` command shows their settings;  `show all` shows all the
6457 settings.
6458
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.
6462
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.
6466
6467 @menu
6468 * angles::                      
6469 * arrow::                       
6470 * autoscale::                   
6471 * bars::                        
6472 * bmargin::                     
6473 * border::                      
6474 * boxwidth::                    
6475 * clabel::                      
6476 * clip::                        
6477 * cntrparam::                   
6478 * color_box::                   
6479 * contour::                     
6480 * data_style::                  
6481 * datafile::                    
6482 * decimalsign::                 
6483 * dgrid3d::                     
6484 * dummy::                       
6485 * encoding::                    
6486 * fit_::                        
6487 * fontpath::                    
6488 * format_::                     
6489 * function_style::              
6490 * functions::                   
6491 * grid::                        
6492 * hidden3d::                    
6493 * historysize::                 
6494 * isosamples::                  
6495 * key::                         
6496 * label::                       
6497 * lmargin::                     
6498 * loadpath::                    
6499 * locale::                      
6500 * logscale::                    
6501 * macros::                      
6502 * mapping::                     
6503 * margin::                      
6504 * mouse::                       
6505 * multiplot::                   
6506 * mx2tics::                     
6507 * mxtics::                      
6508 * my2tics::                     
6509 * mytics::                      
6510 * mztics::                      
6511 * offsets::                     
6512 * origin::                      
6513 * output::                      
6514 * parametric_::                 
6515 * plot_::                       
6516 * pm3d::                        
6517 * palette::                     
6518 * pointsize::                   
6519 * polar::                       
6520 * print_::                      
6521 * object::                      
6522 * rmargin::                     
6523 * rrange::                      
6524 * samples::                     
6525 * size::                        
6526 * style::                       
6527 * surface::                     
6528 * table::                       
6529 * terminal::                    
6530 * termoption::                  
6531 * tics::                        
6532 * ticslevel::                   
6533 * ticscale::                    
6534 * timestamp::                   
6535 * timefmt::                     
6536 * title_::                      
6537 * tmargin::                     
6538 * trange::                      
6539 * urange::                      
6540 * variables::                   
6541 * version::                     
6542 * view::                        
6543 * vrange::                      
6544 * x2data::                      
6545 * x2dtics::                     
6546 * x2label::                     
6547 * x2mtics::                     
6548 * x2range::                     
6549 * x2tics::                      
6550 * x2zeroaxis::                  
6551 * xdata::                       
6552 * xdtics::                      
6553 * xlabel::                      
6554 * xmtics::                      
6555 * xrange::                      
6556 * xtics::                       
6557 * xyplane::                     
6558 * xzeroaxis::                   
6559 * y2data::                      
6560 * y2dtics::                     
6561 * y2label::                     
6562 * y2mtics::                     
6563 * y2range::                     
6564 * y2tics::                      
6565 * y2zeroaxis::                  
6566 * ydata::                       
6567 * ydtics::                      
6568 * ylabel::                      
6569 * ymtics::                      
6570 * yrange::                      
6571 * ytics::                       
6572 * yzeroaxis::                   
6573 * zdata::                       
6574 * zdtics::                      
6575 * zzeroaxis::                   
6576 * cbdata::                      
6577 * cbdtics::                     
6578 * zero::                        
6579 * zeroaxis::                    
6580 * zlabel::                      
6581 * zmtics::                      
6582 * zrange::                      
6583 * ztics::                       
6584 * cblabel::                     
6585 * cbmtics::                     
6586 * cbrange::                     
6587 * cbtics::                      
6588 @end menu
6589
6590 @node angles, arrow, set-show, set-show
6591 @subsection angles
6592
6593 @c ?commands set angles
6594 @c ?commands show angles
6595 @c ?set angles
6596 @c ?show angles
6597 @cindex angles
6598 @opindex angles
6599
6600
6601 @c ?commands set angles degrees
6602 @c ?set angles degrees
6603 @c ?angles degrees
6604 @cindex degrees
6605
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.
6611
6612 Syntax:
6613 @example
6614       set angles @{degrees | radians@}
6615       show angles
6616
6617 @end example
6618
6619 The angle specified in `set grid polar` is also read and displayed in the
6620 units specified by @ref{angles}.
6621
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.
6629
6630 @example
6631       x=@{1.0,0.1@}
6632       set angles radians
6633       y=sinh(x)
6634       print y         #prints @{1.16933, 0.154051@}
6635       print asinh(y)  #prints @{1.0, 0.1@}
6636 @end example
6637
6638 but
6639 @example
6640       set angles degrees
6641       y=sinh(x)
6642       print y         #prints @{1.16933, 0.154051@}
6643       print asinh(y)  #prints @{57.29578, 5.729578@}
6644 @end example
6645
6646 See also
6647 @uref{http://www.gnuplot.info/demo/poldat.html,poldat.dem: polar plot using @ref{angles} demo.
6648 }
6649
6650 @node arrow, autoscale, angles, set-show
6651 @subsection arrow
6652
6653 @c ?commands set arrow
6654 @c ?commands unset arrow
6655 @c ?commands show arrow
6656 @c ?set arrow
6657 @c ?unset arrow
6658 @c ?show arrow
6659 @cindex arrow
6660 @opindex arrow
6661
6662
6663 @cindex noarrow
6664
6665 Arbitrary arrows can be placed on a plot using the @ref{arrow} command.
6666
6667 Syntax:
6668 @example
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@}
6674                       @{front | back@}
6675                       @{ @{linestyle | ls <line_style>@}
6676                         | @{linetype | lt <line_type>@}
6677                           @{linewidth | lw <line_width@} @} @} @}
6678
6679 @end example
6680
6681 @example
6682       unset arrow @{<tag>@}
6683       show arrow @{<tag>@}
6684
6685 @end example
6686
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.
6692
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.
6707
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.
6713
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.
6726
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`.
6734
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).
6739
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`.
6743
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.
6747
6748 Examples:
6749
6750 To set an arrow pointing from the origin to (1,2) with user-defined style 5,
6751 use:
6752 @example
6753       set arrow to 1,2 ls 5
6754
6755 @end example
6756
6757 To set an arrow from bottom left of plotting area to (-5,5,3), and tag the
6758 arrow number 3, use:
6759 @example
6760       set arrow 3 from graph 0,0 to -5,5,3
6761
6762 @end example
6763
6764 To change the preceding arrow to end at 1,1,1, without an arrow head and
6765 double its width, use:
6766 @example
6767       set arrow 3 to 1,1,1 nohead lw 2
6768
6769 @end example
6770
6771 To draw a vertical line from the bottom to the top of the graph at x=3, use:
6772 @example
6773       set arrow from 3, graph 0 to 3, graph 1 nohead
6774
6775 @end example
6776
6777 To draw a vertical arrow with T-shape ends, use:
6778 @example
6779       set arrow 3 from 0,-5 to 0,5 heads size screen 0.1,90
6780
6781 @end example
6782
6783 To draw an arrow relatively to the start point, where the relative distances
6784 are given in graph coordinates, use:
6785 @example
6786       set arrow from 0,-5 rto graph 0.1,0.1
6787
6788 @end example
6789
6790 To draw an arrow with relative end point in logarithmic x axis, use:
6791 @example
6792       set logscale x
6793       set arrow from 100,-5 rto 10,10
6794 @end example
6795
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".
6799
6800 To delete arrow number 2, use:
6801 @example
6802       unset arrow 2
6803
6804 @end example
6805
6806 To delete all arrows, use:
6807 @example
6808       unset arrow
6809
6810 @end example
6811
6812 To show all arrows (in tag order), use:
6813 @example
6814       show arrow
6815
6816 @end example
6817
6818 @uref{http://gnuplot.sourceforge.net/demo/arrowstyle.html,arrows demos.
6819 }
6820
6821
6822 @node autoscale, bars, arrow, set-show
6823 @subsection autoscale
6824
6825 @c ?commands set autoscale
6826 @c ?commands unset autoscale
6827 @c ?commands show autoscale
6828 @c ?set autoscale
6829 @c ?unset autoscale
6830 @c ?show autoscale
6831 @cindex autoscale
6832 @opindex autoscale
6833
6834
6835 @cindex noautoscale
6836
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.
6839
6840 Syntax:
6841 @example
6842       set autoscale @{<axes>@{|min|max|fixmin|fixmax|fix@} | fix | keepfix@}
6843       unset autoscale @{<axes>@}
6844       show autoscale
6845
6846 @end example
6847
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.
6852
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
6857 settings.
6858
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.
6862
6863 If autoscaling of the dependent axis (y or z) is not set, the current y or z
6864 range is used.
6865
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)).
6871
6872 Please see @ref{xrange} for additional information about ranges.
6873
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.
6880
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}).
6884
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.
6890
6891 Examples:
6892
6893 This sets autoscaling of the y axis (other axes are not affected):
6894 @example
6895       set autoscale y
6896
6897 @end example
6898
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):
6901 @example
6902       set autoscale ymin
6903
6904 @end example
6905
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:
6908 @example
6909       set autoscale x2fixmin
6910       set autoscale x2fixmax
6911
6912 @end example
6913
6914 This sets autoscaling of the x and y axes:
6915 @example
6916       set autoscale xy
6917
6918 @end example
6919
6920 This sets autoscaling of the x, y, z, x2 and y2 axes:
6921 @example
6922       set autoscale
6923
6924 @end example
6925
6926 This disables autoscaling of the x, y, z, x2 and y2 axes:
6927 @example
6928       unset autoscale
6929
6930 @end example
6931
6932 This disables autoscaling of the z axis only:
6933 @example
6934       unset autoscale z
6935
6936 @end example
6937
6938 @menu
6939 * parametric_mode::             
6940 * polar_mode::                  
6941 @end menu
6942
6943 @node parametric_mode, polar_mode, autoscale, autoscale
6944 @subsubsection parametric mode
6945
6946 @c ?commands set autoscale parametric
6947 @c ?set autoscale parametric
6948 @c ?set autoscale t
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.
6955
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.
6960
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.
6966
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
6969 resulting data.
6970
6971 @node polar_mode,  , parametric_mode, autoscale
6972 @subsubsection polar mode
6973
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.
6980
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.
6985
6986 Explicitly setting one or two ranges but not others may lead to unexpected
6987 results.
6988 See also
6989 @uref{http://www.gnuplot.info/demo/poldat.html,polar demos.
6990 }
6991
6992 @node bars, bmargin, autoscale, set-show
6993 @subsection bars
6994
6995 @c ?commands set bars
6996 @c ?commands show bars
6997 @c ?set bars
6998 @c ?show bars
6999 @cindex bars
7000 @opindex bars
7001
7002
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
7005 financebars.
7006
7007 Syntax:
7008 @example
7009       set bars @{small | large | fullwidth | <size>@}
7010       unset bars
7011       show bars
7012
7013 @end example
7014
7015 `small` is a synonym for 0.0, and `large` for 1.0.
7016 The default is 1.0 if no size is given.
7017
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
7021 itself.
7022
7023 @node bmargin, border, bars, set-show
7024 @subsection bmargin
7025
7026 @c ?commands set bmargin
7027 @c ?set bmargin
7028 @cindex bmargin
7029 @opindex bmargin
7030
7031
7032 The command @ref{bmargin} sets the size of the bottom margin.
7033 Please see @ref{margin} for details.
7034
7035 @node border, boxwidth, bmargin, set-show
7036 @subsection border
7037
7038 @c ?commands set border
7039 @c ?commands unset border
7040 @c ?commands show border
7041 @c ?set border
7042 @c ?unset border
7043 @c ?show border
7044 @cindex border
7045 @opindex border
7046
7047
7048 @cindex noborder
7049
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.
7054
7055 Syntax:
7056 @example
7057       set border @{<integer>@} @{front | back@} @{linewidth | lw <line_width>@}
7058                  @{@{linestyle | ls <line_style>@} | @{linetype | lt <line_type>@}@}
7059       unset border
7060       show border
7061
7062 @end example
7063
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.)
7071
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:
7077
7078
7079 @example
7080             Bit     plot        splot
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
7093
7094 @end example
7095
7096
7097 Various bits or combinations of bits may be added together in the command.
7098
7099 The default is 31, which is all four sides for `plot`, and base and z axis
7100 for `splot`.
7101
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`.
7105
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).
7109
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.
7112
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
7115 specified.
7116
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.
7120
7121 Examples:
7122
7123 Draw default borders:
7124 @example
7125       set border
7126
7127 @end example
7128
7129 Draw only the left and bottom (`plot`) or both front and back bottom left
7130 (`splot`) borders:
7131 @example
7132       set border 3
7133
7134 @end example
7135
7136 Draw a complete box around a `splot`:
7137 @example
7138       set border 4095
7139
7140 @end example
7141
7142 Draw a topless box around a `splot`, omitting the front vertical:
7143 @example
7144       set border 127+256+512 # or set border 1023-128
7145
7146 @end example
7147
7148 Draw only the top and right borders for a `plot` and label them as axes:
7149 @example
7150       unset xtics; unset ytics; set x2tics; set y2tics; set border 12
7151
7152 @end example
7153
7154
7155 @node boxwidth, clabel, border, set-show
7156 @subsection boxwidth
7157
7158 @c ?commands set boxwidth
7159 @c ?commands show boxwidth
7160 @c ?set boxwidth
7161 @c ?show boxwidth
7162 @cindex boxwidth
7163 @opindex boxwidth
7164
7165
7166 The @ref{boxwidth} command is used to set the default width of boxes in the
7167 `boxes`, `boxerrorbars`, `candlesticks` and `histograms` styles.
7168
7169 Syntax:
7170 @example
7171       set boxwidth @{<width>@} @{absolute|relative@}
7172       show boxwidth
7173
7174 @end example
7175
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.
7179
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.
7187
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.
7193
7194 To set the box width to automatic use the command
7195 @example
7196       set boxwidth
7197
7198 @end example
7199
7200 or, for four-column data,
7201 @example
7202       set boxwidth -2
7203
7204 @end example
7205
7206 The same effect can be achieved with the @ref{using} keyword in `plot`:
7207 @example
7208       plot 'file' using 1:2:3:4:(-2)
7209
7210 @end example
7211
7212 To set the box width to half of the automatic size use
7213 @example
7214       set boxwidth 0.5 relative
7215
7216 @end example
7217
7218 To set the box width to an absolute value of 2 use
7219 @example
7220       set boxwidth 2 absolute
7221
7222 @end example
7223
7224 @node clabel, clip, boxwidth, set-show
7225 @subsection clabel
7226
7227 @c ?commands set clabel
7228 @c ?commands unset clabel
7229 @c ?commands show clabel
7230 @c ?set clabel
7231 @c ?unset clabel
7232 @c ?show clabel
7233 @cindex clabel
7234 @opindex clabel
7235
7236
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.
7241
7242 Syntax:
7243 @example
7244       set clabel @{'<format>'@}
7245       unset clabel
7246       show clabel
7247
7248 @end example
7249
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
7252 configuration.
7253
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.
7256
7257 See also @ref{contour}.
7258
7259 @node clip, cntrparam, clabel, set-show
7260 @subsection clip
7261
7262 @c ?commands set clip
7263 @c ?commands unset clip
7264 @c ?commands show clip
7265 @c ?set clip
7266 @c ?unset clip
7267 @c ?show clip
7268 @cindex clip
7269 @opindex clip
7270
7271
7272 @cindex noclip
7273
7274 `gnuplot` can clip data points and lines that are near the boundaries of a
7275 graph.
7276
7277 Syntax:
7278 @example
7279       set clip <clip-type>
7280       unset clip <clip-type>
7281       show clip
7282
7283 @end example
7284
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
7287 single graph.
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
7290 `set pm3d clip4in`.
7291
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.
7297
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
7301 segment.
7302
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
7305 drawn.
7306
7307 In no case is a line drawn outside the graph.
7308
7309 The defaults are `noclip points`, `clip one`, and `noclip two`.
7310
7311 To check the state of all forms of clipping, use
7312 @example
7313       show clip
7314
7315 @end example
7316
7317 For backward compatibility with older versions, the following forms are also
7318 permitted:
7319 @example
7320       set clip
7321       unset clip
7322
7323 @end example
7324
7325 @ref{clip} is synonymous with `set clip points`; @ref{clip} turns off all
7326 three types of clipping.
7327
7328 @node cntrparam, color_box, clip, set-show
7329 @subsection cntrparam
7330
7331 @c ?commands set cntrparam
7332 @c ?commands show cntrparam
7333 @c ?set cntrparam
7334 @c ?show cntrparam
7335 @cindex cntrparam
7336 @opindex cntrparam
7337
7338
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}.
7342
7343 Syntax:
7344 @example
7345       set cntrparam @{ @{ linear
7346                       | cubicspline
7347                       | bspline
7348                       | points <n>
7349                       | order <n>
7350                       | levels @{ auto @{<n>@} | <n>
7351                                  | discrete <z1> @{,<z2>@{,<z3>...@}@}
7352                                  | incremental <start>, <incr> @{,<end>@}
7353                                @}
7354                       @}
7355                     @}
7356       show contour
7357
7358 @end example
7359
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.
7365 The parameters are:
7366
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.
7373
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.
7378
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.
7384
7385 `levels`--- Selection of contour levels,  controlled by `auto` (default),
7386 `discrete`, `incremental`, and <n>, number of contour levels.
7387
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
7392 tic marks).
7393
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.
7397
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}.
7403
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.
7406
7407 Examples:
7408 @example
7409       set cntrparam bspline
7410       set cntrparam points 7
7411       set cntrparam order 10
7412
7413 @end example
7414
7415 To select levels automatically, 5 if the level increment criteria are met:
7416 @example
7417       set cntrparam levels auto 5
7418
7419 @end example
7420
7421 To specify discrete levels at .1, .37, and .9:
7422 @example
7423       set cntrparam levels discrete .1,1/exp(1),.9
7424
7425 @end example
7426
7427 To specify levels from 0 to 4 with increment 1:
7428 @example
7429       set cntrparam levels incremental  0,1,4
7430
7431 @end example
7432
7433 To set the number of levels to 10 (changing an incremental end or possibly
7434 the number of auto levels):
7435 @example
7436       set cntrparam levels 10
7437
7438 @end example
7439
7440 To set the start and increment while retaining the number of levels:
7441 @example
7442       set cntrparam levels incremental 100,50
7443
7444 @end example
7445
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.
7448
7449 See also
7450 @uref{http://www.gnuplot.info/demo/contours.html,contours demo (contours.dem)
7451 }
7452 and
7453 @uref{http://www.gnuplot.info/demo/discrete.html,contours with user defined levels demo (discrete.dem).
7454 }
7455
7456 @node color_box, contour, cntrparam, set-show
7457 @subsection color box
7458
7459 @c ?commands set colorbox
7460 @c ?commands show colorbox
7461 @c ?commands unset colorbox
7462 @c ?set colorbox
7463 @c ?show colorbox
7464 @c ?unset colorbox
7465 @cindex colorbox
7466
7467
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
7470 colorbox`.
7471
7472 @example
7473       set colorbox
7474       set colorbox @{
7475                  @{ vertical | horizontal @}
7476                  @{ default | user @}
7477                  @{ origin x, y @}
7478                  @{ size x, y @}
7479                  @{ front | back @}
7480                  @{ noborder | bdefault | border [line style] @}
7481                @}
7482       show colorbox
7483       unset colorbox
7484
7485 @end example
7486
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.
7490
7491 The orientation of the color gradient can be switched by options `vertical`
7492 and `horizontal`.
7493
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:
7498 @example
7499     set colorbox horiz user origin .1,.02 size .8,.04
7500 @end example
7501
7502 which will draw a horizontal gradient somewhere at the bottom of the graph.
7503
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.:
7507 @example
7508     set style line 2604 linetype -1 linewidth .4
7509     set colorbox border 2604
7510 @end example
7511
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.
7515
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`,
7519 `[no]cbmtics`.
7520
7521 `set colorbox` without any parameter switches the position to default.
7522 `unset colorbox` resets the default parameters for the colorbox and switches
7523 the colorbox off.
7524
7525 See also help for @ref{pm3d}, @ref{palette}, @ref{pm3d}, and `set style line`.
7526
7527
7528 @node contour, data_style, color_box, set-show
7529 @subsection contour
7530
7531 @c ?commands set contour
7532 @c ?commands unset contour
7533 @c ?commands show contour
7534 @c ?set contour
7535 @c ?unset contour
7536 @c ?show contour
7537 @cindex contour
7538 @opindex contour
7539
7540
7541 @cindex nocontour
7542
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.
7547
7548 Syntax:
7549 @example
7550       set contour @{base | surface | both@}
7551       unset contour
7552       show contour
7553
7554 @end example
7555
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`.
7560
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.
7563
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:
7568
7569 @example
7570       unset surface
7571       set contour
7572       set cntrparam ...
7573       set table 'filename'
7574       splot ...
7575       unset table
7576       # contour info now in filename
7577       set term <whatever>
7578       plot 'filename'
7579
7580 @end example
7581
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}.
7588
7589 See also
7590 @uref{http://www.gnuplot.info/demo/contours.html,contours demo (contours.dem)
7591 }
7592 and
7593 @uref{http://www.gnuplot.info/demo/discrete.html,contours with user defined levels demo (discrete.dem).
7594 }
7595
7596 @node data_style, datafile, contour, set-show
7597 @subsection data style
7598
7599 @c ?DUMMYLABEL set style data
7600 This form of the command is deprecated. Please see `set style data`.
7601
7602 @node datafile, decimalsign, data_style, set-show
7603 @subsection datafile
7604
7605 @c ?set datafile
7606 @c ?show 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.
7610
7611 @menu
7612 * set_datafile_fortran::        
7613 * set_datafile_missing::        
7614 * set_datafile_separator::      
7615 * set_datafile_commentschars::  
7616 * set_datafile_binary::         
7617 @end menu
7618
7619 @node set_datafile_fortran, set_datafile_missing, datafile, datafile
7620 @subsubsection set datafile fortran
7621
7622 @c ?set datafile fortran
7623 @cindex fortran
7624
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`.
7630
7631 @node set_datafile_missing, set_datafile_separator, set_datafile_fortran, datafile
7632 @subsubsection set datafile missing
7633
7634 @c ?set datafile missing
7635 @c ?set missing
7636 @cindex missing
7637
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`
7641 command.
7642
7643 Syntax:
7644 @example
7645       set datafile missing @{"<string>"@}
7646       show datafile missing
7647       unset datafile
7648
7649 @end example
7650
7651 Example:
7652 @example
7653       # Ignore entries containing IEEE NaN ("Not a Number") code
7654       set datafile missing "NaN"
7655
7656 @end example
7657
7658 Example:
7659 @example
7660       set datafile missing "?"
7661       set style data lines
7662       plot '-'
7663          1 10
7664          2 20
7665          3 ?
7666          4 40
7667          5 50
7668          e
7669       plot '-' using 1:2
7670          1 10
7671          2 20
7672          3 ?
7673          4 40
7674          5 50
7675          e
7676       plot '-' using 1:($2)
7677          1 10
7678          2 20
7679          3 ?
7680          4 40
7681          5 50
7682          e
7683
7684 @end example
7685
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)
7689 at (2,3).
7690
7691 The second `plot` will correctly ignore the middle line.  The plotted line
7692 will connect the points at (2,20) and (4,40).
7693
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).
7696
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.
7700
7701
7702 @node set_datafile_separator, set_datafile_commentschars, set_datafile_missing, datafile
7703 @subsubsection set datafile separator
7704
7705 @c ?set datafile separator
7706 @c ?show datafile separator
7707 @c ?datafile separator
7708 @cindex separator
7709
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
7714 whitespace.
7715
7716 Syntax:
7717 @example
7718       set datafile separator @{"<char>" | whitespace@}
7719
7720 @end example
7721
7722 Examples:
7723 @example
7724       # Input file contains tab-separated fields
7725       set datafile separator "\t"
7726
7727 @end example
7728
7729 @example
7730       # Input file contains comma-separated values fields
7731       set datafile separator ","
7732
7733 @end example
7734
7735 @node set_datafile_commentschars, set_datafile_binary, set_datafile_separator, datafile
7736 @subsubsection set datafile commentschars
7737
7738 @c ?set datafile commentschars
7739 @cindex commentschars
7740
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.
7745
7746 Syntax:
7747 @example
7748       set datafile commentschars @{"<string>"@}
7749       show datafile commentschars
7750       unset commentschars
7751
7752 @end example
7753
7754 Default value of the string is "#!" on VMS and "#" otherwise.
7755
7756 Then, the following line in a data file is completely ignored
7757 @example
7758     # 1 2 3 4
7759 @end example
7760
7761 but the following
7762 @example
7763     1 # 3 4
7764 @end example
7765
7766 produces rather unexpected plot unless
7767 @example
7768     set datafile missing '#'
7769 @end example
7770
7771 is specified as well.
7772
7773 Example:
7774 @example
7775       set datafile commentschars "#!%"
7776
7777 @end example
7778
7779 @node set_datafile_binary,  , set_datafile_commentschars, datafile
7780 @subsubsection set datafile binary
7781
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>.
7786
7787 Syntax:
7788 @example
7789       set datafile binary <binary list>
7790       show datafile binary
7791       show datafile
7792       unset datafile
7793
7794 @end example
7795
7796 Examples:
7797 @example
7798       set datafile binary filetype=auto
7799       set datafile binary array=512x512 format="%uchar"
7800
7801 @end example
7802
7803 @node decimalsign, dgrid3d, datafile, set-show
7804 @subsection decimalsign
7805
7806 @c ?commands set decimalsign
7807 @c ?commands show decimalsign
7808 @c ?commands unset decimalsign
7809 @c ?set decimalsign
7810 @c ?show decimalsign
7811 @c ?unset decimalsign
7812 @cindex decimalsign
7813 @opindex decimalsign
7814
7815
7816 @cindex locale
7817 @opindex locale
7818
7819
7820 The @ref{decimalsign} command selects a decimal sign for numbers printed
7821 into tic labels or @ref{label} strings.
7822
7823 Syntax:
7824 @example
7825       set decimalsign @{<value> | locale @{"<locale>"@}@}
7826       unset decimalsign
7827       show decimalsign
7828
7829 @end example
7830
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>.
7836
7837 Example:
7838
7839 Correct typesetting in most European countries requires:
7840 @example
7841       set decimalsign ','
7842
7843 @end example
7844
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
7850
7851 @example
7852       set decimalsign locale
7853
7854 @end example
7855
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
7858 variables.
7859
7860 @example
7861       set decimalsign locale "foo"
7862
7863 @end example
7864
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.
7874
7875 @example
7876       set decimalsign locale; set decimalsign "."
7877
7878 @end example
7879
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.
7883
7884 @node dgrid3d, dummy, decimalsign, set-show
7885 @subsection dgrid3d
7886
7887 @c ?commands set dgrid3d
7888 @c ?commands unset dgrid3d
7889 @c ?commands show dgrid3d
7890 @c ?set dgrid3d
7891 @c ?unset dgrid3d
7892 @c ?show dgrid3d
7893 @cindex dgrid3d
7894 @opindex dgrid3d
7895
7896
7897 @cindex nodgrid3d
7898
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
7901 structure.
7902
7903 Syntax:
7904 @example
7905       set dgrid3d @{<row_size>@} @{,@{<col_size>@} @{,<norm>@}@}
7906       unset dgrid3d
7907       show dgrid3d
7908
7909 @end example
7910
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.
7917
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
7925 can be used.)
7926
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.
7930
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.
7935
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.)
7946
7947 Examples:
7948 @example
7949       set dgrid3d 10,10,1     # defaults
7950       set dgrid3d ,,4
7951
7952 @end example
7953
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.
7957 See also
7958 @uref{http://www.gnuplot.info/demo/scatter.html,scatter.dem: dgrid3d demo.
7959 }
7960
7961
7962 @node dummy, encoding, dgrid3d, set-show
7963 @subsection dummy
7964
7965 @c ?commands set dummy
7966 @c ?commands show dummy
7967 @c ?set dummy
7968 @c ?show dummy
7969 @cindex dummy
7970 @opindex dummy
7971
7972
7973 The @ref{dummy} command changes the default dummy variable names.
7974
7975 Syntax:
7976 @example
7977       set dummy @{<dummy-var>@} @{,<dummy-var>@}
7978       show dummy
7979
7980 @end example
7981
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"
7986 otherwise.
7987
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:
7990
7991 @example
7992       set dummy t
7993       plot sin(t), cos(t)
7994
7995 @end example
7996
7997 At least one dummy variable must be set on the command; @ref{dummy} by itself
7998 will generate an error message.
7999
8000 Examples:
8001 @example
8002       set dummy u,v
8003       set dummy ,s
8004
8005 @end example
8006
8007 The second example sets the second variable to s.
8008
8009 @node encoding, fit_, dummy, set-show
8010 @subsection encoding
8011
8012 @c ?commands set encoding
8013 @c ?commands show encoding
8014 @c ?set encoding
8015 @c ?show encoding
8016 @cindex encoding
8017 @opindex encoding
8018
8019
8020 @cindex encodings
8021
8022 The @ref{encoding} command selects a character encoding.
8023 Syntax:
8024 @example
8025       set encoding @{<value>@}
8026       show encoding
8027
8028 @end example
8029
8030 Valid values are
8031 @example
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
8044
8045 @end example
8046
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`.
8052
8053 @node fit_, fontpath, encoding, set-show
8054 @subsection fit
8055
8056 @c ?commands set fit
8057 @c ?commands show fit
8058 @c ?set fit
8059 @c ?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.
8063
8064 Syntax:
8065 @example
8066       set fit @{logfile @{"<filename>"@}@} @{@{no@}errorvariables@}
8067       unset fit
8068       show fit
8069
8070 @end example
8071
8072 The <filename> argument must be enclosed in single or double quotes.
8073
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
8076 variable `FIT_LOG`.
8077
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.
8083
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
8086 directory.
8087
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:
8093
8094 @example
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)
8100
8101 @end example
8102
8103 @node fontpath, format_, fit_, set-show
8104 @subsection fontpath
8105
8106 @c ?commands set fontpath
8107 @c ?commands show fontpath
8108 @c ?set fontpath
8109 @c ?show fontpath
8110 @cindex fontpath
8111 @opindex fontpath
8112
8113
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.
8120
8121 Syntax:
8122 @example
8123       set fontpath @{"pathlist1" @{"pathlist2"...@}@}
8124       show fontpath
8125
8126 @end example
8127
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.
8135
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
8144 @ref{fontpath}.
8145
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.
8149
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.
8153
8154 @node format_, function_style, fontpath, set-show
8155 @subsection format
8156
8157 @c ?commands set format
8158 @c ?commands show format
8159 @c ?set format
8160 @c ?show format
8161 @cindex format
8162 @opindex format
8163
8164
8165 @c ?format cb
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.
8168
8169 Syntax:
8170 @example
8171       set format @{<axes>@} @{"<format-string>"@}
8172       set format @{<axes>@} @{'<format-string>'@}
8173       show format
8174
8175 @end example
8176
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}.
8185
8186 Newline (\n) is accepted in the format string.  Use double-quotes rather than
8187 single-quotes to enable such interpretation.  See also `syntax`.
8188
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.
8194
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 %%".
8198
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
8201 printed this way.
8202 See also
8203 @uref{http://www.gnuplot.info/demo/electron.html,electron demo (electron.dem).
8204 }
8205
8206 @menu
8207 * gprintf_::                    
8208 * format_specifiers::           
8209 * time/date_specifiers::        
8210 @end menu
8211
8212 @node gprintf_, format_specifiers, format_, format_
8213 @subsubsection gprintf
8214
8215 @cindex gprintf
8216 @findex gprintf
8217
8218
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`.
8224
8225 @node format_specifiers, time/date_specifiers, gprintf_, format_
8226 @subsubsection format specifiers
8227
8228 @c ?commands set format specifiers
8229 @c ?set format specifiers
8230 @c ?format specifiers
8231 @cindex format_specifiers
8232
8233 The acceptable formats (if not in time/date mode) are:
8234
8235
8236 @example
8237       Format       Explanation
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
8241       %x or %X     hex
8242       %o or %O     octal
8243       %t           mantissa to base 10
8244       %l           mantissa to base of current logscale
8245       %s           mantissa to base of current logscale; scientific power
8246       %T           power to base 10
8247       %L           power to base of current logscale
8248       %S           scientific power
8249       %c           character replacement for scientific power
8250       %P           multiple of pi
8251
8252 @end example
8253
8254
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.
8259
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).
8271
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
8274 then experiment.
8275
8276 Examples:
8277 @example
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%"
8286
8287 @end example
8288
8289 @example
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)
8292
8293 @end example
8294
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.
8297
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.
8301
8302 @node time/date_specifiers,  , format_specifiers, format_
8303 @subsubsection time/date specifiers
8304
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
8312
8313 @cindex time_specifiers
8314
8315 In time/date mode, the acceptable formats are:
8316
8317
8318 @example
8319       Format       Explanation
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
8332       %m           month, 01--12
8333       %M           minute, 0--60
8334       %p           "am" or "pm"
8335       %r           shorthand for "%I:%M:%S %p" (only output)
8336       %R           shorthand for "%H:%M" (only output)
8337       %S           second, 0--60
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)
8342       %y           year, 0-99
8343       %Y           year, 4-digit
8344
8345 @end example
8346
8347
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.
8353
8354 Examples:
8355
8356 Suppose the text is "76/12/25 23:11:11".  Then
8357 @example
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"
8361
8362 @end example
8363
8364 Suppose the text is "98/07/06 05:04:03".  Then
8365 @example
8366       set format x "%1y/%2m/%3d %01H:%02M:%03S"  # "98/ 7/  6 5:04:003"
8367
8368 @end example
8369
8370 @node function_style, functions, format_, set-show
8371 @subsection function style
8372
8373 This form of the command is deprecated. Please see `set style function`.
8374
8375 @node functions, grid, function_style, set-show
8376 @subsection functions
8377
8378 @c ?commands show functions
8379 @c ?show functions
8380 The @ref{functions} command lists all user-defined functions and their
8381 definitions.
8382
8383 Syntax:
8384 @example
8385       show functions
8386
8387 @end example
8388
8389 For information about the definition and usage of functions in `gnuplot`,
8390 please see `expressions`.
8391 See also
8392 @uref{http://www.gnuplot.info/demo/spline.html,splines as user defined functions (spline.dem)
8393 }
8394 and
8395 @uref{http://www.gnuplot.info/demo/airfoil.html,use of functions and complex variables for airfoils (airfoil.dem).
8396 }
8397
8398 @node grid, hidden3d, functions, set-show
8399 @subsection grid
8400
8401 @c ?commands set grid
8402 @c ?commands unset grid
8403 @c ?commands show grid
8404 @c ?set grid
8405 @c ?unset grid
8406 @c ?show grid
8407 @cindex grid
8408 @opindex grid
8409
8410
8411 @cindex nogrid
8412
8413 The `set grid` command allows grid lines to be drawn on the plot.
8414
8415 Syntax:
8416 @example
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>@} @} @}
8428       unset grid
8429       show grid
8430
8431 @end example
8432
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.
8437
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.
8443
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.
8447
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.
8450
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`).
8462
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}.
8465
8466 @node hidden3d, historysize, grid, set-show
8467 @subsection hidden3d
8468
8469 @c ?commands set hidden3d
8470 @c ?commands unset hidden3d
8471 @c ?commands show hidden3d
8472 @c ?set hidden3d
8473 @c ?unset hidden3d
8474 @c ?show hidden3d
8475 @cindex hidden3d
8476 @opindex hidden3d
8477
8478
8479 @cindex nohidden3d
8480
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.
8484
8485 Syntax:
8486 @example
8487       set hidden3d @{defaults@} |
8488                    @{ @{@{offset <offset>@} | @{nooffset@}@}
8489                      @{trianglepattern <bitpattern>@}
8490                      @{@{undefined <level>@} | @{noundefined@}@}
8491                      @{@{no@}altdiagonal@}
8492                      @{@{no@}bentover@} @}
8493       unset hidden3d
8494       show hidden3d
8495
8496 @end example
8497
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`.
8503
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.
8509
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.
8516
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}.
8519
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.
8526
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.
8533
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.
8540
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.
8549
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.
8560
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.
8570
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:
8576
8577 @example
8578                                                               C----B
8579     original quadrangle:  A--B      displayed quadrangle:     |\   |
8580       ("set view 0,0")    | /|    ("set view 75,75" perhaps)  | \  |
8581                           |/ |                                |  \ |
8582                           C--D                                |   \|
8583                                                               A    D
8584
8585 @end example
8586
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.
8592 See also
8593 @uref{http://www.gnuplot.info/demo/hidden.html,hidden line removal demo (hidden.dem)
8594 }
8595 and
8596 @uref{http://www.gnuplot.info/demo/singulr.html,complex hidden line demo (singulr.dem).
8597 }
8598
8599 @node historysize, isosamples, hidden3d, set-show
8600 @subsection historysize
8601
8602 @c ?commands set historysize
8603 @c ?set historysize
8604 @c ?unset historysize
8605 @cindex historysize
8606 @opindex historysize
8607
8608
8609 @cindex nohistorysize
8610
8611 Note: the command @ref{historysize} is only available when
8612 gnuplot has been configured with the GNU readline.
8613
8614 Syntax:
8615 @example
8616       set historysize <int>
8617       unset historysize
8618
8619 @end example
8620
8621 When leaving gnuplot, the value of historysize is used for
8622 truncating the history to at most that much lines. The default
8623 is 500.
8624 @ref{historysize} will disable history truncation and thus
8625 allow an infinite number of lines to be written to the history
8626 file.
8627
8628 @node isosamples, key, historysize, set-show
8629 @subsection isosamples
8630
8631 @c ?commands set isosamples
8632 @c ?commands show isosamples
8633 @c ?set isosamples
8634 @c ?show isosamples
8635 @cindex isosamples
8636 @opindex isosamples
8637
8638
8639 The isoline density (grid) for plotting functions as surfaces may be changed
8640 by the @ref{isosamples} command.
8641
8642 Syntax:
8643 @example
8644       set isosamples <iso_1> @{,<iso_2>@}
8645       show isosamples
8646
8647 @end example
8648
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.
8654
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.
8660
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.
8667
8668 @node key, label, isosamples, set-show
8669 @subsection key
8670
8671 @c ?commands set key
8672 @c ?commands unset key
8673 @c ?commands show key
8674 @c ?set key
8675 @c ?unset key
8676 @c ?show key
8677 @cindex key
8678 @opindex key
8679
8680
8681 @cindex nokey
8682
8683 @cindex legend
8684
8685 The @ref{key} command enables a key (or legend) describing plots on a plot.
8686
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.
8691
8692 Syntax:
8693 @example
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>@}@}@}
8708       unset key
8709       show key
8710
8711 @end example
8712
8713 Plots may be drawn with no visible key by requesting `set key off` or
8714 @ref{key}.
8715
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.
8721
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.
8729
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.
8734
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
8737 illustrated:
8738
8739 @example
8740      t/l   t/c   t/r
8741
8742 @end example
8743
8744 @example
8745      c/l    c    c/r
8746
8747 @end example
8748
8749 @example
8750      b/l   b/c   b/r
8751
8752 @end example
8753
8754
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.
8765
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:
8770
8771 @example
8772           l/tm  c/tm  r/tm
8773
8774 @end example
8775
8776 @example
8777      t/lm                  t/rm
8778
8779 @end example
8780
8781 @example
8782      c/lm                  c/rm
8783
8784 @end example
8785
8786 @example
8787      b/lm                  b/rm
8788
8789 @end example
8790
8791 @example
8792           l/bm  c/bm  r/bm
8793
8794 @end example
8795
8796
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).
8805
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
8813 <position>, etc.
8814
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.
8820
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.
8826
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.
8832
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.
8837
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.
8843
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.
8848
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.
8853
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`.
8861
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.
8865
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.
8869
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
8874 configuration.
8875
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.
8887
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
8893 literal string.
8894
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.
8899
8900 Examples:
8901
8902 This places the key at the default location:
8903 @example
8904       set key default
8905
8906 @end example
8907
8908 This disables the key:
8909 @example
8910       unset key
8911
8912 @end example
8913
8914 This places a key at coordinates 2,3.5,2 in the default (first) coordinate
8915 system:
8916 @example
8917       set key at 2,3.5,2
8918
8919 @end example
8920
8921 This places the key below the graph:
8922 @example
8923       set key below
8924
8925 @end example
8926
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:
8929 @example
8930       set key left bottom Left title 'Legend' box 3
8931
8932 @end example
8933
8934 @node label, lmargin, key, set-show
8935 @subsection label
8936
8937 @c ?commands set label
8938 @c ?commands unset label
8939 @c ?commands show label
8940 @c ?set label
8941 @c ?unset label
8942 @c ?show label
8943 @cindex label
8944 @opindex label
8945
8946
8947 @cindex nolabel
8948
8949 Arbitrary labels can be placed on the plot using the @ref{label} command.
8950
8951 Syntax:
8952 @example
8953       set label @{<tag>@} @{"<label text>"@} @{at <position>@}
8954                 @{left | center | right@}
8955                 @{norotate | rotate @{by <degrees>@}@}
8956                 @{font "<name>@{,<size>@}"@}
8957                 @{noenhanced@}
8958                 @{front | back@}
8959                 @{textcolor <colorspec>@}
8960                 @{point <pointstyle> | nopoint@}
8961                 @{offset <offset>@}
8962       unset label @{<tag>@}
8963       show label
8964
8965 @end example
8966
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.
8970
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.
8976
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}.
8979
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.
8986
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.
8991
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
8994 will be used.
8995
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`.
9001
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.
9005
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`.
9009 @example
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.
9018
9019 @end example
9020
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).
9027
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.
9033
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}.
9037
9038 The EEPIC, Imagen, LaTeX, and TPIC drivers allow \\ in a string to specify
9039 a newline.
9040
9041 Examples:
9042
9043 To set a label at (1,2) to "y=x", use:
9044 @example
9045       set label "y=x" at 1,2
9046
9047 @end example
9048
9049 To set a Sigma of size 24, from the Symbol font set, at the center of
9050 the graph, use:
9051 @example
9052       set label "S" at graph 0.5,0.5 center font "Symbol,24"
9053
9054 @end example
9055
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:
9058 @example
9059       set label 3 "y=x^2" at 2,3,4 right
9060
9061 @end example
9062
9063 To change the preceding label to center justification, use:
9064 @example
9065       set label 3 center
9066
9067 @end example
9068
9069 To delete label number 2, use:
9070 @example
9071       unset label 2
9072
9073 @end example
9074
9075 To delete all labels, use:
9076 @example
9077       unset label
9078
9079 @end example
9080
9081 To show all labels (in tag order), use:
9082 @example
9083       show label
9084
9085 @end example
9086
9087 To set a label on a graph with a timeseries on the x axis, use, for example:
9088 @example
9089       set timefmt "%d/%m/%y,%H:%M"
9090       set label "Harvest" at "25/8/93",1
9091
9092 @end example
9093
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`:
9096 @example
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
9100
9101 @end example
9102
9103 To set a label displaced a little bit from a small point:
9104 @example
9105       set label 'origin' at 0,0 point lt 1 pt 2 ps 3 offset 1,-1
9106
9107 @end example
9108
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:
9111 @example
9112       set label 'text' at 0,0,5.5 tc palette z
9113
9114 @end example
9115
9116
9117 @node lmargin, loadpath, label, set-show
9118 @subsection lmargin
9119
9120 @c ?commands set lmargin
9121 @c ?set lmargin
9122 @cindex lmargin
9123 @opindex lmargin
9124
9125
9126 The command @ref{lmargin} sets the size of the left margin.
9127 Please see @ref{margin} for details.
9128
9129 @node loadpath, locale, lmargin, set-show
9130 @subsection loadpath
9131
9132 @c ?commands set loadpath
9133 @c ?commands show loadpath
9134 @c ?set loadpath
9135 @c ?show loadpath
9136 @cindex loadpath
9137 @opindex loadpath
9138
9139
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.
9144
9145 Syntax:
9146 @example
9147       set loadpath @{"pathlist1" @{"pathlist2"...@}@}
9148       show loadpath
9149
9150 @end example
9151
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
9157 portability.
9158
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.
9164
9165 @node locale, logscale, loadpath, set-show
9166 @subsection locale
9167
9168 @c ?commands set locale
9169 @c ?set locale
9170 @cindex locale
9171 @opindex locale
9172
9173
9174 The @ref{locale} setting determines the language with which `@{x,y,z@}@{d,m@}tics`
9175 will write the days and months.
9176
9177 Syntax:
9178 @example
9179       set locale @{"<locale>"@}
9180
9181 @end example
9182
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.
9186
9187 To change the decimal point locale, see @ref{decimalsign}.
9188
9189 @node logscale, macros, locale, set-show
9190 @subsection logscale
9191
9192 @c ?commands set logscale
9193 @c ?commands unset logscale
9194 @c ?commands show logscale
9195 @c ?set logscale
9196 @c ?unset logscale
9197 @c ?show logscale
9198 @c ?set log
9199 @cindex logscale
9200 @opindex logscale
9201
9202
9203 @cindex nologscale
9204
9205 Syntax:
9206 @example
9207       set logscale <axes> <base>
9208       unset logscale <axes>
9209       show logscale
9210
9211 @end example
9212
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.
9217
9218 Examples:
9219
9220 To enable log scaling in both x and z axes:
9221 @example
9222       set logscale xz
9223
9224 @end example
9225
9226 To enable scaling log base 2 of the y axis:
9227 @example
9228       set logscale y 2
9229
9230 @end example
9231
9232 To enable z and color log axes for a pm3d plot:
9233 @example
9234       set logscale zcb
9235
9236 @end example
9237
9238 To disable z axis log scaling:
9239 @example
9240       unset logscale z
9241
9242 @end example
9243
9244 @node macros, mapping, logscale, set-show
9245 @subsection macros
9246
9247 @c ?commands set macros
9248 @c ?commands show macros
9249 @c ?set macros
9250 @c ?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`.
9254
9255 Syntax:
9256 @example
9257      set macros
9258
9259 @end example
9260
9261
9262 @node mapping, margin, macros, set-show
9263 @subsection mapping
9264
9265 @c ?commands set mapping
9266 @c ?commands show mapping
9267 @c ?set mapping
9268 @c ?show mapping
9269 @cindex mapping
9270 @opindex mapping
9271
9272
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
9275 interpret them.
9276
9277 Syntax:
9278 @example
9279       set mapping @{cartesian | spherical | cylindrical@}
9280
9281 @end example
9282
9283 A cartesian coordinate system is used by default.
9284
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.
9290 The mapping is:
9291
9292 @example
9293       x = r * cos(theta) * cos(phi)
9294       y = r * sin(theta) * cos(phi)
9295       z = r * sin(phi)
9296
9297 @end example
9298
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).
9301
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:
9306
9307 @example
9308       x = r * cos(theta)
9309       y = r * sin(theta)
9310       z = z
9311
9312 @end example
9313
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.
9318
9319 @ref{mapping} has no effect on `plot`.
9320 @c ^ See also
9321 @uref{http://www.gnuplot.info/demo/world.html,world.dem: mapping demos.
9322 }
9323
9324 @node margin, mouse, mapping, set-show
9325 @subsection margin
9326
9327 @c ?commands set margin
9328 @c ?commands show margin
9329 @c ?set margin
9330 @c ?show margin
9331 @cindex margin
9332 @opindex margin
9333
9334
9335 The computed margins can be overridden by the @ref{margin} commands.  @ref{margin} shows the current settings.
9336
9337 Syntax:
9338 @example
9339       set bmargin @{@{at screen@} <margin>@}
9340       set lmargin @{@{at screen@} <margin>@}
9341       set rmargin @{@{at screen@} <margin>@}
9342       set tmargin @{@{at screen@} <margin>@}
9343       show margin
9344
9345 @end example
9346
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.
9351
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.
9357
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.
9365
9366 @node mouse, multiplot, margin, set-show
9367 @subsection mouse
9368
9369 @c ?commands set mouse
9370 @c ?commands unset mouse
9371 @c ?set mouse
9372 @c ?unset mouse
9373 @cindex mouse
9374 @opindex mouse
9375
9376
9377 @cindex nomouse
9378
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}.
9389
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).
9393
9394 Syntax:
9395 @example
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@}
9405       unset mouse
9406
9407 @end example
9408
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
9412 is 300 ms.
9413
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.
9416
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
9419 'r'.
9420
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'.
9424
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".
9428
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.
9436
9437 The following formats are available (format 6 may only be selected if the
9438 format string was specified already):
9439
9440 @example
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   ""
9448
9449 @end example
9450
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}.
9461
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
9465 default.
9466
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.
9470
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.
9475
9476 Press 'q' in the driver's window to close the window. This key cannot be
9477 overridden with the @ref{bind} command.
9478
9479 See also help for @ref{bind} and @ref{label}.
9480
9481 @menu
9482 * X11_mouse::                   
9483 @end menu
9484
9485 @node X11_mouse,  , mouse, mouse
9486 @subsubsection X11 mouse
9487
9488 @c ?mouse x11_mouse
9489 @cindex x11_mouse
9490
9491 @c ?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.
9496
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.
9502
9503 @node multiplot, mx2tics, mouse, set-show
9504 @subsection multiplot
9505
9506 @c ?commands set multiplot
9507 @c ?commands unset multiplot
9508 @c ?set multiplot
9509 @c ?unset multiplot
9510 @cindex multiplot
9511 @opindex multiplot
9512
9513
9514 @cindex nomultiplot
9515
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.
9518
9519 Syntax:
9520 @example
9521       set multiplot @{ layout <rows>,<cols>
9522                       @{rowsfirst|columnsfirst@} @{downwards|upwards@}
9523                       @{title <page title>@}
9524                       @{scale <xscale>@{,<yscale>@}@} @{offset <xoff>@{,<yoff>@}@}
9525                     @}
9526       unset multiplot
9527
9528 @end example
9529
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
9535 display.
9536
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.
9540
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.
9548
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
9551 of the canvas.
9552
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.
9556
9557 Example:
9558 @example
9559       set multiplot
9560       set size 0.4,0.4
9561       set origin 0.1,0.1
9562       plot sin(x)
9563       set size 0.2,0.2
9564       set origin 0.5,0.5
9565       plot cos(x)
9566       unset multiplot
9567
9568 @end example
9569
9570 This displays a plot of cos(x) stacked above a plot of sin(x).
9571
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.
9579
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`.
9588
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`.
9593
9594 Example:
9595 @example
9596       set size 1,1
9597       set origin 0,0
9598       set multiplot layout 3,2 columnsfirst scale 1.1,0.9
9599       [ up to 6 plot commands here ]
9600       unset multiplot
9601
9602 @end example
9603
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
9606 size of 0.9/3.
9607
9608 See also
9609 @uref{http://gnuplot.sourceforge.net/demo/multiplt.html,multiplot demo (multiplt.dem)
9610 }
9611
9612 @node mx2tics, mxtics, multiplot, set-show
9613 @subsection mx2tics
9614
9615 @c ?commands set mx2tics
9616 @c ?commands unset mx2tics
9617 @c ?commands show mx2tics
9618 @c ?set mx2tics
9619 @c ?unset mx2tics
9620 @c ?show mx2tics
9621 @cindex mx2tics
9622 @opindex mx2tics
9623
9624
9625 @cindex nomx2tics
9626
9627 Minor tic marks along the x2 (top) axis are controlled by @ref{mx2tics}.
9628 Please see @ref{mxtics}.
9629
9630 @node mxtics, my2tics, mx2tics, set-show
9631 @subsection mxtics
9632
9633 @c ?commands set mxtics
9634 @c ?commands unset mxtics
9635 @c ?commands show mxtics
9636 @c ?set mxtics
9637 @c ?unset mxtics
9638 @c ?show mxtics
9639 @cindex mxtics
9640 @opindex mxtics
9641
9642
9643 @cindex nomxtics
9644
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
9647 the other axes.
9648
9649 Syntax:
9650 @example
9651       set mxtics @{<freq> | default@}
9652       unset mxtics
9653       show mxtics
9654
9655 @end example
9656
9657 The same syntax applies to @ref{mytics}, @ref{mztics}, @ref{mx2tics}, @ref{my2tics} and
9658 `mcbtics`.
9659
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.
9665
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.
9671
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.
9674
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`.
9680
9681 Examples:
9682 @example
9683       set xtics 0, 5, 10
9684       set xtics add (7.5)
9685       set mxtics 5
9686 @end example
9687
9688 Major tics at 0,5,7.5,10, minor tics at 1,2,3,4,6,7,8,9
9689 @example
9690       set logscale y
9691       set ytics format ""
9692       set ytics 1e-6, 10, 1
9693       set ytics add ("1" 1, ".1" 0.1, ".01" 0.01, "10^-3" 0.001, \
9694                      "10^-4" 0.0001)
9695       set mytics 10
9696 @end example
9697
9698 Major tics with special formatting, minor tics at log positions
9699
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.
9703
9704 @node my2tics, mytics, mxtics, set-show
9705 @subsection my2tics
9706
9707 @c ?commands set my2tics
9708 @c ?commands unset my2tics
9709 @c ?commands show my2tics
9710 @c ?set my2tics
9711 @c ?unset my2tics
9712 @c ?show my2tics
9713 @cindex my2tics
9714 @opindex my2tics
9715
9716
9717 @cindex nomy2tics
9718
9719 Minor tic marks along the y2 (right-hand) axis are controlled by @ref{my2tics}.  Please see @ref{mxtics}.
9720
9721 @node mytics, mztics, my2tics, set-show
9722 @subsection mytics
9723
9724 @c ?commands set mytics
9725 @c ?commands unset mytics
9726 @c ?commands show mytics
9727 @c ?set mytics
9728 @c ?unset mytics
9729 @c ?show mytics
9730 @cindex mytics
9731 @opindex mytics
9732
9733
9734 @cindex nomytics
9735
9736 Minor tic marks along the y axis are controlled by @ref{mytics}.  Please
9737 see @ref{mxtics}.
9738
9739 @node mztics, offsets, mytics, set-show
9740 @subsection mztics
9741
9742 @c ?commands set mztics
9743 @c ?commands unset mztics
9744 @c ?commands show mztics
9745 @c ?set mztics
9746 @c ?unset mztics
9747 @c ?show mztics
9748 @cindex mztics
9749 @opindex mztics
9750
9751
9752 @cindex nomztics
9753
9754 Minor tic marks along the z axis are controlled by @ref{mztics}.  Please
9755 see @ref{mxtics}.
9756
9757 @node offsets, origin, mztics, set-show
9758 @subsection offsets
9759
9760 @c ?commands set offsets
9761 @c ?commands unset offsets
9762 @c ?commands show offsets
9763 @c ?set offsets
9764 @c ?unset offsets
9765 @c ?show offsets
9766 @cindex offsets
9767 @opindex offsets
9768
9769
9770 @cindex nooffsets
9771
9772 Offsets provide a mechanism to put a boundary around the data inside of an
9773 autoscaled graph.
9774
9775 Syntax:
9776 @example
9777       set offsets <left>, <right>, <top>, <bottom>
9778       unset offsets
9779       show offsets
9780
9781 @end example
9782
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
9788 and clipping.
9789
9790 Offsets are ignored in `splot`s.
9791
9792 Example:
9793 @example
9794       set offsets 0, 0, 2, 2
9795       plot sin(x)
9796
9797 @end example
9798
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.
9801
9802 @node origin, output, offsets, set-show
9803 @subsection origin
9804
9805 @c ?commands set origin
9806 @c ?commands show origin
9807 @c ?set origin
9808 @c ?show origin
9809 @cindex origin
9810 @opindex origin
9811
9812
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
9816 this system).
9817
9818 Syntax:
9819 @example
9820       set origin <x-origin>,<y-origin>
9821
9822 @end example
9823
9824 @node output, parametric_, origin, set-show
9825 @subsection output
9826
9827 @c ?commands set output
9828 @c ?commands show output
9829 @c ?set output
9830 @c ?show output
9831 @cindex output
9832 @opindex output
9833
9834
9835 @c ?output file
9836 By default, screens are displayed to the standard output. The @ref{output}
9837 command redirects the display to the specified file or device.
9838
9839 Syntax:
9840 @example
9841       set output @{"<filename>"@}
9842       show output
9843
9844 @end example
9845
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}.])
9851
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.
9855
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.
9861
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 '|'.
9864 For instance,
9865
9866 @example
9867       set output "|lpr -Plaser filename"
9868       set output "|lp -dlaser filename"
9869
9870 @end example
9871
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
9875 some flexibility.
9876
9877 @node parametric_, plot_, output, set-show
9878 @subsection parametric
9879
9880 @c ?commands set parametric
9881 @c ?commands unset parametric
9882 @c ?commands show parametric
9883 @c ?set parametric
9884 @c ?unset parametric
9885 @c ?show parametric
9886 @cindex parametric
9887 @opindex parametric
9888
9889
9890 @cindex noparametric
9891
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.
9895
9896 Syntax:
9897 @example
9898       set parametric
9899       unset parametric
9900       show parametric
9901
9902 @end example
9903
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`.
9909
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`.
9915
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
9921 f(x,y).
9922
9923 Note that the order the parametric functions are specified is xfunction,
9924 yfunction (and zfunction) and that each operates over the common parametric
9925 domain.
9926
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.
9934
9935 @node plot_, pm3d, parametric_, set-show
9936 @subsection plot
9937
9938 @c ?commands show plot
9939 @c ?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.
9942
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.
9946
9947 @node pm3d, palette, plot_, set-show
9948 @subsection pm3d
9949
9950 @c ?commands set pm3d
9951 @c ?commands show pm3d
9952 @c ?set pm3d
9953 @c ?show pm3d
9954 @cindex pm3d
9955 @opindex pm3d
9956
9957
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.
9962
9963 Drawing of color surfaces is available on terminals supporting filled colored
9964 polygons with color mapping specified by @ref{palette}. Currently supported
9965 terminals include
9966
9967 @example
9968   Screen terminals:
9969     OS/2 Presentation Manager
9970     X11
9971     Linux VGA (vgagl)
9972     GGI
9973     Windows
9974     AquaTerm (Mac OS X)
9975     wxWidgets (wxt)
9976   Files:
9977     PostScript
9978     pslatex, pstex, epslatex
9979     gif, png, jpeg
9980     (x)fig
9981     tgif
9982     cgm
9983     pdf
9984     svg
9985     emf
9986
9987 @end example
9988
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.
10002
10003 Surface coloring works with the following input data:
10004
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.
10012
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.
10017
10018 Other notes:
10019
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.
10023
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}.
10029
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`.
10032
10033 Syntax (the options can be given in any order):
10034 @example
10035       set pm3d @{
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 @}
10045                  @{ map @}
10046                @}
10047       show pm3d
10048       unset pm3d
10049
10050 @end example
10051
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
10055 details.
10056
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.
10062
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
10072 details.
10073
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`.
10080
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.
10085
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.
10090
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.
10107
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.
10112
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
10116 `set colorbox`.
10117
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
10125 @example
10126       set pm3d at s hidden3d 100
10127       set style line 100 lt 5 lw 0.5
10128       unset hidden3d
10129       unset surf
10130       splot x*x+y*y
10131
10132 @end example
10133
10134 There used to be an option @{transparent|solid@} to this command.  Now
10135 you get the same effect from `set grid @{front|layerdefault@}`,
10136 respectively.
10137
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.
10144
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
10150 with functions.
10151
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.
10157
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.
10162
10163 If the option `implicit` is on, all surface plots will be plotted additionally
10164 to the default type, e.g.
10165 @example
10166       splot 'fred.dat' with lines, 'lola.dat' with lines
10167 @end example
10168
10169 would give both plots (meshes) additionally to a pm3d surface. That's what you
10170 are used to after `set pm3d;`.
10171
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.:
10174 @example
10175       splot 'fred.dat' with lines, 'lola.dat' with pm3d
10176 @end example
10177
10178 would plot 'fred.dat' with lines (and only lines) and 'lola.dat' with
10179 a pm3d surface.
10180
10181 If you set the default data or function style to @ref{pm3d}, e.g.:
10182 @example
10183       set style data pm3d
10184 @end example
10185
10186 then the options `implicit` and `explicit` have no effect.
10187
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.
10191
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
10194 altitudes:
10195 @example
10196       set border 4095
10197       set pm3d at s
10198       splot 10*x with pm3d at b, x*x-y*y, x*x+y*y with pm3d at t
10199
10200 @end example
10201
10202 See also help for @ref{palette}, @ref{cbrange}, `set colorbox`, @ref{pm3d}
10203 and definitely the demo file `demo/pm3d.dem`.
10204
10205 @menu
10206 * depthorder::                  
10207 @end menu
10208
10209 @node depthorder,  , pm3d, pm3d
10210 @subsubsection depthorder
10211
10212 @c ?commands set pm3d depthorder
10213 @c ?set pm3d depthorder
10214 @c ?pm3d depthorder
10215 @cindex depthorder
10216
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.
10221
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
10225 @example
10226       set pm3d depthorder hidden3d
10227 @end example
10228
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.
10232
10233 @node palette, pointsize, pm3d, set-show
10234 @subsection palette
10235
10236 @c ?commands set palette
10237 @c ?commands show palette
10238 @c ?set palette
10239 @c ?show palette
10240 @cindex palette
10241 @opindex palette
10242
10243
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.
10248
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`.
10254
10255 Syntax:
10256 @example
10257       set palette
10258       set palette @{
10259                  @{ gray | color @}
10260                  @{ gamma <gamma> @}
10261                  @{   rgbformulae <r>,<g>,<b>
10262                    | defined @{ ( <gray1> <color1> @{, <grayN> <colorN>@}... ) @}
10263                    | file '<filename>' @{datafile-modifiers@}
10264                    | functions <R>,<G>,<B>
10265                  @}
10266                  @{ model @{ RGB | HSV | CMY | YIQ | XYZ @} @}
10267                  @{ positive | negative @}
10268                  @{ nops_allcF | ps_allcF @}
10269                  @{ maxcolors <maxcolors> @}
10270                @}
10271       show palette
10272       show palette palette <n> @{@{float | int@}@}
10273       show palette gradient
10274       show palette fit2rgbformulae
10275       show palette rgbformulae
10276       show palette colornames
10277
10278 @end example
10279
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.
10283
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.
10288
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.
10296
10297 The following options determine the coloring properties.
10298
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]).
10305
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.
10310
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
10316 }
10317 @example
10318  ).
10319
10320 @end example
10321
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.
10326
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.
10330
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
10339 mapping to RGB.
10340
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`
10347 accordingly).
10348
10349 All values for all color spaces are limited to [0,1].
10350
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
10359 }
10360 and
10361 @uref{http://cs.fit.edu/wds/classes/cse5255/cse5255/davis/index.html,http://cs.fit.edu/wds/classes/cse5255/cse5255/davis/index.html
10362 }
10363
10364
10365 @menu
10366 * rgbformulae::                 
10367 * defined_::                    
10368 * functions_::                  
10369 * file::                        
10370 * gamma_correction::            
10371 * postscript::                  
10372 * colornames::                  
10373 @end menu
10374
10375 @node rgbformulae, defined_, palette, palette
10376 @subsubsection rgbformulae
10377
10378 @c ?commands set palette rgbformulae
10379 @c ?set palette rgbformulae
10380 @c ?palette rgbformulae
10381 @cindex rgbformulae
10382
10383 @cindex colors
10384
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).
10391
10392 Some nice schemes in RGB color space
10393 @example
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)
10401
10402 @end example
10403
10404 A full color palette in HSV color space
10405 @example
10406    3,2,2    ... red-yellow-green-cyan-blue-magenta-red
10407
10408 @end example
10409
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.
10412
10413 Use `positive` and `negative` to invert the figure colors.
10414 @c ^ <a name="positive"></a>
10415 @c ^ <a name="negative"></a>
10416
10417 Note that it is possible to find a set of the best matching rgbformulae for any
10418 other color scheme by the command
10419 @example
10420    show palette fit2rgbformulae
10421
10422 @end example
10423
10424 @node defined_, functions_, rgbformulae, palette
10425 @subsubsection defined
10426
10427 @c ?commands set palette defined
10428 @c ?set palette defined
10429 @c ?palette defined
10430 @cindex colors
10431
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:
10437
10438 Syntax:
10439 @example
10440       set palette  defined @{ ( <gray1> <color1> @{, <grayN> <colorN>@}... ) @}
10441
10442 @end example
10443
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
10446 ways:
10447
10448 @example
10449      <color> :=  @{ <r> <g> <b> | '<color-name>' | '#rrggbb' @}
10450
10451 @end example
10452
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
10458 names.
10459
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.
10463
10464 The <gray> values have to form an ascending sequence of real numbers; the
10465 sequence will be automatically rescaled to [0,1].
10466
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.
10470
10471 Examples:
10472
10473 To produce a gray palette (useless but instructive) use:
10474 @example
10475       set palette model RGB
10476       set palette defined ( 0 "black", 1 "white" )
10477
10478 @end example
10479
10480 To produce a blue yellow red palette use (all equivalent):
10481 @example
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" )
10485
10486 @end example
10487
10488 To produce some rainbow-like palette use:
10489 @example
10490       set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )
10491
10492 @end example
10493
10494 Full color spectrum within HSV color space:
10495 @example
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)
10499
10500 @end example
10501
10502 To produce a palette with few colors only use:
10503 @example
10504       set palette model RGB maxcolors 4
10505       set palette defined ( 0 "blue", 1 "green", 2 "yellow", 3 "red" )
10506
10507 @end example
10508
10509 'Traffic light' palette (non-smooth color jumps at gray = 1/3 and 2/3).
10510 @example
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" )
10514
10515 @end example
10516
10517
10518 @node functions_, file, defined_, palette
10519 @subsubsection functions
10520
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).
10530
10531 Examples:
10532
10533 To produce a full color palette use:
10534 @example
10535       set palette model HSV functions gray, 1, 1
10536
10537 @end example
10538
10539 A nice black to gold palette:
10540 @example
10541       set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8
10542
10543 @end example
10544
10545 A gamma-corrected black and white palette
10546 @example
10547       gamma = 2.2
10548       color(gray) = gray**(1./gamma)
10549       set palette model RGB functions color(gray), color(gray), color(gray)
10550
10551 @end example
10552
10553
10554 @node file, gamma_correction, functions_, palette
10555 @subsubsection file
10556
10557 @c ?commands set palette file
10558 @c ?set palette file
10559 @c ?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
10567 selected.
10568
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.
10571
10572 Use `show palette gradient` to display the gradient.
10573
10574 Examples:
10575
10576 Read in a palette of RGB triples each in range [0,255]:
10577 @example
10578       set palette file 'some-palette' using ($1/255):($2/255):($3/255)
10579
10580 @end example
10581
10582 Equidistant rainbow (blue-green-yellow-red) palette:
10583 @example
10584       set palette model RGB file "-"
10585       0 0 1
10586       0 1 0
10587       1 1 0
10588       1 0 0
10589       e
10590
10591 @end example
10592
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
10595 @example
10596       set palette file "palette.bin" binary record=64 using 1:2:3
10597
10598 @end example
10599
10600
10601
10602 @node gamma_correction, postscript, file, palette
10603 @subsubsection gamma correction
10604
10605 @c ?commands set palette gamma-correction
10606 @c ?set palette gamma-correction
10607 @c ?palette gamma-correction
10608 @cindex gamma-correction
10609
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
10612 terminals.
10613
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
10618
10619 Example:
10620 @example
10621       set palette model RGB
10622       set palette functions gray**0.64, gray**0.67, gray**0.70
10623
10624 @end example
10625
10626 To use gamma correction with interpolated gradients specify intermediate
10627 gray values with appropriate colors.  Instead of
10628
10629 @example
10630       set palette defined ( 0 0 0 0, 1 1 1 1 )
10631
10632 @end example
10633
10634 use e.g.
10635
10636 @example
10637       set palette defined ( 0 0 0 0, 0.5 .73 .73 .73, 1 1 1 1 )
10638
10639 @end example
10640
10641 or even more intermediate points until the linear interpolation fits the
10642 "gamma corrected" interpolation well enough.
10643
10644
10645 @node postscript, colornames, gamma_correction, palette
10646 @subsubsection postscript
10647
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}.
10662
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:
10669 @example
10670     awk -f pm3dCompress.awk thefile.ps >smallerfile.ps
10671
10672 @end example
10673
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:
10677 @example
10678     awk -f pm3dConvertToImage.awk <thefile.ps >smallerfile.ps
10679
10680 @end example
10681
10682 You may manually change the postscript output from gray to color and vice
10683 versa and change the definition of <maxcolors>.
10684
10685 @node colornames,  , postscript, palette
10686 @subsubsection colornames
10687
10688 @cindex colornames
10689
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`.
10697
10698 @node pointsize, polar, palette, set-show
10699 @subsection pointsize
10700
10701 @c ?commands set pointsize
10702 @c ?commands show pointsize
10703 @c ?set pointsize
10704 @c ?show pointsize
10705 @cindex pointsize
10706 @opindex pointsize
10707
10708
10709 The @ref{pointsize} command scales the size of the points used in plots.
10710
10711 Syntax:
10712 @example
10713       set pointsize <multiplier>
10714       show pointsize
10715
10716 @end example
10717
10718 The default is a multiplier of 1.0.  Larger pointsizes may be useful to
10719 make points more visible in bitmapped graphics.
10720
10721 The pointsize of a single plot may be changed on the `plot` command.
10722 See @ref{with} for details.
10723
10724 Please note that the pointsize setting is not supported by all terminal
10725 types.
10726
10727 @node polar, print_, pointsize, set-show
10728 @subsection polar
10729
10730 @c ?commands set polar
10731 @c ?commands unset polar
10732 @c ?commands show polar
10733 @c ?set polar
10734 @c ?unset polar
10735 @c ?show polar
10736 @cindex polar
10737 @opindex polar
10738
10739
10740 @cindex nopolar
10741
10742 The `set polar` command changes the meaning of the plot from rectangular
10743 coordinates to polar coordinates.
10744
10745 Syntax:
10746 @example
10747       set polar
10748       unset polar
10749       show polar
10750
10751 @end example
10752
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.
10763
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
10766 @ref{angles}).
10767
10768 The command `unset polar` changes the meaning of the plot back to the default
10769 rectangular coordinate system.
10770
10771 The `set polar` command is not supported for `splot`s.  See the @ref{mapping}
10772 command for similar functionality for `splot`s.
10773
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.
10780
10781 Example:
10782 @example
10783       set polar
10784       plot t*sin(t)
10785       plot [-2*pi:2*pi] [-3:3] [-3:3] t*sin(t)
10786
10787 @end example
10788
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
10792 directions.
10793
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.
10796 See also
10797 @uref{http://www.gnuplot.info/demo/polar.html,polar demos (polar.dem)
10798 }
10799 and
10800 @uref{http://www.gnuplot.info/demo/poldat.html,polar data plot (poldat.dem).
10801 }
10802
10803 @node print_, object, polar, set-show
10804 @subsection print
10805
10806 @c ?commands set print
10807 @c ?commands show print
10808 @c ?set print
10809 @c ?show print
10810 The @ref{print} command redirects the output of the @ref{print} command to a file.
10811
10812 Syntax:
10813 @example
10814       set print
10815       set print "-"
10816       set print "<filename>"
10817       set print "<filename>" append
10818       set print "|<shell_command>"
10819
10820 @end example
10821
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.
10826
10827 @node object, rmargin, print_, set-show
10828 @subsection object
10829
10830 @cindex object
10831 @opindex object
10832
10833
10834 @cindex rectangle
10835
10836 @c ?commands set object
10837 @c ?commands show object
10838 @c ?commands set object rectangle
10839 @c ?commands show object rectangle
10840 @c ?set object
10841 @c ?show object
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.
10851
10852 Syntax:
10853 @example
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>@}
10860
10861 @end example
10862
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.
10868
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.
10874
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`.
10880
10881 Examples:
10882 @example
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
10886
10887 @end example
10888
10889 @example
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
10892
10893 @end example
10894
10895 @example
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
10898
10899 @end example
10900
10901 @example
10902     # Return fill and color to the default style but leave vertices unchanged
10903     set object 2 rect default
10904
10905 @end example
10906
10907
10908 @node rmargin, rrange, object, set-show
10909 @subsection rmargin
10910
10911 @c ?commands set rmargin
10912 @c ?set rmargin
10913 @cindex rmargin
10914 @opindex rmargin
10915
10916
10917 The command @ref{rmargin} sets the size of the right margin.
10918 Please see @ref{margin} for details.
10919
10920 @node rrange, samples, rmargin, set-show
10921 @subsection rrange
10922
10923 @c ?commands set rrange
10924 @c ?commands show rrange
10925 @c ?set rrange
10926 @c ?show rrange
10927 @cindex rrange
10928 @opindex rrange
10929
10930
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.
10933
10934 @node samples, size, rrange, set-show
10935 @subsection samples
10936
10937 @c ?commands set samples
10938 @c ?commands show samples
10939 @c ?set samples
10940 @c ?show samples
10941 @cindex samples
10942 @opindex samples
10943
10944
10945 The sampling rate of functions, or for interpolating data, may be changed
10946 by the @ref{samples} command.
10947
10948 Syntax:
10949 @example
10950       set samples <samples_1> @{,<samples_2>@}
10951       show samples
10952
10953 @end example
10954
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.
10960
10961 When a 2-d graph is being done, only the value of <samples_1> is relevant.
10962
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
10968 @ref{isosamples}.
10969
10970 @node size, style, samples, set-show
10971 @subsection size
10972
10973 @c ?commands set size
10974 @c ?commands show size
10975 @c ?set size
10976 @c ?show size
10977 @cindex size
10978 @opindex size
10979
10980
10981 @c ?aspect ratio
10982 Syntax:
10983 @example
10984       set size @{@{no@}square | ratio <r> | noratio@} @{<xscale>,<yscale>@}
10985       show size
10986
10987 @end example
10988
10989 The <xscale> and <yscale> values are scale factors for the size of the plot,
10990 which includes the graph, labels, and margins.
10991
10992 Important note:
10993 @example
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:
10997
10998 @end example
10999
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.
11003
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.
11009
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>.
11013
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.
11018
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).
11023
11024 `square` is a synonym for `ratio 1`.
11025
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
11028 values (1.0).
11029
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.
11033
11034 Examples:
11035
11036 To set the size so that the plot fills the available canvas:
11037 @example
11038       set size 1,1
11039
11040 @end example
11041
11042 To make the graph half size and square use:
11043 @example
11044       set size square 0.5,0.5
11045
11046 @end example
11047
11048 To make the graph twice as high as wide use:
11049 @example
11050       set size ratio 2
11051
11052 @end example
11053
11054 See also
11055 @uref{http://www.gnuplot.info/demo/airfoil.html,airfoil demo.
11056 }
11057
11058 @node style, surface, size, set-show
11059 @subsection style
11060
11061 @c ?set style
11062 @c ?show style
11063 @c ?unset style
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.
11069
11070 Syntax:
11071 @example
11072       set style function <style>
11073       set style data <style>
11074       show style function
11075       show style data
11076
11077 @end example
11078
11079 Default styles for specific plotting elements may also be set.
11080
11081 Syntax:
11082 @example
11083       set style arrow <n> <arrowstyle>
11084       set style fill <fillstyle>
11085       set style histogram <histogram style options>
11086       set style line <n> <linestyle>
11087
11088 @end example
11089
11090
11091 @menu
11092 * set_style_arrow::             
11093 * set_style_data::              
11094 * set_style_fill::              
11095 * set_style_function::          
11096 * set_style_increment::         
11097 * set_style_line::              
11098 * plotting_styles::             
11099 * set_style_rectangle::         
11100 @end menu
11101
11102 @node set_style_arrow, set_style_data, style, style
11103 @subsubsection set style arrow
11104
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
11111 @cindex arrowstyle
11112
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.
11119
11120 Syntax:
11121 @example
11122       set style arrow <index> default
11123       set style arrow <index> @{nohead | head | heads@}
11124                               @{size <length>,<angle>@{,<backangle>@}@}
11125                               @{filled | empty | nofilled@}
11126                               @{front | back@}
11127                               @{ @{linestyle | ls <line_style>@}
11128                                 | @{linetype | lt <line_type>@}
11129                                   @{linewidth | lw <line_width@} @}
11130       unset style arrow
11131       show style arrow
11132
11133 @end example
11134
11135 <index> is an integer that identifies the arrowstyle.
11136
11137 If `default` is given all arrow style parameters are set to their default
11138 values.
11139
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.
11143
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
11147 ends of the line.
11148
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.
11161
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`.
11169
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).
11174
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`.
11178
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.
11182
11183 Examples:
11184
11185 To draw an arrow without an arrow head and double width, use:
11186 @example
11187       set style arrow 1 nohead lw 2
11188       set arrow arrowstyle 1
11189
11190 @end example
11191
11192 @example
11193  See also @ref{arrow} for further examples.
11194
11195 @end example
11196
11197
11198 @node set_style_data, set_style_fill, set_style_arrow, style
11199 @subsubsection set style data
11200
11201 @c ?commands set style data
11202 @c ?commands show style data
11203 @c ?set style data
11204 @c ?show style data
11205 @c ?data style
11206 The `set style data` command changes the default plotting style for data
11207 plots.
11208
11209 Syntax:
11210 @example
11211       set style data <plotting-style>
11212       show style data
11213
11214 @end example
11215
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.
11218
11219 @node set_style_fill, set_style_function, set_style_data, style
11220 @subsubsection set style fill
11221
11222 @c ?commands set style fill
11223 @c ?commands show style fill
11224 @c ?set style fill
11225 @c ?show style fill
11226 @cindex fillstyle
11227
11228 The `set style fill` command is used to set the style of boxes,
11229 histograms, candlesticks and filledcurves.
11230
11231 Syntax:
11232 @example
11233       set style fill @{empty | solid @{<density>@} | pattern @{<n>@}@}
11234                      @{border @{<linetype>@} | noborder@}
11235
11236 @end example
11237
11238 The default fillstyle is `empty`.
11239
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,
11246 it defaults to 1.
11247
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.
11253
11254 The `empty` option causes filled boxes not to be filled. This is the default.
11255
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.
11259
11260 @node set_style_function, set_style_increment, set_style_fill, style
11261 @subsubsection set style function
11262
11263 @c ?commands set style function
11264 @c ?commands show style function
11265 @c ?set style function
11266 @c ?show style function
11267 @c ?function style
11268 The `set style function` command changes the default plotting style for
11269 function plots.
11270
11271 Syntax:
11272 @example
11273       set style function <plotting-style>
11274       show style function
11275
11276 @end example
11277
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
11280 style.
11281
11282 @node set_style_increment, set_style_line, set_style_function, style
11283 @subsubsection set style increment
11284
11285 @c ?commands set style increment
11286 @c ?commands show style increment
11287 @c ?set style increment
11288 @c ?show style increment
11289 Syntax:
11290 @example
11291       set style increment @{default|userstyles@}
11292       show style increment
11293
11294 @end example
11295
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.
11300
11301 Example:
11302
11303 @example
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
11308
11309 @end example
11310
11311 @example
11312       plot f1(x), f2(x), f3(x), f4(x)
11313
11314 @end example
11315
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.
11320
11321
11322 @node set_style_line, plotting_styles, set_style_increment, style
11323 @subsubsection set style line
11324
11325 @c ?commands set style line
11326 @c ?commands unset style line
11327 @c ?commands show style line
11328 @c ?set style line
11329 @c ?unset style line
11330 @c ?show style line
11331 @cindex linestyle
11332
11333 @cindex linewidth
11334
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.
11339
11340 Syntax:
11341 @example
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>@}
11348                              @{palette@}
11349       unset style line
11350       show style line
11351
11352 @end example
11353
11354 If `default` is given all line style parameters are set to their default
11355 values.
11356
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.
11360
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}).
11365
11366 The defaults for the line and point types is the index.  The defaults for
11367 the width and size are both unity.
11368
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`.
11372
11373 Not all terminals support the `linewidth` and @ref{pointsize} features; if
11374 not supported, the option will be ignored.
11375
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}.
11382
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.
11387
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.
11391
11392 Examples:
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
11396
11397 @example
11398       set style line 1 lt 2 lw 2 pt 3 ps 0.5
11399
11400 @end example
11401
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
11404
11405 @example
11406       set style function lines
11407       plot f(x) lt 3, g(x) ls 1
11408
11409 @end example
11410
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
11413
11414 @example
11415       set style function linespoints
11416       plot p(x) lt 1 pt 3, q(x) ls 1
11417
11418 @end example
11419
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.
11422
11423 @example
11424       splot sin(sqrt(x*x+y*y))/sqrt(x*x+y*y) w l pal
11425
11426 @end example
11427
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}.
11430
11431 @example
11432       set style line 10 linetype 1 linecolor rgb "cyan"
11433
11434 @end example
11435
11436 will assign linestyle 10 to be a solid cyan line on any terminal that
11437 supports rgb colors.
11438
11439
11440 @node plotting_styles, set_style_rectangle, set_style_line, style
11441 @subsubsection plotting styles
11442
11443 @c ?plotting styles
11444
11445 The commands `set style data` and `set style function` change the
11446 default plotting style for subsequent `plot` and `splot` commands.
11447
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.
11453
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`.
11459
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`.
11463
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.)
11469
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.
11475
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`.
11480
11481 Five-column data allow only the `boxerrorbars`, `financebars`, and
11482 `candlesticks` styles.  An illegal style will be changed to `boxerrorbars`
11483 before plotting.
11484
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.
11488
11489 For more information about error bars with and without lines,
11490 please see @ref{errorlines} and @ref{errorbars}.
11491
11492
11493 @node set_style_rectangle,  , plotting_styles, style
11494 @subsubsection set style rectangle
11495
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
11502
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.
11506
11507 Syntax:
11508 @example
11509     set style rectangle @{front|back@} @{fillcolor <colorspec>@} @{fs <fillstyle>@}
11510                         @{lw|linewidth <lw>@}
11511
11512 @end example
11513
11514 See @ref{colorspec} and `fillstyle`.  `fillcolor` may be abbreviated as `fc`.
11515
11516 Examples:
11517 @example
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
11520
11521 @end example
11522
11523 The default values correspond to solid fill with the background color and a
11524 black border.
11525
11526
11527
11528 @noindent --- BOXERRORBARS ---
11529
11530 @c ?commands set style boxerrorbars
11531 @c ?set style boxerrorbars
11532 @c ?plotting styles boxerrorbars
11533 @c ?style boxerrorbars
11534 @cindex boxerrorbars
11535
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.
11545
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.
11549 See also
11550 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
11551 }
11552
11553
11554 @noindent --- BOXES ---
11555
11556 @c ?commands set style boxes
11557 @c ?set style boxes
11558 @c ?plotting styles boxes
11559 @c ?style boxes
11560 @cindex boxes
11561
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
11568 adjacent boxes.
11569
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.
11573
11574 For fillstyle `empty` the box is filled with the background color.
11575
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).
11580
11581 For fillstyle `pattern` the box is filled in the current drawing color with
11582 a pattern, if supported by the terminal driver.
11583
11584 Examples:
11585
11586 To plot a data file with solid filled boxes with a small vertical space
11587 separating them (bargraph):
11588
11589 @example
11590       set boxwidth 0.9 relative
11591       set style fill solid 1.0
11592       plot 'file.dat' with boxes
11593
11594 @end example
11595
11596 To plot a sine and a cosine curve in pattern-filled boxes style:
11597
11598 @example
11599       set style fill pattern
11600       plot sin(x) with boxes, cos(x) with boxes
11601
11602 @end example
11603
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
11606 terminal driver.
11607
11608 To specify explicit fillstyles for each dataset:
11609
11610 @example
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
11616
11617 @end example
11618
11619 Currently only the following terminal drivers support fillstyles other
11620 than `empty`:
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.
11624
11625
11626 @noindent --- BOXXYERRORBARS ---
11627
11628 @c ?commands set style boxxyerrorbars
11629 @c ?set style boxxyerrorbars
11630 @c ?plotting styles boxxyerrorbars
11631 @c ?style boxxyerrorbars
11632 @cindex boxxyerrorbars
11633
11634 The `boxxyerrorbars` style is only relevant to 2-d data plotting.  It is a
11635 combination of the `boxes` and `xyerrorbars` styles.
11636
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.
11641
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.
11645
11646
11647 @noindent --- CANDLESTICKS ---
11648
11649 @c ?commands set style candlesticks
11650 @c ?set style candlesticks
11651 @c ?plotting styles candlesticks
11652 @c ?style candlesticks
11653 @cindex candlesticks
11654
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.
11664
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>`.
11669
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.
11675
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
11681 }
11682 .
11683
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:
11686
11687 @example
11688   # Data columns: X Min 1stQuartile Median 3rdQuartile Max
11689   set bars 4.0
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
11693
11694 @end example
11695
11696 @example
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
11699
11700 @end example
11701
11702 @example
11703  See @ref{boxwidth}, @ref{bars} and `set style fill`.
11704
11705 @end example
11706
11707
11708 @noindent --- DOTS ---
11709
11710 @c ?commands set style dots
11711 @c ?set style dots
11712 @c ?plotting styles dots
11713 @c ?style dots
11714 @cindex dots
11715
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.
11719
11720
11721 @noindent --- FILLEDCURVES ---
11722
11723 @c ?commands set style filledcurves
11724 @c ?set style filledcurves
11725 @c ?plotting styles filledcurves
11726 @c ?style filledcurves
11727 @cindex filledcurves
11728
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.
11734
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.
11737
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.
11742
11743 Syntax:
11744
11745 @example
11746     set style [data | function] filledcurves [option]
11747     plot ... with filledcurves [option]
11748
11749 @end example
11750
11751 where the option can be
11752
11753 @example
11754     [closed | @{above | below@} @{x1 | x2 | y1 | y2@}[=<a>] | xy=<x>,<y>]
11755
11756 @end example
11757
11758 The first two plot variants can be further modified by the options
11759
11760 @example
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).
11767
11768 @end example
11769
11770 Example of filling the area between two input curves.
11771 @uref{http://www.gnuplot.info/demo/fillbetween.html,fill between curves demo.
11772 }
11773
11774 @example
11775     plot 'data' using 1:2:3 with filledcurves
11776
11777 @end example
11778
11779 The `above` and `below` options apply both to commands of the form
11780 @example
11781     ... filledcurves above @{x1|x2|y1|y2@}=<val>
11782 @end example
11783
11784 and to commands of the form
11785 @example
11786     ... using 1:2:3 with filledcurves below
11787 @end example
11788
11789 In either case the option limits the filled area to one side of the bounding
11790 line or curve.
11791
11792 Note: Not all terminal types support this plotting mode.
11793
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.
11796
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.
11800
11801
11802 @noindent --- FINANCEBARS ---
11803
11804 @c ?commands set style financebars
11805 @c ?set style financebars
11806 @c ?plotting styles financebars
11807 @c ?style financebars
11808 @cindex financebars
11809
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.
11820 }
11821
11822
11823 @noindent --- FSTEPS ---
11824
11825 @c ?commands set style fsteps
11826 @c ?set style fsteps
11827 @c ?plotting styles fsteps
11828 @c ?style fsteps
11829 @cindex fsteps
11830
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).
11834 See also
11835 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
11836 }
11837
11838
11839 @noindent --- HISTEPS ---
11840
11841 @c ?commands set style histeps
11842 @c ?set style histeps
11843 @c ?plotting styles histeps
11844 @c ?style histeps
11845 @cindex histeps
11846
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).
11853
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.
11856 See also
11857 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
11858 }
11859
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.
11862
11863
11864 @noindent --- HISTOGRAMS ---
11865
11866 @c ?commands set style histogram
11867 @c ?set style histogram
11868 @c ?style histograms
11869 @c ?plotting styles histograms
11870 @cindex histograms
11871
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.
11877
11878 @example
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
11883
11884 @end example
11885
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`).
11897
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}.
11902
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>
11909 specification.
11910
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`.
11917
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`).
11926
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.
11933
11934 Box widths may be modified using the @ref{boxwidth} command.
11935 Box fill styles may be set using the `set style fill` command.
11936
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.
11940
11941 Examples:
11942
11943 To plot a data file containing multiple columns of data as a histogram
11944 of clustered boxes (the default style):
11945
11946 @example
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
11951
11952 @end example
11953
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
11957
11958 @example
11959       plot 'file.dat' using 2, '' using 4, '' using 6:xticlabels(1)
11960
11961 @end example
11962
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.
11968
11969 @example
11970       set bars fullwidth
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)
11974
11975 @end example
11976
11977 To plot the same data as a rowstacked histogram:
11978
11979 @example
11980       set style histogram rows
11981       plot 'file.dat' using 2, '' using 4, '' using 6:xtic(1)
11982
11983 @end example
11984
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
11987 of the datafile.
11988
11989 Finally, the commands
11990
11991 @example
11992       set style histogram columnstacked
11993       plot 'file.dat' using 2, '' using 4, '' using 6
11994
11995 @end example
11996
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.
12003
12004 @example
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
12008
12009 @end example
12010
12011
12012 @noindent --- NEWHISTOGRAM ---
12013
12014 @cindex newhistogram
12015
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>@}`.
12020 For example
12021
12022 @example
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
12026
12027 @end example
12028
12029 The labels "Set A" and "Set B" will appear beneath the respective sets of
12030 histograms, under the overall x axis label.
12031
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
12036 @example
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
12039
12040 @end example
12041
12042 The `at <x-coord>` option only applies to column-stacked histograms.
12043
12044
12045 @noindent --- IMAGE ---
12046
12047 @c ?commands set style image
12048 @c ?set style image
12049 @c ?plotting styles image
12050 @c ?style image
12051 @cindex image
12052
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.
12061
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.
12069
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.
12075
12076 Here are some specific comments about particular terminal drivers:
12077
12078 x11 and wxt - Pixels are either repeated or decimated to fit the display
12079 @example
12080       resolution; no other processing (filtering) is done.  Thus, aliasing may
12081       occur when decimating images having high spatial frequency content.
12082
12083 @end example
12084
12085 postscript (pslatex, epslatex, pstex) - Image is copied in its original
12086 @example
12087       resolution, and sample interpolation is turned off.
12088
12089 @end example
12090
12091 See also `rgbimage`.
12092
12093
12094 @noindent --- IMPULSES ---
12095
12096 @c ?commands set style impulses
12097 @c ?set style impulses
12098 @c ?plotting styles impulses
12099 @c ?style impulses
12100 @cindex impulses
12101
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.
12104
12105
12106 @noindent --- LABELS ---
12107
12108 @c ?commands set style labels
12109 @c ?set style labels
12110 @c ?plotting styles labels
12111 @c ?style labels
12112 @cindex labels
12113
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).
12122
12123 @example
12124   plot 'datafile' using 1:(0.5 * $2):4 with labels font "arial,11" tc lt 2
12125
12126 @end example
12127
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.
12130
12131 @example
12132   splot 'datafile' using 1:2:3:4 with labels
12133
12134 @end example
12135
12136 See also `datastrings`, `set style data`.
12137
12138
12139 @noindent --- LINES ---
12140
12141 @c ?commands set style lines
12142 @c ?set style lines
12143 @c ?plotting styles lines
12144 @c ?style lines
12145 @cindex lines
12146
12147 The `lines` style connects adjacent points with straight line segments.
12148 See also `linetype`, `linewidth`, and `linestyle`.
12149
12150
12151 @noindent --- LINESPOINTS ---
12152
12153 @c ?commands set style linespoints
12154 @c ?commands set style lp
12155 @c ?set style linespoints
12156 @c ?plotting styles linespoints
12157 @c ?set style lp
12158 @c ?style linespoints
12159 @c ?style lp
12160 @cindex linespoints
12161
12162 @cindex lp
12163
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.
12168
12169 `linespoints` may be abbreviated `lp`.
12170
12171
12172 @noindent --- POINTS ---
12173
12174 @c ?commands set style points
12175 @c ?set style points
12176 @c ?plotting styles points
12177 @c ?style points
12178 @cindex points
12179
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}
12181 for its usage.
12182
12183
12184 @noindent --- STEPS ---
12185
12186 @c ?commands set style steps
12187 @c ?set style steps
12188 @c ?plotting styles steps
12189 @c ?style steps
12190 @cindex steps
12191
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).
12195 See also
12196 @uref{http://www.gnuplot.info/demo/steps.html,steps demo.
12197 }
12198
12199
12200 @noindent --- RGBIMAGE ---
12201
12202 @c ?commands set style rgbimage
12203 @c ?set style rgbimage
12204 @c ?plotting styles rgbimage
12205 @c ?style rgbimage
12206 @cindex rgbimage
12207
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.
12212
12213 See also `image`.
12214
12215
12216 @noindent --- VECTORS ---
12217
12218 @c ?commands set style vectors
12219 @c ?set style vectors
12220 @c ?plotting styles vectors
12221 @c ?style vectors
12222 @cindex vectors
12223
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
12226 end of the vector.
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.
12231
12232 Example:
12233 @example
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
12236
12237 @end example
12238
12239 `set clip one` and `set clip two` affect vectors drawn in 2D.
12240 Please see @ref{clip} and `arrowstyle`.
12241
12242
12243 @noindent --- XERRORBARS ---
12244
12245 @c ?commands set style xerrorbars
12246 @c ?set style xerrorbars
12247 @c ?plotting styles xerrorbars
12248 @c ?style xerrorbars
12249 @cindex xerrorbars
12250
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).
12257
12258
12259 @noindent --- XYERRORBARS ---
12260
12261 @c ?commands set style xyerrorbars
12262 @c ?set style xyerrorbars
12263 @c ?plotting styles xyerrorbars
12264 @c ?style xyerrorbars
12265 @cindex xyerrorbars
12266
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).
12274
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
12278
12279 @example
12280       plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars
12281
12282 @end example
12283
12284
12285 @noindent --- YERRORBARS ---
12286
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
12295 @cindex yerrorbars
12296
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).
12303 See also
12304 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
12305 }
12306
12307
12308 @noindent --- XERRORLINES ---
12309
12310 @c ?commands set style xerrorlines
12311 @c ?set style xerrorlines
12312 @c ?plotting styles xerrorlines
12313 @c ?style xerrorlines
12314 @cindex xerrorlines
12315
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).
12322
12323
12324 @noindent --- XYERRORLINES ---
12325
12326 @c ?commands set style xyerrorlines
12327 @c ?set style xyerrorlines
12328 @c ?plotting styles xyerrorlines
12329 @c ?style xyerrorlines
12330 @cindex xyerrorlines
12331
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).
12340
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
12344
12345 @example
12346       plot 'data' using 1:2:($1-$3):($1+$3):4:5 with xyerrorlines
12347
12348 @end example
12349
12350
12351 @noindent --- YERRORLINES ---
12352
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
12362
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
12369 details).
12370 See also
12371 @uref{http://www.gnuplot.info/demo/mgr.html,errorbar demo.
12372 }
12373
12374 @node surface, table, style, set-show
12375 @subsection surface
12376
12377 @c ?commands set surface
12378 @c ?commands unset surface
12379 @c ?commands show surface
12380 @c ?set surface
12381 @c ?unset surface
12382 @c ?show surface
12383 @cindex surface
12384 @opindex surface
12385
12386
12387 @cindex nosurface
12388
12389 The command @ref{surface} controls the display of surfaces by `splot`.
12390
12391 Syntax:
12392 @example
12393       set surface
12394       unset surface
12395       show surface
12396
12397 @end example
12398
12399 The surface is drawn with the style specified by @ref{with}, or else the
12400 appropriate style, data or function.
12401
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}.
12407
12408 @node table, terminal, surface, set-show
12409 @subsection table
12410
12411 @c ?commands set table
12412 @c ?set table
12413 @cindex table
12414 @opindex table
12415
12416
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}).
12427
12428 Syntax:
12429 @example
12430       set table @{"outfile"@}
12431       plot <whatever>
12432       unset table
12433
12434 @end example
12435
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.
12439
12440 @node terminal, termoption, table, set-show
12441 @subsection terminal
12442
12443 @c ?commands set terminal
12444 @c ?commands show terminal
12445 @c ?set terminal
12446 @c ?set term
12447 @c ?show terminal
12448 @c ?show term
12449 @c ?set terminal push
12450 @c ?set term push
12451 @c ?terminal push
12452 @c ?term push
12453 @cindex push
12454
12455 @c ?set terminal pop
12456 @c ?set term pop
12457 @c ?terminal pop
12458 @c ?term pop
12459 @cindex pop
12460
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.
12464
12465 Syntax:
12466 @example
12467       set terminal @{<terminal-type> | push | pop@}
12468       show terminal
12469
12470 @end example
12471
12472 If <terminal-type> is omitted, `gnuplot` will list the available terminal
12473 types.  <terminal-type> may be abbreviated.
12474
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.
12478
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.
12485
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.
12494
12495 For a complete list of available terminal types, see @ref{terminal}.
12496
12497 @node termoption, tics, terminal, set-show
12498 @subsection termoption
12499
12500 @c ?commands set termoption
12501 @c ?set termoption
12502 @cindex termoption
12503 @opindex termoption
12504
12505
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
12510
12511 @example
12512      set termoption @{no@}enhanced
12513      set termoption font "<fontname>@{,<fontsize>@}"
12514
12515 @end example
12516
12517
12518 @node tics, ticslevel, termoption, set-show
12519 @subsection tics
12520
12521 @c ?commands set tics
12522 @c ?commands unset tics
12523 @c ?commands show tics
12524 @c ?set tics
12525 @c ?unset tics
12526 @c ?show tics
12527 @cindex tics
12528 @opindex tics
12529
12530
12531 Control of the major (labelled) tics on all axes at once is possible with the
12532 `set tics` command.
12533
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
12538 single axis.
12539
12540 Syntax:
12541 @example
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@}
12548       unset tics
12549       show tics
12550
12551 @end example
12552
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.
12555
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.
12559
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.
12566
12567 `mirror` tells `gnuplot` to put unlabelled tics at the same positions on the
12568 opposite border.  `nomirror` does what you think it does.
12569
12570 `in` and `out` change the tic marks to be drawn inwards or outwards.
12571
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`.
12575
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.
12580
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`.
12584
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.
12590
12591 `set tics` with no options restores to place tics inwards. Every other
12592 options are retained.
12593
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.
12597
12598 @node ticslevel, ticscale, tics, set-show
12599 @subsection ticslevel
12600
12601 See @ref{xyplane}.
12602
12603 @node ticscale, timestamp, ticslevel, set-show
12604 @subsection ticscale
12605
12606 @c ?commands set ticscale
12607 @c ?commands show ticscale
12608 @c ?set ticscale
12609 @c ?show ticscale
12610 @cindex ticscale
12611 @opindex ticscale
12612
12613
12614 The @ref{ticscale} command is deprecated, use `set tics scale` instead.
12615
12616 @node timestamp, timefmt, ticscale, set-show
12617 @subsection timestamp
12618
12619 @c ?commands set timestamp
12620 @c ?commands unset timestamp
12621 @c ?commands show timestamp
12622 @c ?set timestamp
12623 @c ?unset timestamp
12624 @c ?show timestamp
12625 @cindex timestamp
12626 @opindex timestamp
12627
12628
12629 @cindex notimestamp
12630
12631 The command @ref{timestamp} places the time and date of the plot in the left
12632 margin.
12633
12634 Syntax:
12635 @example
12636       set timestamp @{"<format>"@} @{top|bottom@} @{@{no@}rotate@}
12637                     @{offset <xoff>@{,<yoff>@}@} @{font "<fontspec>"@}
12638       unset timestamp
12639       show timestamp
12640
12641 @end example
12642
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.
12651
12652 The abbreviation `time` may be used in place of @ref{timestamp}.
12653
12654 Example:
12655 @example
12656       set timestamp "%d/%m/%y %H:%M" offset 80,-2 font "Helvetica"
12657
12658 @end example
12659
12660 See @ref{timefmt} for more information about time format strings.
12661
12662 @node timefmt, title_, timestamp, set-show
12663 @subsection timefmt
12664
12665 @c ?commands set timefmt
12666 @c ?commands show timefmt
12667 @c ?set timefmt
12668 @c ?show timefmt
12669 @cindex timefmt
12670 @opindex timefmt
12671
12672
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.
12675
12676 Syntax:
12677 @example
12678       set timefmt "<format string>"
12679       show timefmt
12680
12681 @end example
12682
12683 The string argument tells `gnuplot` how to read timedata from the datafile.
12684 The valid formats are:
12685
12686
12687 @example
12688       Format       Explanation
12689       %d           day of the month, 1--31
12690       %m           month of the year, 1--12
12691       %y           year, 0--99
12692       %Y           year, 4-digit
12693       %j           day of the year, 1--365
12694       %H           hour, 0--24
12695       %M           minute, 0--60
12696       %s           seconds since the Unix epoch (1970-01-01, 00:00 UTC)
12697       %S           second, 0--60
12698       %b           three-character abbreviation of the name of the month
12699       %B           name of the month
12700
12701 @end example
12702
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.
12708
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".
12712
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.
12717
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
12723 numerical values.)
12724
12725 See also @ref{xdata} and `Time/date` for more information.
12726
12727 Example:
12728 @example
12729       set timefmt "%d/%m/%Y\t%H:%M"
12730 @end example
12731
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.)
12735 See also
12736 @uref{http://www.gnuplot.info/demo/timedat.html,time data demo.
12737 }
12738
12739 @node title_, tmargin, timefmt, set-show
12740 @subsection title
12741
12742 @c ?commands set title
12743 @c ?commands show title
12744 @c ?set title
12745 @c ?show title
12746 @cindex title
12747 @opindex title
12748
12749
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}.
12752
12753 Syntax:
12754 @example
12755       set title @{"<title-text>"@} @{offset <offset>@} @{font "<font>@{,<size>@}"@}
12756                 @{@{textcolor | tc@} @{<colorspec> | default@}@} @{@{no@}enhanced@}
12757       show title
12758
12759 @end example
12760
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.
12768
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.
12771
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
12774 @ref{palette}.
12775
12776 `noenhanced` requests that the title not be processed by the enhanced text
12777 mode parser, even if enhanced text mode is currently active.
12778
12779 @ref{title} with no parameters clears the title.
12780
12781 See `syntax` for details about the processing of backslash sequences and
12782 the distinction between single- and double-quotes.
12783
12784 @node tmargin, trange, title_, set-show
12785 @subsection tmargin
12786
12787 @c ?commands set tmargin
12788 @c ?set tmargin
12789 @cindex tmargin
12790 @opindex tmargin
12791
12792
12793 The command @ref{tmargin} sets the size of the top margin.
12794 Please see @ref{margin} for details.
12795
12796 @node trange, urange, tmargin, set-show
12797 @subsection trange
12798
12799 @c ?commands set trange
12800 @c ?commands show trange
12801 @c ?set trange
12802 @c ?show trange
12803 @cindex trange
12804 @opindex trange
12805
12806
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
12809 details.
12810
12811 @node urange, variables, trange, set-show
12812 @subsection urange
12813
12814 @c ?commands set urange
12815 @c ?commands show urange
12816 @c ?set urange
12817 @c ?show urange
12818 @cindex urange
12819 @opindex urange
12820
12821
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.
12825
12826 @node variables, version, urange, set-show
12827 @subsection variables
12828
12829 @c ?commands show variables
12830 @c ?show variables
12831 The @ref{variables} command lists all user-defined variables and their
12832 values.
12833
12834 Syntax:
12835 @example
12836       show variables @{all@}
12837
12838 @end example
12839
12840 With the optional keyword "all", also the @ref{variables} that
12841 begin with `GPVAL_` are listed.
12842
12843
12844 @node version, view, variables, set-show
12845 @subsection version
12846
12847 @c ?show 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.
12852
12853 Syntax:
12854 @example
12855       show version @{long@}
12856
12857 @end example
12858
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.
12862
12863 @node view, vrange, version, set-show
12864 @subsection view
12865
12866 @c ?commands set view
12867 @c ?commands show view
12868 @c ?set view
12869 @c ?set view map
12870 @c ?set view @{no@}equal @{xy|xyz@}
12871 @c ?show view
12872 @cindex view
12873 @opindex view
12874
12875
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.
12881
12882 Syntax:
12883 @example
12884       set view <rot_x>@{,@{<rot_z>@}@{,@{<scale>@}@{,<scale_z>@}@}@}
12885       set view map
12886       set view @{no@}equal_axes
12887       show view
12888
12889 @end example
12890
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.
12897
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.
12902
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.
12907
12908 Examples:
12909 @example
12910       set view 60, 30, 1, 1
12911       set view ,,0.5
12912
12913 @end example
12914
12915 The first sets all the four default values.  The second changes only scale,
12916 to 0.5.
12917
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.
12924
12925 See also @ref{ticslevel}.
12926
12927 @node vrange, x2data, view, set-show
12928 @subsection vrange
12929
12930 @c ?commands set vrange
12931 @c ?commands show vrange
12932 @c ?set vrange
12933 @c ?show vrange
12934 @cindex vrange
12935 @opindex vrange
12936
12937
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.
12941
12942 @node x2data, x2dtics, vrange, set-show
12943 @subsection x2data
12944
12945 @c ?commands set x2data
12946 @c ?commands show x2data
12947 @c ?set x2data
12948 @c ?show x2data
12949 @cindex x2data
12950 @opindex x2data
12951
12952
12953 The @ref{x2data} command sets data on the x2 (top) axis to timeseries
12954 (dates/times).  Please see @ref{xdata}.
12955
12956 @node x2dtics, x2label, x2data, set-show
12957 @subsection x2dtics
12958
12959 @c ?commands set x2dtics
12960 @c ?commands unset x2dtics
12961 @c ?commands show x2dtics
12962 @c ?set x2dtics
12963 @c ?unset x2dtics
12964 @c ?show x2dtics
12965 @cindex x2dtics
12966 @opindex x2dtics
12967
12968
12969 @cindex nox2dtics
12970
12971 The @ref{x2dtics} command changes tics on the x2 (top) axis to days of the
12972 week.  Please see @ref{xdtics} for details.
12973
12974 @node x2label, x2mtics, x2dtics, set-show
12975 @subsection x2label
12976
12977 @c ?commands set x2label
12978 @c ?commands show x2label
12979 @c ?set x2label
12980 @c ?show x2label
12981 @cindex x2label
12982 @opindex x2label
12983
12984
12985 The @ref{x2label} command sets the label for the x2 (top) axis.
12986 Please see @ref{xlabel}.
12987
12988 @node x2mtics, x2range, x2label, set-show
12989 @subsection x2mtics
12990
12991 @c ?commands set x2mtics
12992 @c ?commands unset x2mtics
12993 @c ?commands show x2mtics
12994 @c ?set x2mtics
12995 @c ?unset x2mtics
12996 @c ?show x2mtics
12997 @cindex x2mtics
12998 @opindex x2mtics
12999
13000
13001 @cindex nox2mtics
13002
13003 The @ref{x2mtics} command changes tics on the x2 (top) axis to months of the
13004 year.  Please see @ref{xmtics} for details.
13005
13006 @node x2range, x2tics, x2mtics, set-show
13007 @subsection x2range
13008
13009 @c ?commands set x2range
13010 @c ?commands show x2range
13011 @c ?set x2range
13012 @c ?show x2range
13013 @cindex x2range
13014 @opindex x2range
13015
13016
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.
13019
13020 @node x2tics, x2zeroaxis, x2range, set-show
13021 @subsection x2tics
13022
13023 @c ?commands set x2tics
13024 @c ?commands unset x2tics
13025 @c ?commands show x2tics
13026 @c ?set x2tics
13027 @c ?unset x2tics
13028 @c ?show x2tics
13029 @cindex x2tics
13030 @opindex x2tics
13031
13032
13033 @cindex nox2tics
13034
13035 The @ref{x2tics} command controls major (labelled) tics on the x2 (top) axis.
13036 Please see `set xtics` for details.
13037
13038 @node x2zeroaxis, xdata, x2tics, set-show
13039 @subsection x2zeroaxis
13040
13041 @c ?commands set x2zeroaxis
13042 @c ?commands unset x2zeroaxis
13043 @c ?commands show x2zeroaxis
13044 @c ?set x2zeroaxis
13045 @c ?unset x2zeroaxis
13046 @c ?show x2zeroaxis
13047 @cindex x2zeroaxis
13048 @opindex x2zeroaxis
13049
13050
13051 @cindex nox2zeroaxis
13052
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}.
13055
13056 @node xdata, xdtics, x2zeroaxis, set-show
13057 @subsection xdata
13058
13059 @c ?commands set xdata
13060 @c ?commands show xdata
13061 @c ?set xdata
13062 @c ?show xdata
13063 @cindex xdata
13064 @opindex xdata
13065
13066
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.
13069
13070 Syntax:
13071 @example
13072       set xdata @{time@}
13073       show xdata
13074
13075 @end example
13076
13077 The same syntax applies to @ref{ydata}, @ref{zdata}, @ref{x2data}, @ref{y2data} and @ref{cbdata}.
13078
13079 The `time` option signals that the datatype is indeed time/date.  If the
13080 option is not specified, the datatype reverts to normal.
13081
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
13087 an expression.
13088
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).
13093
13094 See also `Time/date` for more information.
13095
13096 @node xdtics, xlabel, xdata, set-show
13097 @subsection xdtics
13098
13099 @c ?commands set xdtics
13100 @c ?commands unset xdtics
13101 @c ?commands show xdtics
13102 @c ?set xdtics
13103 @c ?unset xdtics
13104 @c ?show xdtics
13105 @cindex xdtics
13106 @opindex xdtics
13107
13108
13109 @cindex noxdtics
13110
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.
13115
13116 Syntax:
13117 @example
13118       set xdtics
13119       unset xdtics
13120       show xdtics
13121
13122 @end example
13123
13124 The same syntax applies to @ref{ydtics}, @ref{zdtics}, @ref{x2dtics}, @ref{y2dtics} and
13125 @ref{cbdtics}.
13126
13127 See also the `set format` command.
13128
13129 @node xlabel, xmtics, xdtics, set-show
13130 @subsection xlabel
13131
13132 @c ?commands set xlabel
13133 @c ?commands show xlabel
13134 @c ?set xlabel
13135 @c ?show xlabel
13136 @cindex xlabel
13137 @opindex xlabel
13138
13139
13140 The @ref{xlabel} command sets the x axis label.  Similar commands set labels
13141 on the other axes.
13142
13143 Syntax:
13144 @example
13145       set xlabel @{"<label>"@} @{offset <offset>@} @{font "<font>@{,<size>@}"@}
13146                  @{@{textcolor | tc@} @{lt <line_type> | default@}@} @{@{no@}enhanced@}
13147                  @{rotate by <degrees>@}
13148       show xlabel
13149
13150 @end example
13151
13152 The same syntax applies to @ref{x2label}, @ref{ylabel}, @ref{y2label}, @ref{zlabel} and
13153 @ref{cblabel}.
13154
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.
13162
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.
13165
13166 `textcolor lt <n>` sets the text color to that of line type <n>.
13167
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.
13170
13171 To clear a label, put no options on the command line, e.g., "@ref{y2label}".
13172
13173 The default positions of the axis labels are as follows:
13174
13175 xlabel:  The x-axis label is centered below the bottom axis.
13176
13177 ylabel:  The position of the y-axis label depends on the terminal, and can be
13178 one of the following three positions:
13179
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.
13184
13185 2. Vertical text centered vertically at the left of the plot.  Terminals
13186 that can rotate text will probably use this method.
13187
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.
13193
13194 zlabel: The z-axis label is centered along the z axis and placed in the space
13195 above the grid level.
13196
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.
13199
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.
13202
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.,
13206
13207 @example
13208       set title "This is the title\n\nThis is the x2label"
13209
13210 @end example
13211
13212 Note that double quotes must be used.  The same font will be used for both
13213 lines, of course.
13214
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.
13218
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
13220 placed.
13221
13222 Please see `syntax` for further information about backslash processing
13223 and the difference between single- and double-quoted strings.
13224
13225 @node xmtics, xrange, xlabel, set-show
13226 @subsection xmtics
13227
13228 @c ?commands set xmtics
13229 @c ?commands unset xmtics
13230 @c ?commands show xmtics
13231 @c ?set xmtics
13232 @c ?unset xmtics
13233 @c ?show xmtics
13234 @cindex xmtics
13235 @opindex xmtics
13236
13237
13238 @cindex noxmtics
13239
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.
13244
13245 Syntax:
13246 @example
13247       set xmtics
13248       unset xmtics
13249       show xmtics
13250
13251 @end example
13252
13253 The same syntax applies to @ref{x2mtics}, @ref{ymtics}, @ref{y2mtics}, @ref{zmtics} and
13254 @ref{cbmtics}.
13255
13256 See also the `set format` command.
13257
13258 @node xrange, xtics, xmtics, set-show
13259 @subsection xrange
13260
13261 @c ?commands set xrange
13262 @c ?commands show xrange
13263 @c ?set xrange
13264 @c ?show xrange
13265 @cindex writeback
13266
13267 @cindex restore
13268
13269 @cindex xrange
13270 @opindex xrange
13271
13272
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.
13276
13277 Syntax:
13278 @example
13279       set xrange @{ [@{@{<min>@}:@{<max>@}@}] @{@{no@}reverse@} @{@{no@}writeback@} @}
13280                  | restore
13281       show xrange
13282
13283 @end example
13284
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
13288 changed.
13289
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}.
13292
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}.
13297
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,
13304
13305 @example
13306       set xrange [-10:10]
13307       set yrange [] writeback
13308       plot sin(x)
13309       set yrange restore
13310       replot x/2
13311
13312 @end example
13313
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.
13317
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.
13323
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.
13329
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.
13332
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`.
13337
13338 Examples:
13339
13340 To set the xrange to the default:
13341 @example
13342       set xrange [-10:10]
13343
13344 @end example
13345
13346 To set the yrange to increase downwards:
13347 @example
13348       set yrange [10:-10]
13349
13350 @end example
13351
13352 To change zmax to 10 without affecting zmin (which may still be autoscaled):
13353 @example
13354       set zrange [:10]
13355
13356 @end example
13357
13358 To autoscale xmin while leaving xmax unchanged:
13359 @example
13360       set xrange [*:]
13361
13362 @end example
13363
13364 @node xtics, xyplane, xrange, set-show
13365 @subsection xtics
13366
13367 @c ?commands set xtics
13368 @c ?commands unset xtics
13369 @c ?commands show xtics
13370 @c ?set xtics
13371 @c ?unset xtics
13372 @c ?show xtics
13373 @cindex xtics
13374 @opindex xtics
13375
13376
13377 @cindex noxtics
13378
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.
13383
13384 Syntax:
13385 @example
13386       set xtics @{axis | border@} @{@{no@}mirror@}
13387                 @{in | out@} @{scale @{default | <major> @{,<minor>@}@}@}
13388                 @{@{no@}rotate @{by <ang>@}@} @{offset <offset> | nooffset@}
13389                 @{add@}
13390                 @{  autofreq
13391                  | <incr>
13392                  | <start>, <incr> @{,<end>@}
13393                  | (@{"<label>"@} <pos> @{<level>@} @{,@{"<label>"@}...) @}
13394                 @{ format "formatstring" @} @{ font "name@{,<size>@}" @}
13395                 @{ rangelimited @}
13396                 @{ textcolor <colorspec> @}
13397       unset xtics
13398       show xtics
13399
13400 @end example
13401
13402 The same syntax applies to @ref{ytics}, @ref{ztics}, @ref{x2tics}, @ref{y2tics} and @ref{cbtics}.
13403
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.
13409
13410 `mirror` tells `gnuplot` to put unlabelled tics at the same positions on the
13411 opposite border.  `nomirror` does what you think it does.
13412
13413 `in` and `out` change the tic marks to be drawn inwards or outwards.
13414
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`.
13418
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.
13423
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}.
13429
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.
13435
13436 Example:
13437
13438 Move xtics more closely to the plot.
13439 @example
13440       set xtics offset 0,graph 0.05
13441
13442 @end example
13443
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.
13447
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
13450 two forms:
13451
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.
13459
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.
13464
13465 Example:
13466 @example
13467       set xtics border offset 0,0.5 -5,1,5
13468 @end example
13469
13470 Fails with 'invalid expression' at the last comma.
13471 @example
13472       set xtics border offset 0,0.5 0-5,1,5
13473 @end example
13474
13475 or
13476 @example
13477       set xtics offset 0,0.5 border -5,1,5
13478 @end example
13479
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.
13482
13483 The `set grid` options 'front', 'back' and 'layerdefault' affect the drawing
13484 order of the xtics, too.
13485
13486 Examples:
13487
13488 Make tics at 0, 0.5, 1, 1.5, ..., 9.5, 10.
13489 @example
13490       set xtics 0,.5,10
13491
13492 @end example
13493
13494 Make tics at ..., -10, -5, 0, 5, 10, ...
13495 @example
13496       set xtics 5
13497
13498 @end example
13499
13500 Make tics at 1, 100, 1e4, 1e6, 1e8.
13501 @example
13502       set logscale x; set xtics 1,100,1e8
13503
13504 @end example
13505
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.
13515
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.
13519
13520 Examples:
13521 @example
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)
13526
13527 @end example
13528
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.
13531
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.
13537
13538 Example:
13539 @example
13540       set xtics 0,.5,10
13541       set xtics add ("Pi" 3.14159)
13542
13543 @end example
13544
13545 This will automatically generate tic marks every 0.5 along x, but will
13546 also add an explicit labeled tic mark at pi.
13547
13548 However they are specified, tics will only be plotted when in range.
13549
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.
13552
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.
13555
13556 @menu
13557 * xtics_time_data::             
13558 * xtics_rangelimited::          
13559 @end menu
13560
13561 @node xtics_time_data, xtics_rangelimited, xtics, xtics
13562 @subsubsection xtics time_data
13563
13564 @c ?set xtics time_axis tics
13565 @c ?xtics time_axis tics
13566 @c ?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.
13572
13573 Examples:
13574 @example
13575       set xdata time
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"
13580
13581 @end example
13582
13583 @example
13584       set xdata time
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")
13589 @end example
13590
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.
13593
13594 @node xtics_rangelimited,  , xtics_time_data, xtics
13595 @subsubsection xtics rangelimited
13596
13597 @c ?set xtics rangelimited
13598 @c ?xtics rangelimited
13599 @cindex rangelimited
13600
13601 @cindex range-frame
13602
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.
13613 @example
13614       set border 3
13615       set yrange [0:10]
13616       set ytics nomirror rangelimited
13617       plot "file.dat"
13618
13619 @end example
13620
13621 @node xyplane, xzeroaxis, xtics, set-show
13622 @subsection xyplane
13623
13624 @c ?commands set ticslevel
13625 @c ?commands show ticslevel
13626 @c ?set ticslevel
13627 @c ?show ticslevel
13628 @cindex ticslevel
13629 @opindex ticslevel
13630
13631
13632 @c ?commands set xyplane
13633 @c ?commands show xyplane
13634 @c ?set xyplane
13635 @c ?show xyplane
13636 @cindex xyplane
13637 @opindex xyplane
13638
13639
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
13642 compatibility.
13643
13644 Syntax:
13645 @example
13646       set ticslevel <frac>
13647       set xyplane <frac>
13648       set xyplane at <zvalue>
13649       show xyplane
13650
13651 @end example
13652
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.
13657
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.
13661
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`.
13666
13667 See also @ref{view}, and @ref{zeroaxis}.
13668
13669 @node xzeroaxis, y2data, xyplane, set-show
13670 @subsection xzeroaxis
13671
13672 @c ?commands set xzeroaxis
13673 @c ?commands unset xzeroaxis
13674 @c ?commands show xzeroaxis
13675 @c ?set xzeroaxis
13676 @c ?unset xzeroaxis
13677 @c ?show xzeroaxis
13678 @cindex xzeroaxis
13679 @opindex xzeroaxis
13680
13681
13682 @cindex noxzeroaxis
13683
13684 The @ref{xzeroaxis} command draws a line at y = 0.  For details,
13685 please see @ref{zeroaxis}.
13686
13687 @node y2data, y2dtics, xzeroaxis, set-show
13688 @subsection y2data
13689
13690 @c ?commands set y2data
13691 @c ?commands show y2data
13692 @c ?set y2data
13693 @c ?show y2data
13694 @cindex y2data
13695 @opindex y2data
13696
13697
13698 The @ref{y2data} command sets y2 (right-hand) axis data to timeseries
13699 (dates/times).  Please see @ref{xdata}.
13700
13701 @node y2dtics, y2label, y2data, set-show
13702 @subsection y2dtics
13703
13704 @c ?commands set y2dtics
13705 @c ?commands unset y2dtics
13706 @c ?set y2dtics
13707 @c ?unset y2dtics
13708 @c ?show y2dtics
13709 @cindex y2dtics
13710 @opindex y2dtics
13711
13712
13713 @cindex noy2dtics
13714
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.
13717
13718 @node y2label, y2mtics, y2dtics, set-show
13719 @subsection y2label
13720
13721 @c ?commands set y2label
13722 @c ?commands show y2label
13723 @c ?set y2label
13724 @c ?show y2label
13725 @cindex y2label
13726 @opindex y2label
13727
13728
13729 The @ref{y2label} command sets the label for the y2 (right-hand) axis.
13730 Please see @ref{xlabel}.
13731
13732 @node y2mtics, y2range, y2label, set-show
13733 @subsection y2mtics
13734
13735 @c ?commands set y2mtics
13736 @c ?commands unset y2mtics
13737 @c ?commands show y2mtics
13738 @c ?set y2mtics
13739 @c ?unset y2mtics
13740 @c ?show y2mtics
13741 @cindex y2mtics
13742 @opindex y2mtics
13743
13744
13745 @cindex noy2mtics
13746
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.
13749
13750 @node y2range, y2tics, y2mtics, set-show
13751 @subsection y2range
13752
13753 @c ?commands set y2range
13754 @c ?commands show y2range
13755 @c ?set y2range
13756 @c ?show y2range
13757 @cindex y2range
13758 @opindex y2range
13759
13760
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.
13763
13764 @node y2tics, y2zeroaxis, y2range, set-show
13765 @subsection y2tics
13766
13767 @c ?commands set y2tics
13768 @c ?commands unset y2tics
13769 @c ?commands show y2tics
13770 @c ?set y2tics
13771 @c ?unset y2tics
13772 @c ?show y2tics
13773 @cindex y2tics
13774 @opindex y2tics
13775
13776
13777 @cindex noy2tics
13778
13779 The @ref{y2tics} command controls major (labelled) tics on the y2 (right-hand)
13780 axis.  Please see `set xtics` for details.
13781
13782 @node y2zeroaxis, ydata, y2tics, set-show
13783 @subsection y2zeroaxis
13784
13785 @c ?commands set y2zeroaxis
13786 @c ?commands unset y2zeroaxis
13787 @c ?commands show y2zeroaxis
13788 @c ?set y2zeroaxis
13789 @c ?unset y2zeroaxis
13790 @c ?show y2zeroaxis
13791 @cindex y2zeroaxis
13792 @opindex y2zeroaxis
13793
13794
13795 @cindex noy2zeroaxis
13796
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}.
13799
13800 @node ydata, ydtics, y2zeroaxis, set-show
13801 @subsection ydata
13802
13803 @c ?commands set ydata
13804 @c ?commands show ydata
13805 @c ?set ydata
13806 @c ?show ydata
13807 @cindex ydata
13808 @opindex ydata
13809
13810
13811 The @ref{ydata} commands sets y-axis data to timeseries (dates/times).
13812 Please see @ref{xdata}.
13813
13814 @node ydtics, ylabel, ydata, set-show
13815 @subsection ydtics
13816
13817 @c ?commands set ydtics
13818 @c ?commands unset ydtics
13819 @c ?commands show ydtics
13820 @c ?set ydtics
13821 @c ?unset ydtics
13822 @c ?show ydtics
13823 @cindex ydtics
13824 @opindex ydtics
13825
13826
13827 @cindex noydtics
13828
13829 The @ref{ydtics} command changes tics on the y axis to days of the week.
13830 Please see @ref{xdtics} for details.
13831
13832 @node ylabel, ymtics, ydtics, set-show
13833 @subsection ylabel
13834
13835 @c ?commands set ylabel
13836 @c ?commands show ylabel
13837 @c ?set ylabel
13838 @c ?show ylabel
13839 @cindex ylabel
13840 @opindex ylabel
13841
13842
13843 This command sets the label for the y axis.  Please see @ref{xlabel}.
13844
13845 @node ymtics, yrange, ylabel, set-show
13846 @subsection ymtics
13847
13848 @c ?commands set ymtics
13849 @c ?commands unset ymtics
13850 @c ?commands show ymtics
13851 @c ?set ymtics
13852 @c ?unset ymtics
13853 @c ?show ymtics
13854 @cindex ymtics
13855 @opindex ymtics
13856
13857
13858 @cindex noymtics
13859
13860 The @ref{ymtics} command changes tics on the y axis to months of the year.
13861 Please see @ref{xmtics} for details.
13862
13863 @node yrange, ytics, ymtics, set-show
13864 @subsection yrange
13865
13866 @c ?commands set yrange
13867 @c ?commands show yrange
13868 @c ?set yrange
13869 @c ?show yrange
13870 @cindex yrange
13871 @opindex yrange
13872
13873
13874 The @ref{yrange} command sets the vertical range that will be displayed on
13875 the y axis.  Please see @ref{xrange} for details.
13876
13877 @node ytics, yzeroaxis, yrange, set-show
13878 @subsection ytics
13879
13880 @c ?commands set ytics
13881 @c ?commands unset ytics
13882 @c ?commands show ytics
13883 @c ?set ytics
13884 @c ?unset ytics
13885 @c ?show ytics
13886 @cindex ytics
13887 @opindex ytics
13888
13889
13890 @cindex noytics
13891
13892 The @ref{ytics} command controls major (labelled) tics on the y axis.
13893 Please see `set xtics` for details.
13894
13895 @node yzeroaxis, zdata, ytics, set-show
13896 @subsection yzeroaxis
13897
13898 @c ?commands set yzeroaxis
13899 @c ?commands unset yzeroaxis
13900 @c ?commands show yzeroaxis
13901 @c ?set yzeroaxis
13902 @c ?unset yzeroaxis
13903 @c ?show yzeroaxis
13904 @cindex yzeroaxis
13905 @opindex yzeroaxis
13906
13907
13908 @cindex noyzeroaxis
13909
13910 The @ref{yzeroaxis} command draws a line at x = 0.  For details,
13911 please see @ref{zeroaxis}.
13912
13913 @node zdata, zdtics, yzeroaxis, set-show
13914 @subsection zdata
13915
13916 @c ?commands set zdata
13917 @c ?commands show zdata
13918 @c ?set zdata
13919 @c ?show zdata
13920 @cindex zdata
13921 @opindex zdata
13922
13923
13924 The @ref{zdata} command sets zaxis data to timeseries (dates/times).
13925 Please see @ref{xdata}.
13926
13927 @node zdtics, zzeroaxis, zdata, set-show
13928 @subsection zdtics
13929
13930 @c ?commands set zdtics
13931 @c ?commands unset zdtics
13932 @c ?commands show zdtics
13933 @c ?set zdtics
13934 @c ?unset zdtics
13935 @c ?show zdtics
13936 @cindex zdtics
13937 @opindex zdtics
13938
13939
13940 @cindex nozdtics
13941
13942 The @ref{zdtics} command changes tics on the z axis to days of the week.
13943 Please see @ref{xdtics} for details.
13944
13945 @node zzeroaxis, cbdata, zdtics, set-show
13946 @subsection zzeroaxis
13947
13948 @c ?commands set zzeroaxis
13949 @c ?commands unset zzeroaxis
13950 @c ?commands show zzeroaxis
13951 @c ?set zzeroaxis
13952 @c ?unset zzeroaxis
13953 @c ?show zzeroaxis
13954 @cindex zzeroaxis
13955 @opindex zzeroaxis
13956
13957
13958 @cindex nozzeroaxis
13959
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}.
13963
13964 @node cbdata, cbdtics, zzeroaxis, set-show
13965 @subsection cbdata
13966
13967 @c ?commands set cbdata
13968 @c ?commands show cbdata
13969 @c ?set cbdata
13970 @c ?show cbdata
13971 @cindex cbdata
13972 @opindex cbdata
13973
13974
13975 Set color box axis data to timeseries (dates/times).  Please see @ref{xdata}.
13976
13977 @node cbdtics, zero, cbdata, set-show
13978 @subsection cbdtics
13979
13980 @c ?commands set cbdtics
13981 @c ?commands unset cbdtics
13982 @c ?commands show cbdtics
13983 @c ?set cbdtics
13984 @c ?unset cbdtics
13985 @c ?show cbdtics
13986 @cindex cbdtics
13987 @opindex cbdtics
13988
13989
13990 @cindex nocbdtics
13991
13992 The @ref{cbdtics} command changes tics on the color box axis to days of the
13993 week. Please see @ref{xdtics} for details.
13994
13995 @node zero, zeroaxis, cbdtics, set-show
13996 @subsection zero
13997
13998 @c ?commands set zero
13999 @c ?commands show zero
14000 @c ?set zero
14001 @c ?show zero
14002 @cindex zero
14003 @opindex zero
14004
14005
14006 The `zero` value is the default threshold for values approaching 0.0.
14007
14008 Syntax:
14009 @example
14010       set zero <expression>
14011       show zero
14012
14013 @end example
14014
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.
14021
14022 @node zeroaxis, zlabel, zero, set-show
14023 @subsection zeroaxis
14024
14025 @c ?commands set zeroaxis
14026 @c ?commands unset zeroaxis
14027 @c ?commands show zeroaxis
14028 @c ?set zeroaxis
14029 @c ?unset zeroaxis
14030 @c ?show zeroaxis
14031 @cindex zeroaxis
14032 @opindex zeroaxis
14033
14034
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.
14037
14038 Syntax:
14039 @example
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
14045
14046 @end example
14047
14048
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
14052 <line_style>.
14053
14054 If no linetype is specified, any zero axes selected will be drawn
14055 using the axis linetype (linetype 0).
14056
14057 @ref{zeroaxis} is equivalent to @ref{yzeroaxis}.
14058 Note that the z-axis must be set separately using @ref{zzeroaxis}.
14059
14060 Examples:
14061
14062 To simply have the y=0 axis drawn visibly:
14063
14064 @example
14065        set xzeroaxis
14066
14067 @end example
14068
14069 If you want a thick line in a different color or pattern, instead:
14070
14071 @example
14072        set xzeroaxis linetype 3 linewidth 2.5
14073
14074 @end example
14075
14076 @node zlabel, zmtics, zeroaxis, set-show
14077 @subsection zlabel
14078
14079 @c ?commands set zlabel
14080 @c ?commands show zlabel
14081 @c ?set zlabel
14082 @c ?show zlabel
14083 @cindex zlabel
14084 @opindex zlabel
14085
14086
14087 This command sets the label for the z axis.  Please see @ref{xlabel}.
14088
14089 @node zmtics, zrange, zlabel, set-show
14090 @subsection zmtics
14091
14092 @c ?commands set zmtics
14093 @c ?commands unset zmtics
14094 @c ?commands show zmtics
14095 @c ?set zmtics
14096 @c ?unset zmtics
14097 @c ?show zmtics
14098 @cindex zmtics
14099 @opindex zmtics
14100
14101
14102 @cindex nozmtics
14103
14104 The @ref{zmtics} command changes tics on the z axis to months of the year.
14105 Please see @ref{xmtics} for details.
14106
14107 @node zrange, ztics, zmtics, set-show
14108 @subsection zrange
14109
14110 @c ?commands set zrange
14111 @c ?commands show zrange
14112 @c ?set zrange
14113 @c ?show zrange
14114 @cindex zrange
14115 @opindex zrange
14116
14117
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.
14121
14122 @node ztics, cblabel, zrange, set-show
14123 @subsection ztics
14124
14125 @c ?commands set ztics
14126 @c ?commands unset ztics
14127 @c ?commands show ztics
14128 @c ?set ztics
14129 @c ?unset ztics
14130 @c ?show ztics
14131 @cindex ztics
14132 @opindex ztics
14133
14134
14135 @cindex noztics
14136
14137 The @ref{ztics} command controls major (labelled) tics on the z axis.
14138 Please see `set xtics` for details.
14139
14140 @node cblabel, cbmtics, ztics, set-show
14141 @subsection cblabel
14142
14143 @c ?commands set cblabel
14144 @c ?commands show cblabel
14145 @c ?set cblabel
14146 @c ?show cblabel
14147 @cindex cblabel
14148 @opindex cblabel
14149
14150
14151 This command sets the label for the color box axis.  Please see @ref{xlabel}.
14152
14153 @node cbmtics, cbrange, cblabel, set-show
14154 @subsection cbmtics
14155
14156 @c ?commands set cbmtics
14157 @c ?commands unset cbmtics
14158 @c ?commands show cbmtics
14159 @c ?set cbmtics
14160 @c ?unset cbmtics
14161 @c ?show cbmtics
14162 @cindex cbmtics
14163 @opindex cbmtics
14164
14165
14166 @cindex nocbmtics
14167
14168 The @ref{cbmtics} command changes tics on the color box axis to months of the
14169 year. Please see @ref{xmtics} for details.
14170
14171 @node cbrange, cbtics, cbmtics, set-show
14172 @subsection cbrange
14173
14174 @c ?commands set cbrange
14175 @c ?commands show cbrange
14176 @c ?set cbrange
14177 @c ?show cbrange
14178 @cindex cbrange
14179 @opindex cbrange
14180
14181
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.
14185
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}.
14189
14190 Please see @ref{xrange} for details on @ref{cbrange} syntax. See also
14191 @ref{palette} and `set colorbox`.
14192
14193 @node cbtics,  , cbrange, set-show
14194 @subsection cbtics
14195
14196 @c ?commands set cbtics
14197 @c ?commands unset cbtics
14198 @c ?commands show cbtics
14199 @c ?set cbtics
14200 @c ?unset cbtics
14201 @c ?show cbtics
14202 @cindex cbtics
14203 @opindex cbtics
14204
14205
14206 @cindex nocbtics
14207
14208 The @ref{cbtics} command controls major (labelled) tics on the color box axis.
14209 Please see `set xtics` for details.
14210
14211 @node shell, splot, set-show, Commands
14212 @section shell
14213
14214 @c ?commands shell
14215 @cindex shell
14216 @cmindex shell
14217
14218
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.
14222
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,
14229
14230 @example
14231       ! dir
14232 @end example
14233
14234 or
14235 @example
14236       system "dir"
14237
14238 @end example
14239
14240
14241 prints a directory listing and then returns to `gnuplot`.
14242
14243
14244 Other examples of the former syntax:
14245 @example
14246        system "date"; set time; plot "a.dat"
14247        print=1; if (print) replot; set out; system "lpr x.ps"
14248
14249 @end example
14250
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.
14254
14255 @node splot, system_, shell, Commands
14256 @section splot
14257
14258 @c ?commands splot
14259 @cindex splot
14260 @cmindex splot
14261
14262
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.
14266
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`.
14270
14271 Syntax:
14272 @example
14273       splot @{<ranges>@}
14274             <function> | "<datafile>" @{datafile-modifiers@}@}
14275             @{<title-spec>@} @{with <style>@}
14276             @{, @{definitions,@} <function> ...@}
14277
14278 @end example
14279
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.
14283
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.
14287
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}.
14292
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`.
14297
14298 The @ref{datafile} options have more differences.
14299
14300 See also `show plot`.
14301
14302 @menu
14303 * data-file::                   
14304 * grid_data::                   
14305 * splot_overview::              
14306 @end menu
14307
14308 @node data-file, grid_data, splot, splot
14309 @subsection data-file
14310
14311 @c ?commands splot datafile
14312 @c ?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`
14316 command line.
14317
14318 Syntax:
14319 @example
14320       splot '<file_name>' @{binary <binary list>@}
14321                           @{matrix@}
14322                           @{index <index list>@}
14323                           @{every <every list>@}
14324                           @{using <using list>@}
14325
14326 @end example
14327
14328 The special filenames `""` and `"-"` are permitted, as in `plot`.
14329
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.
14335
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
14338 instead of two.
14339
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.
14342
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}.
14350
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`.
14358
14359 It is no longer necessary to specify `parametric` mode for three-column
14360 `splot`s.
14361
14362 @menu
14363 * binary_matrix::               
14364 * example_datafile_::           
14365 * matrix_ascii::                
14366 * matrix::                      
14367 @end menu
14368
14369 @node binary_matrix, example_datafile_, data-file, data-file
14370 @subsubsection binary matrix
14371
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
14380 @c ?matrix binary
14381 @c ?binary matrix
14382 @cindex gpbin
14383
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
14388 more details.)
14389
14390 In previous versions, `gnuplot` dynamically detected binary data files.  It
14391 is now necessary to specify the keyword `binary` directly after the filename.
14392
14393 Single precision floats are stored in a binary file as follows:
14394
14395 @example
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>
14399         :      :      :      :   ...    :
14400
14401 @end example
14402
14403 which are converted into triplets:
14404 @example
14405       <x0> <y0> <z0,0>
14406       <x0> <y1> <z0,1>
14407       <x0> <y2> <z0,2>
14408        :    :     :
14409       <x0> <yN> <z0,N>
14410
14411 @end example
14412
14413 @example
14414       <x1> <y0> <z1,0>
14415       <x1> <y1> <z1,1>
14416        :    :     :
14417
14418 @end example
14419
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.
14422
14423 A collection of matrix and vector manipulation routines (in C) is provided
14424 in `binary.c`.  The routine to write binary data is
14425
14426 @example
14427       int fwrite_matrix(file,m,nrl,nrl,ncl,nch,row_title,column_title)
14428
14429 @end example
14430
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`.
14433
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.
14437
14438 See also `binary general` and
14439
14440 @uref{http://www.gnuplot.info/demo/binary.html,Binary File Splot Demo.
14441 }
14442
14443 @node example_datafile_, matrix_ascii, binary_matrix, data-file
14444 @subsubsection example datafile
14445
14446 @c ?commands splot datafile example
14447 @c ?splot datafile example
14448 @c ?splot example
14449 A simple example of plotting a 3-d data file is
14450
14451 @example
14452       splot 'datafile.dat'
14453
14454 @end example
14455
14456 where the file "datafile.dat" might contain:
14457
14458 @example
14459       # The valley of the Gnu.
14460          0 0 10
14461          0 1 10
14462          0 2 10
14463
14464 @end example
14465
14466 @example
14467          1 0 10
14468          1 1 5
14469          1 2 10
14470
14471 @end example
14472
14473 @example
14474          2 0 10
14475          2 1 1
14476          2 2 10
14477
14478 @end example
14479
14480 @example
14481          3 0 10
14482          3 1 0
14483          3 2 10
14484
14485 @end example
14486
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.
14489
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'.
14494
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.
14502
14503 @node matrix_ascii, matrix, example_datafile_, data-file
14504 @subsubsection matrix_ascii
14505
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
14514 @c ?matrix ascii
14515 The `matrix` keyword (without a sequent `binary` keyword) in
14516 @example
14517     @{s@}plot 'a.dat' matrix
14518 @end example
14519
14520 indicates that data are stored in an ascii numbers matrix format.
14521
14522 The z-values are read in a row at a time, i. e.,
14523 @example
14524     z11 z12 z13 z14 ...
14525     z21 z22 z23 z24 ...
14526     z31 z32 z33 z34 ...
14527 @end example
14528
14529 and so forth.
14530
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
14535 @example
14536     splot 'a.dat' matrix using (1+$1/100):(1+$2*10):3
14537
14538 @end example
14539
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.
14543
14544 See `matrix` for examples of plotting rows and columns of the matrix in
14545 a 2D plot.
14546
14547 @node matrix,  , matrix_ascii, data-file
14548 @subsubsection matrix
14549
14550 @c ?commands plot datafile matrix
14551 @c ?commands splot datafile matrix
14552 @c ?plot datafile matrix
14553 @c ?splot datafile matrix
14554 @c ?plot matrix
14555 @c ?splot matrix
14556 @c ?data-file matrix
14557 @c ?datafile matrix
14558 @cindex matrix
14559
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`.
14563
14564 Basic usage in `splot`:
14565 @example
14566     splot 'a.dat' matrix
14567     splot 'a.gpbin' @{matrix@} binary
14568 @end example
14569
14570 Advanced usage in `splot`:
14571 @example
14572     splot 'a.dat' matrix using 1:2:3
14573     splot 'a.gpbin' @{matrix@} binary using 1:2:3
14574 @end example
14575
14576 allows to transform the axes coordinates and the z-data independently.
14577
14578 Usage in `plot`:
14579 @example
14580     plot `a.dat` matrix
14581     plot `a.dat` matrix using 1:3
14582     plot 'a.gpbin' @{matrix@} binary using 1:3
14583 @end example
14584
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.
14588
14589 Example -- rescale axes of a matrix in an ascii file:
14590 @example
14591     splot `a.dat` matrix using (1+$1):(1+$2*10):3
14592
14593 @end example
14594
14595 Example -- plot the 3rd row of a matrix in an ascii file:
14596 @example
14597     plot 'a.dat' matrix using 1:3 every 1:999:1:2
14598 @end example
14599
14600 (rows are enumerated from 0, thus 2 instead of 3).
14601
14602 @node grid_data, splot_overview, data-file, splot
14603 @subsection grid data
14604
14605 @c ?commands splot grid_data
14606 @c ?splot grid_data
14607 @cindex grid_data
14608
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}.
14615
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}.
14625
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:
14630 @example
14631        set xrange [-pi/2:pi/2]; set yrange [-pi/2:pi/2]
14632        set style function lp
14633        set contour
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
14638
14639 @end example
14640
14641
14642 @node splot_overview,  , grid_data, splot
14643 @subsection splot overview
14644
14645 @c ?commands splot overview
14646 @c ?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}.
14654
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}).
14662
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.
14667
14668 @node system_, test, splot, Commands
14669 @section system
14670
14671 @c ?commands system
14672 @cindex system
14673 @cmindex system
14674
14675
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.
14679
14680 This can be used to import external functions into gnuplot scripts:
14681
14682 @example
14683       f(x) = real(system(sprintf("somecommand %f", x)))
14684
14685 @end example
14686
14687 @node test, undefine, system_, Commands
14688 @section test
14689
14690 @c ?commands test
14691 @c ?test palette
14692 @cindex test
14693 @cmindex test
14694
14695
14696 This command graphically tests or presents terminal and palette capabilities.
14697
14698 Syntax:
14699 @example
14700       test @{terminal | palette [rgb|rbg|grb|gbr|brg|bgr]@}
14701
14702 @end example
14703
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
14706 using.
14707
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.
14714
14715 @node undefine, unset, test, Commands
14716 @section undefine
14717
14718 @c ?commands undefine
14719 @cindex undefine
14720 @cmindex undefine
14721
14722
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.
14725
14726 Example:
14727
14728 @example
14729       undefine foo foo1 foo2
14730       if (!exists("foo")) load "initialize.gp"
14731
14732 @end example
14733
14734
14735 @node unset, update, undefine, Commands
14736 @section unset
14737
14738 @c ?commands unset
14739 @cindex unset
14740 @cmindex unset
14741
14742
14743 Options set using the `set` command may be returned to their default state by
14744 issuing the corresponding @ref{unset} command.
14745
14746 Example:
14747 @example
14748       set xtics mirror rotate by -45 0,10,100
14749       ...
14750       unset xtics
14751
14752 @end example
14753
14754
14755 @node update,  , unset, Commands
14756 @section update
14757
14758 @c ?commands update
14759 @cindex update
14760 @cmindex update
14761
14762
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.
14767
14768 Syntax:
14769 @example
14770       update <filename> @{<filename>@}
14771
14772 @end example
14773
14774 If a second filename is supplied, the updated values are written to this
14775 file, and the original parameter file is left unmodified.
14776
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.]
14784
14785 Please see @ref{fit} for more information.
14786
14787 @node Terminal_types, Graphical_User_Interfaces, Commands, Top
14788 @chapter Terminal types
14789
14790 @c ^ <h2> Terminal Types </h2>
14791
14792 @menu
14793 * terminal_::                   
14794 @end menu
14795
14796 @node terminal_,  , Terminal_types, Terminal_types
14797 @section terminal
14798
14799 @cindex terminal
14800 @opindex terminal
14801
14802
14803 @cindex term
14804
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}.
14808
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'
14812 with no modifiers.
14813 @@c <3 -- all terminal stuff is pulled from the .trm files
14814
14815 @menu
14816 * aed767::                      
14817 * aifm::                        
14818 * amiga::                       
14819 * apollo::                      
14820 * aqua::                        
14821 * atari_ST_(via_AES)::          
14822 * atari_ST_(via_VDI)::          
14823 * be::                          
14824 * cgi::                         
14825 * cgm::                         
14826 * corel::                       
14827 * debug::                       
14828 * svga::                        
14829 * dumb::                        
14830 * dxf::                         
14831 * dxy800a::                     
14832 * eepic::                       
14833 * emf::                         
14834 * emxvga::                      
14835 * epson-180dpi::                
14836 * excl::                        
14837 * hercules::                    
14838 * fig::                         
14839 * png::                         
14840 * ggi::                         
14841 * Gnugraph(GNU_plotutils)::     
14842 * gpic::                        
14843 * gpic_::                       
14844 * gpr::                         
14845 * grass::                       
14846 * hp2623a::                     
14847 * hp2648::                      
14848 * hp500c::                      
14849 * hpgl::                        
14850 * hpljii::                      
14851 * hppj::                        
14852 * imagen::                      
14853 * iris4d::                      
14854 * kyo::                         
14855 * latex::                       
14856 * linux::                       
14857 * linux_::                      
14858 * macintosh::                   
14859 * mf::                          
14860 * mp::                          
14861 * mgr::                         
14862 * mif::                         
14863 * mtos::                        
14864 * next::                        
14865 * Openstep_(next)::             
14866 * pbm::                         
14867 * dospc::                       
14868 * pdf::                         
14869 * pstricks::                    
14870 * qms::                         
14871 * regis::                       
14872 * regis_::                      
14873 * rgip::                        
14874 * sun::                         
14875 * svg::                         
14876 * tek410x::                     
14877 * tek410x_::                    
14878 * tek40::                       
14879 * texdraw::                     
14880 * tgif::                        
14881 * tgif_::                       
14882 * tkcanvas::                    
14883 * tpic::                        
14884 * unixpc::                      
14885 * unixplot::                    
14886 * vx384::                       
14887 * vgagl::                       
14888 * VWS::                         
14889 * windows::                     
14890 * x11::                         
14891 * x11_::                        
14892 * xlib::                        
14893 * xlib_::                       
14894 @end menu
14895
14896 @node aed767, aifm, terminal_, terminal_
14897 @subsubsection aed767
14898
14899 @c ?commands set terminal aed767
14900 @c ?set terminal aed767
14901 @c ?set term aed767
14902 @c ?terminal aed767
14903 @c ?term aed767
14904 @cindex aed767
14905 @tmindex aed767
14906
14907
14908 @c ?commands set terminal aed512
14909 @c ?set terminal aed512
14910 @c ?set term aed512
14911 @c ?terminal aed512
14912 @c ?term aed512
14913 @cindex aed512
14914 @tmindex aed512
14915
14916
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."
14921
14922 @node aifm, amiga, aed767, terminal_
14923 @subsubsection aifm
14924
14925 @c ?commands set terminal aifm
14926 @c ?set terminal aifm
14927 @c ?set term aifm
14928 @c ?terminal aifm
14929 @c ?term aifm
14930 @cindex aifm
14931
14932
14933 NOTE: this terminal driver is outdated. Since Adobe Illustrator understands
14934 PostScript level 1 directly, you should use `set terminal post level1`
14935 instead.
14936
14937 Several options may be set in `aifm`---the Adobe Illustrator 3.0+ driver.
14938
14939 Syntax:
14940 @example
14941       set terminal aifm @{<color>@} @{"<fontname>"@} @{<fontsize>@}
14942
14943 @end example
14944
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.
14949
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
14953 and move them).
14954
14955 Examples:
14956 @example
14957       set term aifm
14958       set term aifm 22
14959       set size 0.7,1.4; set term aifm color "Times-Roman" 14"
14960
14961 @end example
14962
14963 @node amiga, apollo, aifm, terminal_
14964 @subsubsection amiga
14965
14966 @c ?commands set terminal amiga
14967 @c ?set terminal amiga
14968 @c ?set term amiga
14969 @c ?terminal amiga
14970 @c ?term amiga
14971 @cindex amiga
14972 @tmindex amiga
14973
14974
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.
14979
14980 Syntax:
14981 @example
14982       set terminal amiga @{screen | window@} @{"<fontname>"@} @{<fontsize>@}
14983
14984 @end example
14985
14986 The default font is 8-point "topaz".
14987
14988 The screen option uses a virtual screen, so it is possible that the graph
14989 will be larger than the screen."
14990
14991 @node apollo, aqua, amiga, terminal_
14992 @subsubsection apollo
14993
14994 @c ?commands set terminal apollo
14995 @c ?set terminal apollo
14996 @c ?set term apollo
14997 @c ?terminal apollo
14998 @c ?term apollo
14999 @cindex apollo
15000 @tmindex apollo
15001
15002
15003 The `apollo` terminal driver supports the Apollo Graphics Primitive Resource
15004 with rescaling after window resizing.  It has no options.
15005
15006 If a fixed-size window is desired, the `gpr` terminal may be used instead."
15007
15008 @node aqua, atari_ST_(via_AES), apollo, terminal_
15009 @subsubsection aqua
15010
15011 @c ?commands set terminal aqua
15012 @c ?set terminal aqua
15013 @c ?set term aqua
15014 @c ?terminal aqua
15015 @c ?term aqua
15016 @cindex aqua
15017
15018 @cindex Aqua
15019
15020 This terminal relies on AquaTerm.app for display on Mac OS X.
15021
15022 Syntax:
15023 @example
15024       set terminal aqua @{<n>@} @{title "<wintitle>"@} @{size <x> <y>@}
15025                         @{font "<fontname>@{,<fontsize>@}"@}
15026                         @{@{no@}enhanced@} @{solid|dashed@} @{dl <dashlength>@}@}
15027
15028 @end example
15029
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).
15033
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.
15037
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.
15042
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.
15045
15046
15047 @node atari_ST_(via_AES), atari_ST_(via_VDI), aqua, terminal_
15048 @subsubsection atari ST (via AES)
15049
15050 @c ?commands set terminal atari
15051 @c ?set terminal atari
15052 @c ?set term atari
15053 @c ?terminal atari
15054 @c ?term atari
15055 @cindex atari
15056 @tmindex atari
15057
15058
15059 The `atari` terminal has options to set the character size and the screen
15060 colors.
15061
15062 Syntax:
15063 @example
15064       set terminal atari @{<fontsize>@} @{<col0> <col1> ... <col15>@}
15065
15066 @end example
15067
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.
15073
15074 Examples:
15075 @example
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).
15081
15082 @end example
15083
15084 Additionally, if an environment variable GNUCOLORS exists, its contents are
15085 interpreted as an options string, but an explicit terminal option takes
15086 precedence."
15087
15088 @node atari_ST_(via_VDI), be, atari_ST_(via_AES), terminal_
15089 @subsubsection atari ST (via VDI)
15090
15091 @c ?commands set terminal vdi
15092 @c ?set terminal vdi
15093 @c ?set term vdi
15094 @c ?terminal vdi
15095 @c ?term vdi
15096 @cindex vdi
15097 @tmindex vdi
15098
15099
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.
15102
15103 The `vdi` terminal has options to set the character size and the screen
15104 colors.
15105
15106 Syntax:
15107 @example
15108       set terminal vdi @{<fontsize>@} @{<col0> <col1> ... <col15>@}
15109
15110 @end example
15111
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.
15117
15118 Examples:
15119 @example
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).
15125
15126 @end example
15127
15128 Additionally, if an environment variable GNUCOLORS exists, its contents are
15129 interpreted as an options string, but an explicit terminal option takes
15130 precedence."
15131
15132 @node be, cgi, atari_ST_(via_VDI), terminal_
15133 @subsubsection be
15134
15135 @c ?commands set terminal be
15136 @c ?set terminal be
15137 @c ?set term be
15138 @c ?terminal be
15139 @c ?term be
15140 @cindex be
15141
15142 @cindex BE
15143
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.
15148
15149 Syntax:
15150 @example
15151           set terminal be @{reset@} @{<n>@}
15152
15153 @end example
15154
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
15159 to crosshair.)
15160
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).
15167
15168 Plot windows will automatically be closed at the end of the session
15169 unless the `-persist` option was given.
15170
15171 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
15172 window.
15173
15174 Linewidths and pointsizes may be changed from within `gnuplot` with
15175 `set linestyle`.
15176
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.
15181
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.
15186
15187
15188 @noindent --- COMMAND-LINE_OPTIONS ---
15189
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
15196 ".Xdefaults" file:
15197
15198 @example
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
15207
15208 @end example
15209
15210 The options are shown above in their command-line syntax.  When entered as
15211 resources in ".Xdefaults", they require a different syntax.
15212
15213 Example:
15214 @example
15215           gnuplot*gray: on
15216
15217 @end example
15218
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.
15225
15226
15227 @noindent --- MONOCHROME_OPTIONS ---
15228
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.
15236
15237
15238
15239 @noindent --- COLOR_RESOURCES ---
15240
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.
15251
15252 @example
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
15265
15266 @end example
15267
15268
15269 The command-line syntax for these is, for example,
15270
15271 Example:
15272 @example
15273           gnuplot -background coral
15274
15275 @end example
15276
15277
15278
15279 @noindent --- GRAYSCALE_RESOURCES ---
15280
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.
15288
15289 @example
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
15302
15303 @end example
15304
15305
15306
15307
15308 @noindent --- LINE_RESOURCES ---
15309
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
15317 some plots.
15318
15319 @example
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
15330
15331 @end example
15332
15333
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.
15344
15345 @example
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
15356
15357 @end example
15358
15359
15360 @node cgi, cgm, be, terminal_
15361 @subsubsection cgi
15362
15363 @c ?commands set terminal cgi
15364 @c ?set terminal cgi
15365 @c ?set term cgi
15366 @c ?terminal cgi
15367 @c ?term cgi
15368 @cindex cgi
15369 @tmindex cgi
15370
15371
15372 @c ?commands set terminal hcgi
15373 @c ?set terminal hcgi
15374 @c ?set term hcgi
15375 @c ?terminal hcgi
15376 @c ?term hcgi
15377 @cindex hcgi
15378 @tmindex hcgi
15379
15380
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.
15385
15386 These terminals have no options."
15387
15388 @node cgm, corel, cgi, terminal_
15389 @subsubsection cgm
15390
15391 @c ?commands set terminal cgm
15392 @c ?set terminal cgm
15393 @c ?set term cgm
15394 @c ?terminal cgm
15395 @c ?term cgm
15396 @cindex cgm
15397 @tmindex cgm
15398
15399
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".
15404
15405 Syntax:
15406 @example
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> ...@}
15411
15412 @end example
15413
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).
15420
15421 The first six options can be in any order.  Selecting `default` sets all
15422 options to their default values.
15423
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.
15428
15429 Examples:
15430 @example
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!
15436
15437 @end example
15438
15439
15440
15441 @noindent --- CGM FONTS ---
15442
15443 @c ?commands set terminal cgm font
15444 @c ?set terminal cgm font
15445 @c ?set term cgm font
15446 @c ?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):
15453
15454 @example
15455       Helvetica
15456       Helvetica Bold
15457       Helvetica Oblique
15458       Helvetica Bold Oblique
15459       Times Roman
15460       Times Bold
15461       Times Italic
15462       Times Bold Italic
15463       Courier
15464       Courier Bold
15465       Courier Oblique
15466       Courier Bold Oblique
15467       Symbol
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
15487       ZapfDingbats
15488       Script
15489       15
15490
15491 @end example
15492
15493
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
15499 you may find here:
15500 @example
15501   C:\\Program Files\\Microsoft Office\\Office\\Cgmimp32.hlp
15502 @end example
15503
15504 and/or its configuration file, which you may find here:
15505 @example
15506   C:\\Program Files\\Common Files\\Microsoft Shared\\Grphflt\\Cgmimp32.cfg
15507
15508 @end example
15509
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.
15517
15518 Example:
15519 @example
15520       set terminal cgm 'Old English'
15521       set terminal cgm 'Tengwar'
15522       set terminal cgm 'Arabic'
15523       set output 'myfile.cgm'
15524       plot ...
15525       set output
15526
15527 @end example
15528
15529 You cannot introduce a new font in a @ref{label} command.
15530
15531
15532
15533 @noindent --- CGM FONTSIZE ---
15534
15535 @c ?commands set terminal cgm fontsize
15536 @c ?set terminal cgm fontsize
15537 @c ?set term cgm fontsize
15538 @c ?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
15543 `width` option.
15544
15545
15546
15547 @noindent --- CGM LINEWIDTH ---
15548
15549 @c ?commands set terminal cgm linewidth
15550 @c ?set terminal cgm linewidth
15551 @c ?set term cgm linewidth
15552 @c ?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.
15556
15557
15558
15559 @noindent --- CGM ROTATE ---
15560
15561 @c ?commands set terminal cgm rotate
15562 @c ?set terminal cgm rotate
15563 @c ?set term cgm rotate
15564 @c ?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.
15573
15574
15575
15576 @noindent --- CGM SOLID ---
15577
15578 @c ?set terminal cgm solid
15579 @c ?set term cgm solid
15580 @c ?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
15585 each line type.
15586
15587
15588
15589 @noindent --- CGM SIZE ---
15590
15591 @c ?commands set terminal cgm size
15592 @c ?set terminal cgm size
15593 @c ?set term cgm size
15594 @c ?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.
15597
15598
15599
15600 @noindent --- CGM WIDTH ---
15601
15602 @c ?commands set terminal cgm width
15603 @c ?set terminal cgm width
15604 @c ?set term cgm width
15605 @c ?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.
15614
15615 Example:
15616 @example
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
15620
15621 @end example
15622
15623
15624
15625 @noindent --- CGM NOFONTLIST ---
15626
15627 @c ?commands set terminal cgm nofontlist
15628 @c ?set terminal cgm nofontlist
15629 @c ?set term cgm nofontlist
15630 @c ?cgm nofontlist
15631 @c ?set terminal cgm winword6
15632 @c ?set term cgm winword6
15633 @c ?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.
15644
15645
15646
15647 @node corel, debug, cgm, terminal_
15648 @subsubsection corel
15649
15650 @c ?commands set terminal corel
15651 @c ?set terminal corel
15652 @c ?set term corel
15653 @c ?terminal corel
15654 @c ?term corel
15655 @cindex corel
15656 @tmindex corel
15657
15658
15659 The `corel` terminal driver supports CorelDraw.
15660
15661 Syntax:
15662 @example
15663       set terminal corel @{  default
15664                           | @{monochrome | color
15665                                @{"<font>" @{<fontsize> 
15666                                   @{<xsize> <ysize> @{<linewidth> @}@}@}@}@}
15667
15668 @end example
15669
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."
15672
15673 @node debug, svga, corel, terminal_
15674 @subsubsection debug
15675
15676 @c ?commands set terminal debug
15677 @c ?set terminal debug
15678 @c ?set term debug
15679 @c ?terminal debug
15680 @c ?term debug
15681 @cindex debug
15682 @tmindex debug
15683
15684
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."
15687
15688 @node svga, dumb, debug, terminal_
15689 @subsubsection svga
15690
15691 @c ?commands set terminal svga
15692 @c ?set terminal svga
15693 @c ?set term svga
15694 @c ?terminal svga
15695 @c ?term svga
15696 @cindex svga
15697 @tmindex svga
15698
15699
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.
15702
15703 Syntax:
15704 @example
15705       set terminal svga @{"<fontname>"@}"
15706
15707 @end example
15708
15709 @node dumb, dxf, svga, terminal_
15710 @subsubsection dumb
15711
15712 @c ?commands set terminal dumb
15713 @c ?set terminal dumb
15714 @c ?set term dumb
15715 @c ?terminal dumb
15716 @c ?term dumb
15717 @cindex dumb
15718 @tmindex dumb
15719
15720
15721 The `dumb` terminal driver has an optional size specification and trailing
15722 linefeed control.
15723
15724 Syntax:
15725 @example
15726       set terminal dumb @{[no]feed@} @{<xsize> <ysize>@}
15727                         @{[no]enhanced@}
15728
15729 @end example
15730
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.
15733
15734 Examples:
15735 @example
15736       set term dumb nofeed
15737       set term dumb 79 49 # VGA screen---why would anyone do that?"
15738
15739 @end example
15740
15741 @node dxf, dxy800a, dumb, terminal_
15742 @subsubsection dxf
15743
15744 @c ?commands set terminal dxf
15745 @c ?set terminal dxf
15746 @c ?set term dxf
15747 @c ?terminal dxf
15748 @c ?term dxf
15749 @cindex dxf
15750 @tmindex dxf
15751
15752
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."
15761
15762 @node dxy800a, eepic, dxf, terminal_
15763 @subsubsection dxy800a
15764
15765 @c ?commands set terminal dxy800a
15766 @c ?set terminal dxy800a
15767 @c ?set term dxy800a
15768 @c ?terminal dxy800a
15769 @c ?term dxy800a
15770 @cindex dxy800a
15771 @tmindex dxy800a
15772
15773
15774 This terminal driver supports the Roland DXY800A plotter.  It has no options."
15775
15776 @node eepic, emf, dxy800a, terminal_
15777 @subsubsection eepic
15778
15779 @c ?commands set terminal eepic
15780 @c ?set terminal eepic
15781 @c ?set term eepic
15782 @c ?terminal eepic
15783 @c ?term eepic
15784 @cindex eepic
15785 @tmindex eepic
15786
15787
15788 The `eepic` terminal driver supports the extended LaTeX picture environment.
15789 It is an alternative to the `latex` driver.
15790
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
15795 of them.
15796 dvips and dvipdfm do support the "tpic" \\specials.
15797
15798 Syntax:
15799 @example
15800    set terminal eepic @{color, dashed, rotate, small, tiny, default, <fontsize>@}
15801
15802 @end example
15803
15804 Options:
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'
15812 will be ignored.
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
15824 in \\footnotesize.
15825
15826 Notes:
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 
15833 by 'set size a,b'.
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.
15846
15847 Examples:
15848 set term eepic
15849 @example
15850   output graphs as eepic macros inside a picture environment;
15851   \\input the resulting file in your LaTeX document.
15852 @end example
15853
15854 set term eepic color tiny rotate 8
15855 @example
15856   eepic macros with \\color macros, \\scripscriptsize point markers,
15857   true rotated text, and all text set with 8pt.
15858
15859 @end example
15860
15861 About label positioning:
15862 Use gnuplot defaults (mostly sensible, but sometimes not really best):
15863 @example
15864        set title '\\LaTeX\\ -- $ \\gamma $'
15865 @end example
15866
15867 Force centering both horizontally and vertically:
15868 @example
15869        set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
15870 @end example
15871
15872 Specify own positioning (top here):
15873 @example
15874        set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
15875 @end example
15876
15877 The other label -- account for long ticlabels:
15878 @example
15879        set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
15880
15881 @end example
15882
15883 @node emf, emxvga, eepic, terminal_
15884 @subsubsection emf
15885
15886 @c ?commands set terminal emf
15887 @c ?set terminal emf
15888 @c ?set term emf
15889 @c ?terminal emf
15890 @c ?term emf
15891 @cindex emf
15892 @tmindex emf
15893
15894
15895 The `emf` terminal generates an Enhanced Metafile Format file.
15896 This file format is recognized by many Windows applications.
15897
15898 Syntax:
15899 @example
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
15905
15906 @end example
15907
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.
15916
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.
15919
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.
15923
15924 The default settings are `color dashed font "Arial,12" size 1024,768`
15925 Selecting `default` sets all options to their default values.
15926
15927 Examples:
15928 @example
15929       set terminal emf 'Times Roman Italic' 12
15930       set terminal emf color solid    # no pesky dashes!"
15931
15932 @end example
15933
15934 @node emxvga, epson-180dpi, emf, terminal_
15935 @subsubsection emxvga
15936
15937 @c ?commands set terminal emxvga
15938 @c ?set terminal emxvga
15939 @c ?set term emxvga
15940 @c ?terminal emxvga
15941 @c ?term emxvga
15942 @cindex emxvga
15943 @tmindex emxvga
15944
15945
15946 @c ?commands set terminal emxvesa
15947 @c ?set terminal emxvesa
15948 @c ?set term emxvesa
15949 @c ?terminal emxvesa
15950 @c ?term emxvesa
15951 @cindex emxvesa
15952 @tmindex emxvesa
15953
15954
15955 @c ?commands set terminal vgal
15956 @c ?set terminal vgal
15957 @c ?set term vgal
15958 @c ?terminal vgal
15959 @c ?term vgal
15960 @cindex vgal
15961 @tmindex vgal
15962
15963
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).
15969
15970 Syntax:
15971 @example
15972       set terminal emxvga
15973       set terminal emxvesa @{vesa-mode@}
15974       set terminal vgal
15975
15976 @end example
15977
15978 The only option is the vesa mode for `emxvesa`, which defaults to G640x480x256."
15979
15980 @node epson-180dpi, excl, emxvga, terminal_
15981 @subsubsection epson-180dpi
15982
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
15990
15991
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
15999
16000
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
16008
16009
16010 @c ?commands set terminal nec-cp6
16011 @c ?set terminal nec-cp6
16012 @c ?set term nec-cp6
16013 @c ?terminal nec-cp6
16014 @c ?term nec-cp6
16015 @cindex nec-cp6
16016 @tmindex nec-cp6
16017
16018
16019 @c ?commands set terminal okidata
16020 @c ?set terminal okidata
16021 @c ?set term okidata
16022 @c ?terminal okidata
16023 @c ?term okidata
16024 @cindex okidata
16025 @tmindex okidata
16026
16027
16028 @c ?commands set terminal starc
16029 @c ?set terminal starc
16030 @c ?set term starc
16031 @c ?terminal starc
16032 @c ?term starc
16033 @cindex starc
16034 @tmindex starc
16035
16036
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
16044
16045
16046 This driver supports a family of Epson printers and derivatives.
16047
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.
16050
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.
16053
16054 `nec-cp6` is generic 24-pin driver that can be used for printers like the
16055 NEC CP6 and the Epson LQ-800.
16056
16057 The `okidata` driver supports the 9-pin OKIDATA 320/321 Standard printers.
16058
16059 The `starc` driver is for the Star Color Printer.
16060
16061 The `tandy-60dpi` driver is for the Tandy DMP-130 series of 9-pin, 60-dpi
16062 printers.
16063
16064 Only `nec-cp6` has any options.
16065
16066 Syntax:
16067 @example
16068       set terminal nec-cp6 @{monochrome | colour | draft@}
16069
16070 @end example
16071
16072 which defaults to monochrome.
16073
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:`."
16076
16077 @node excl, hercules, epson-180dpi, terminal_
16078 @subsubsection excl
16079
16080 @c ?commands set terminal excl
16081 @c ?set terminal excl
16082 @c ?set term excl
16083 @c ?terminal excl
16084 @c ?term excl
16085 @cindex excl
16086 @tmindex excl
16087
16088
16089 The `excl` terminal driver supports Talaris printers such as the EXCL Laser
16090 printer and the 1590.  It has no options."
16091
16092 @node hercules, fig, excl, terminal_
16093 @subsubsection hercules
16094
16095 @c ?commands set terminal hercules
16096 @c ?set terminal hercules
16097 @c ?set term hercules
16098 @c ?terminal hercules
16099 @c ?term hercules
16100 @cindex hercules
16101 @tmindex hercules
16102
16103
16104 @c ?commands set terminal egalib
16105 @c ?set terminal egalib
16106 @c ?set term egalib
16107 @c ?terminal egalib
16108 @c ?term egalib
16109 @cindex egalib
16110 @tmindex egalib
16111
16112
16113 @c ?commands set terminal egamono
16114 @c ?set terminal egamono
16115 @c ?set term egamono
16116 @c ?terminal egamono
16117 @c ?term egamono
16118 @cindex egamono
16119 @tmindex egamono
16120
16121
16122 @c ?commands set terminal vgalib
16123 @c ?set terminal vgalib
16124 @c ?set term vgalib
16125 @c ?terminal vgalib
16126 @c ?term vgalib
16127 @cindex vgalib
16128 @tmindex vgalib
16129
16130
16131 @c ?commands set terminal vgamono
16132 @c ?set terminal vgamono
16133 @c ?set term vgamono
16134 @c ?terminal vgamono
16135 @c ?term vgamono
16136 @cindex vgamono
16137 @tmindex vgamono
16138
16139
16140 @c ?commands set terminal svgalib
16141 @c ?set terminal svgalib
16142 @c ?set term svgalib
16143 @c ?terminal svgalib
16144 @c ?term svgalib
16145 @cindex svgalib
16146 @tmindex svgalib
16147
16148
16149 @c ?commands set terminal ssvgalib
16150 @c ?set terminal ssvgalib
16151 @c ?set term ssvgalib
16152 @c ?terminal ssvgalib
16153 @c ?term ssvgalib
16154 @cindex ssvgalib
16155 @tmindex ssvgalib
16156
16157
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."
16160
16161 @node fig, png, hercules, terminal_
16162 @subsubsection fig
16163
16164 @c ?commands set terminal fig
16165 @c ?set terminal fig
16166 @c ?set term fig
16167 @c ?terminal fig
16168 @c ?term fig
16169 @cindex fig
16170
16171 @cindex xfig
16172
16173 The `fig` terminal device generates output in the Fig graphics language.
16174
16175 Syntax:
16176 @example
16177       set terminal fig @{monochrome | color@}
16178                        @{landscape | portrait@}
16179                        @{small | big | size <xsize> <ysize>@}
16180                        @{metric | inches@}
16181                        @{pointsmax <max_points>@}
16182                        @{solid | dashed@}
16183                        @{font <fontname>@} @{fontsize <fsize>@}
16184                        @{textnormal | @{textspecial texthidden textrigid@}@}
16185                        @{@{thickness|linewidth@} <units>@}
16186                        @{depth <layer>@}
16187                        @{version <number>@}
16188
16189 @end example
16190
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".
16198
16199 `pointsmax <max_points>` sets the maximum number of points per polyline.
16200
16201 `solid` inhibits automatic usage of `dash`ed lines when solid linestyles are
16202 used up, which otherwise occurs.
16203
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. 
16208
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
16211 plot.
16212
16213 @ref{version} sets the format version of the generated fig output. Currently
16214 only versions 3.1 and 3.2 are supported.
16215
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`.
16223
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
16228 @example
16229         50 - 59:  circles
16230         60 - 69:  squares
16231         70 - 79:  diamonds
16232         80 - 89:  upwards triangles
16233         90 - 99:  downwards triangles
16234 @end example
16235
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.
16240
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).
16244
16245 See @ref{with} for details of <linetype> and <pointtype>.
16246
16247 The `big` option is a substitute for the `bfig` terminal in earlier versions,
16248 which is no longer supported.
16249
16250 Examples:
16251 @example
16252       set terminal fig monochrome small pointsmax 1000  # defaults
16253
16254 @end example
16255
16256 @example
16257       plot 'file.dat' with points linetype 102 pointtype 759
16258 @end example
16259
16260 would produce circles with a blue outline of width 1 and yellow fill color.
16261
16262 @example
16263       plot 'file.dat' using 1:2:3 with err linetype 1 pointtype 554
16264 @end example
16265
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).
16268
16269 To plot the error bars on top of the circles use
16270 @example
16271       plot 'file.dat' using 1:2:3 with err linetype 1 pointtype 2554"
16272
16273 @end example
16274
16275 @node png, ggi, fig, terminal_
16276 @subsubsection png
16277
16278 @c ?commands set terminal png
16279 @c ?set terminal png
16280 @c ?set term png
16281 @c ?terminal png
16282 @c ?term png
16283 @cindex png
16284 @tmindex png
16285
16286
16287 Syntax:
16288 @example
16289       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@}
16295              @{@{no@}enhanced@}
16296              @{<color0> <color1> <color2> ...@}
16297
16298 @end example
16299
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
16302 is required.
16303
16304 `transparent` instructs the driver to generate transparent PNGs.  The first
16305 color will be the transparent one. Default is `notransparent`.
16306
16307 `interlace` instructs the driver to generate interlaced PNGs.
16308 Default is `nointerlace`.
16309
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.
16315
16316 PNG plots may be conveniently viewed by piping the output to the
16317 'display' program from the ImageMagick package as follows:
16318 @example
16319                set term png
16320                set output '| display png:-'
16321
16322 @end example
16323
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}.
16327
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).
16332
16333 @cindex fonts
16334
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. 
16345
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.
16351
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`.
16356
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.
16362
16363 Examples:
16364 @example
16365       set terminal png medium size 640,480 \\
16366                        xffffff x000000 x404040 \\
16367                        xff0000 xffa500 x66cdaa xcdb5cd \\
16368                        xadd8e6 x0000ff xdda0dd x9500d3    # defaults
16369
16370 @end example
16371
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.
16375
16376 @example
16377       set terminal png font arial 14 size 800,600
16378
16379 @end example
16380
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.
16383
16384 @example
16385       set terminal png transparent xffffff \\
16386                        x000000 x202020 x404040 x606060 \\
16387                        x808080 xA0A0A0 xC0C0C0 xE0E0E0
16388
16389 @end example
16390
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.
16393
16394
16395 @node ggi, Gnugraph(GNU_plotutils), png, terminal_
16396 @subsubsection ggi
16397
16398 @c ?commands set terminal ggi
16399 @c ?set terminal ggi
16400 @c ?set term ggi
16401 @c ?terminal ggi
16402 @c ?term ggi
16403 @cindex ggi
16404 @tmindex ggi
16405
16406
16407 The `ggi` driver can run on different targets as X or svgalib.
16408
16409 Syntax:
16410 @example
16411    set terminal ggi [acceleration <integer>] [[mode] @{mode@}]
16412
16413 @end example
16414
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.:
16417 @example
16418  - V1024x768
16419  - V800x600
16420  - V640x480
16421  - V320x200
16422 @end example
16423
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
16427 example
16428 @example
16429    bash> export GGI_DISPLAY=DGA
16430    csh>  setenv GGI_DISPLAY DGA
16431
16432 @end example
16433
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.
16437
16438 Examples:
16439 @example
16440    set term ggi acc 10
16441    set term ggi acc 1 mode V1024x768
16442    set term ggi V1024x768"
16443
16444 @end example
16445
16446 @node Gnugraph(GNU_plotutils), gpic, ggi, terminal_
16447 @subsubsection Gnugraph(GNU plotutils)
16448
16449 @c ?commands set terminal gnugraph
16450 @c ?set terminal gnugraph
16451 @c ?set term gnugraph
16452 @c ?terminal gnugraph
16453 @c ?term gnugraph
16454 @cindex gnugraph
16455 @tmindex gnugraph
16456
16457
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
16461 @ref{size}.
16462
16463 Syntax:
16464 @example
16465       set terminal gnugraph @{"<fontname>"@} @{<fontsize>@}
16466                             @{type <pt>@} @{size "<size>"@}
16467
16468 @end example
16469
16470 which defaults to 10-point "Courier".
16471
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.
16477
16478 Examples:
16479 @example
16480       set terminal gnugraph type hpgl size "a4"
16481       set terminal gnugraph size "a4,xoffset=-5mm,yoffset=2.0cm" type pnm
16482
16483 @end example
16484
16485 There is a non-GNU version of the `gnugraph` driver which cannot be compiled
16486 unless this version is left out."
16487
16488 @node gpic, gpic_, Gnugraph(GNU_plotutils), terminal_
16489 @subsubsection gpic
16490
16491 @c ?commands set terminal gpic
16492 @c ?set terminal gpic
16493 @c ?set term gpic
16494 @c ?terminal gpic
16495 @c ?term gpic
16496 @cindex gpic
16497 @tmindex gpic
16498
16499
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).
16503
16504 Syntax:
16505 @example
16506       set terminal gpic @{<x> <y>@}
16507
16508 @end example
16509
16510 where `x` and `y` are in inches.
16511
16512 A simple graph can be formatted using
16513
16514 @example
16515       groff -p -mpic -Tps file.pic > file.ps.
16516
16517 @end example
16518
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,
16522
16523 @example
16524       set ylab '@@space 0 int from 0 to x alpha ( t ) roman d t@@'
16525
16526 @end example
16527
16528 will label the y axis with a nice integral if formatted with the command:
16529
16530 @example
16531       gpic filename.pic | geqn -d@@@@ -Tps | groff -m[macro-package] -Tps
16532           > filename.ps
16533
16534 @end example
16535
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):
16542
16543 @example
16544       .PS 8.0
16545       x=0;y=3
16546       copy "figa.pic"
16547       x=5;y=3
16548       copy "figb.pic"
16549       x=0;y=0
16550       copy "figc.pic"
16551       x=5;y=0
16552       copy "figd.pic"
16553       .PE
16554
16555 @end example
16556
16557 This will produce an 8-inch-wide figure with four graphs in two rows on top
16558 of each other.
16559
16560 One can also achieve the same thing by the command
16561
16562 @example
16563       set terminal gpic x y
16564
16565 @end example
16566
16567 for example, using
16568
16569 @example
16570       .PS 6.0
16571       copy "trig.pic"
16572       .PE"
16573
16574 @end example
16575
16576 @node gpic_, gpr, gpic, terminal_
16577 @subsubsection gpic
16578
16579 @c ?commands set terminal gpic
16580 @c ?set terminal gpic
16581 @c ?set term gpic
16582 @c ?terminal gpic
16583 @c ?term gpic
16584 @cindex gpic
16585 @tmindex gpic
16586
16587
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).
16591
16592 Syntax:
16593 @example
16594       set terminal gpic @{<x> <y>@}
16595
16596 @end example
16597
16598 where `x` and `y` are in inches.
16599
16600 A simple graph can be formatted using
16601
16602 @example
16603       groff -p -mpic -Tps file.pic > file.ps.
16604
16605 @end example
16606
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,
16610
16611 @example
16612       set ylab '@@space 0 int from 0 to x alpha ( t ) roman d t@@'
16613
16614 @end example
16615
16616 will label the y axis with a nice integral if formatted with the command:
16617
16618 @example
16619       gpic filename.pic | geqn -d@@@@ -Tps | groff -m[macro-package] -Tps
16620           > filename.ps
16621
16622 @end example
16623
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):
16630
16631 @example
16632       .PS 8.0
16633       x=0;y=3
16634       copy "figa.pic"
16635       x=5;y=3
16636       copy "figb.pic"
16637       x=0;y=0
16638       copy "figc.pic"
16639       x=5;y=0
16640       copy "figd.pic"
16641       .PE
16642
16643 @end example
16644
16645 This will produce an 8-inch-wide figure with four graphs in two rows on top
16646 of each other.
16647
16648 One can also achieve the same thing by the command
16649
16650 @example
16651       set terminal gpic x y
16652
16653 @end example
16654
16655 for example, using
16656
16657 @example
16658       .PS 6.0
16659       copy "trig.pic"
16660       .PE"
16661
16662 @end example
16663
16664 @node gpr, grass, gpic_, terminal_
16665 @subsubsection gpr
16666
16667 @c ?commands set terminal gpr
16668 @c ?set terminal gpr
16669 @c ?set term gpr
16670 @c ?terminal gpr
16671 @c ?term gpr
16672 @cindex gpr
16673 @tmindex gpr
16674
16675
16676 The `gpr` terminal driver supports the Apollo Graphics Primitive Resource
16677 for a fixed-size window.  It has no options.
16678
16679 If a variable window size is desired, use the `apollo` terminal instead."
16680
16681 @node grass, hp2623a, gpr, terminal_
16682 @subsubsection grass
16683
16684 @c ?commands set terminal grass
16685 @c ?set terminal grass
16686 @c ?set term grass
16687 @c ?terminal grass
16688 @c ?term grass
16689 @cindex grass
16690 @tmindex grass
16691
16692
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."
16697
16698 @node hp2623a, hp2648, grass, terminal_
16699 @subsubsection hp2623a
16700
16701 @c ?commands set terminal hp2623a
16702 @c ?set terminal hp2623a
16703 @c ?set term hp2623a
16704 @c ?terminal hp2623a
16705 @c ?term hp2623a
16706 @cindex hp2623a
16707 @tmindex hp2623a
16708
16709
16710 The `hp2623a` terminal driver supports the Hewlett Packard HP2623A.  It has
16711 no options."
16712
16713 @node hp2648, hp500c, hp2623a, terminal_
16714 @subsubsection hp2648
16715
16716 @c ?commands set terminal hp2648
16717 @c ?set terminal hp2648
16718 @c ?set term hp2648
16719 @c ?terminal hp2648
16720 @c ?term hp2648
16721 @cindex hp2648
16722 @tmindex hp2648
16723
16724
16725 The `hp2648` terminal driver supports the Hewlett Packard HP2647 and HP2648.
16726 It has no options."
16727
16728 @node hp500c, hpgl, hp2648, terminal_
16729 @subsubsection hp500c
16730
16731 @c ?commands set terminal hp500c
16732 @c ?set terminal hp500c
16733 @c ?set term hp500c
16734 @c ?terminal hp500c
16735 @c ?term hp500c
16736 @cindex hp500c
16737 @tmindex hp500c
16738
16739
16740 The `hp500c` terminal driver supports the Hewlett Packard HP DeskJet 500c.
16741 It has options for resolution and compression.
16742
16743 Syntax:
16744 @example
16745       set terminal hp500c @{<res>@} @{<comp>@}
16746
16747 @end example
16748
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."
16753
16754 @node hpgl, hpljii, hp500c, terminal_
16755 @subsubsection hpgl
16756
16757 @c ?commands set terminal hpgl
16758 @c ?set terminal hpgl
16759 @c ?set term hpgl
16760 @c ?terminal hpgl
16761 @c ?term hpgl
16762 @cindex hpgl
16763 @tmindex hpgl
16764
16765
16766 @c ?commands set terminal pcl5
16767 @c ?set terminal pcl5
16768 @c ?set term pcl5
16769 @c ?terminal pcl5
16770 @c ?term pcl5
16771 @cindex pcl5
16772 @tmindex pcl5
16773
16774
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.
16779
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
16782 details).
16783
16784 Syntax:
16785 @example
16786       set terminal hpgl @{<number_of_pens>@} @{eject@}
16787
16788 @end example
16789
16790 The selection
16791
16792 @example
16793       set terminal hpgl 8 eject
16794
16795 @end example
16796
16797 is equivalent to the previous `hp7550` terminal, and the selection
16798
16799 @example
16800       set terminal hpgl 4
16801
16802 @end example
16803
16804 is equivalent to the previous `hp7580b` terminal.
16805
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
16810 indicated below:
16811
16812 Syntax:
16813 @example
16814       set terminal pcl5 @{mode <mode>@} @{<plotsize>@}
16815           @{@{color @{<number_of_pens>@}@} | monochrome@} @{solid | dashed@}
16816           @{font <font>@} @{size <fontsize>@} @{pspoints | nopspoints@}
16817
16818 @end example
16819
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`.
16836
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.
16842
16843 Defaults: landscape, noextended, color (6 pens), solid, univers, 12 point,
16844 @example
16845           and nopspoints.
16846
16847 @end example
16848
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}.
16852
16853 HPGL graphics can be imported by many software packages."
16854
16855 @node hpljii, hppj, hpgl, terminal_
16856 @subsubsection hpljii
16857
16858 @c ?commands set terminal hpljii
16859 @c ?set terminal hpljii
16860 @c ?set term hpljii
16861 @c ?terminal hpljii
16862 @c ?term hpljii
16863 @cindex hpljii
16864 @tmindex hpljii
16865
16866
16867 @c ?commands set terminal hpdj
16868 @c ?set terminal hpdj
16869 @c ?set term hpdj
16870 @c ?terminal hpdj
16871 @c ?term hpdj
16872 @cindex hpdj
16873 @tmindex hpdj
16874
16875
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.
16879
16880 Syntax:
16881 @example
16882       set terminal hpljii | hpdj @{<res>@}
16883
16884 @end example
16885
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.
16888
16889 The `hp500c` terminal is similar to `hpdj`; `hp500c` additionally supports
16890 color and compression."
16891
16892 @node hppj, imagen, hpljii, terminal_
16893 @subsubsection hppj
16894
16895 @c ?commands set terminal hppj
16896 @c ?set terminal hppj
16897 @c ?set term hppj
16898 @c ?terminal hppj
16899 @c ?term hppj
16900 @cindex hppj
16901 @tmindex hppj
16902
16903
16904 The `hppj` terminal driver supports the HP PaintJet and HP3630 printers.  The
16905 only option is the choice of font.
16906
16907 Syntax:
16908 @example
16909       set terminal hppj @{FNT5X9 | FNT9X17 | FNT13X25@}
16910
16911 @end example
16912
16913 with the middle-sized font (FNT9X17) being the default."
16914
16915 @node imagen, iris4d, hppj, terminal_
16916 @subsubsection imagen
16917
16918 @c ?commands set terminal imagen
16919 @c ?set terminal imagen
16920 @c ?set term imagen
16921 @c ?terminal imagen
16922 @c ?term imagen
16923 @cindex imagen
16924 @tmindex imagen
16925
16926
16927 The `imagen` terminal driver supports Imagen laser printers.  It is capable
16928 of placing multiple graphs on a single page.
16929
16930 Syntax:
16931 @example
16932       set terminal imagen @{<fontsize>@} @{portrait | landscape@}
16933                           @{[<horiz>,<vert>]@}
16934
16935 @end example
16936
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.
16940
16941 Example:
16942 @example
16943       set terminal imagen portrait [2,3]
16944
16945 @end example
16946
16947 puts six graphs on the page in three rows of two in portrait orientation."
16948
16949 @node iris4d, kyo, imagen, terminal_
16950 @subsubsection iris4d
16951
16952 @c ?commands set terminal iris4d
16953 @c ?set terminal iris4d
16954 @c ?set term iris4d
16955 @c ?terminal iris4d
16956 @c ?term iris4d
16957 @cindex iris4d
16958 @tmindex iris4d
16959
16960
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.
16963
16964 Syntax:
16965 @example
16966       set terminal iris4d @{8 | 24@}
16967
16968 @end example
16969
16970 The color depth is not really a choice -- the value appropriate for the
16971 hardware should be selected.
16972
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:
16978
16979 @example
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)
16992
16993 @end example
16994
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."
16997
16998 @node kyo, latex, iris4d, terminal_
16999 @subsubsection kyo
17000
17001 @c ?commands set terminal kyo
17002 @c ?set terminal kyo
17003 @c ?set term kyo
17004 @c ?terminal kyo
17005 @c ?term kyo
17006 @cindex kyo
17007 @tmindex kyo
17008
17009
17010 @c ?commands set terminal prescribe
17011 @c ?set terminal prescribe
17012 @c ?set term prescribe
17013 @c ?terminal prescribe
17014 @c ?term prescribe
17015 @cindex prescribe
17016 @tmindex prescribe
17017
17018
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."
17022
17023 @node latex, linux, kyo, terminal_
17024 @subsubsection latex
17025
17026 @c ?commands set terminal emtex
17027 @c ?set terminal emtex
17028 @c ?set term emtex
17029 @c ?terminal emtex
17030 @c ?term emtex
17031 @cindex emtex
17032 @tmindex emtex
17033
17034
17035 @c ?commands set terminal latex
17036 @c ?set terminal latex
17037 @c ?set term latex
17038 @c ?terminal latex
17039 @c ?term latex
17040 @cindex latex
17041 @tmindex latex
17042
17043
17044 Syntax:
17045 @example
17046       set terminal @{latex | emtex@} @{default | @{courier|roman@} @{<fontsize>@}@}
17047                    @{size <XX>@{unit@}, <YY>@{unit@}@}
17048
17049 @end example
17050
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.
17056
17057 METAFONT users beware: METAFONT does not like odd sizes.
17058
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.
17066
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.
17071
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).
17075
17076 Examples:
17077 About label positioning:
17078 Use gnuplot defaults (mostly sensible, but sometimes not really best):
17079 @example
17080        set title '\\LaTeX\\ -- $ \\gamma $'
17081 @end example
17082
17083 Force centering both horizontally and vertically:
17084 @example
17085        set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
17086 @end example
17087
17088 Specify own positioning (top here):
17089 @example
17090        set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
17091 @end example
17092
17093 The other label -- account for long ticlabels:
17094 @example
17095        set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
17096
17097 @end example
17098
17099 @node linux, linux_, latex, terminal_
17100 @subsubsection linux
17101
17102 @c ?commands set terminal linux
17103 @c ?set terminal linux
17104 @c ?set term linux
17105 @c ?terminal linux
17106 @c ?term linux
17107 @cindex linux
17108 @tmindex linux
17109
17110
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
17114 (standard VGA)."
17115
17116 @node linux_, macintosh, linux, terminal_
17117 @subsubsection linux
17118
17119 @c ?commands set terminal linux
17120 @c ?set terminal linux
17121 @c ?set term linux
17122 @c ?terminal linux
17123 @c ?term linux
17124 @cindex linux
17125 @tmindex linux
17126
17127
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
17131 (standard VGA)."
17132
17133 @node macintosh, mf, linux_, terminal_
17134 @subsubsection macintosh
17135
17136 @c ?set terminal macintosh
17137 @c ?set term macintosh
17138 @c ?terminal macintosh
17139 @c ?term macintosh
17140 @cindex macintosh
17141 @tmindex macintosh
17142
17143
17144 Several options may be set in the 'macintosh' driver.
17145
17146 Syntax:
17147 @example
17148      set terminal macintosh @{singlewin | multiwin@} @{vertical | novertical@}
17149                             @{size <width>, <height> | default@}
17150
17151 @end example
17152
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
17156 @example
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'.
17161
17162 @end example
17163
17164 @example
17165  'set term mac size default' sets the window size settings to those set in
17166     the preferences dialog.
17167
17168 @end example
17169
17170 @example
17171  'set term mac default' sets all options to their default values.
17172     Default values: nogx, multiwin, novertical.
17173
17174 @end example
17175
17176 @example
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."
17183
17184 @end example
17185
17186 @node mf, mp, macintosh, terminal_
17187 @subsubsection mf
17188
17189 @c ?commands set terminal mf
17190 @c ?set terminal mf
17191 @c ?set term mf
17192 @c ?terminal mf
17193 @c ?term mf
17194 @cindex mf
17195
17196 @cindex metafont
17197
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.
17200
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.
17206
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.
17215
17216 The `mf` terminal has no options.
17217
17218
17219 @noindent --- METAFONT INSTRUCTIONS ---
17220
17221 @c ?commands set terminal mf detailed
17222 @c ?set terminal mf detailed
17223 @c ?set term mf detailed
17224 @c ?mf detailed
17225 @c ?metafont detailed
17226
17227 - Set your terminal to METAFONT:
17228 @example
17229   set terminal mf
17230 @end example
17231
17232 - Select an output-file, e.g.:
17233 @example
17234   set output "myfigures.mf"
17235 @end example
17236
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.
17240
17241 - Quit `gnuplot`.
17242
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
17248 example:
17249
17250 - Invoke METAFONT:
17251 @example
17252     virmf '&plain'
17253 @end example
17254
17255 - Select the output device: At the METAFONT prompt ('*') type:
17256 @example
17257     \\mode:=CanonCX;     % or whatever printer you use
17258 @end example
17259
17260 - Optionally select a magnification:
17261 @example
17262     mag:=1;             % or whatever you wish
17263 @end example
17264
17265 - Input the `gnuplot`-file:
17266 @example
17267     input myfigures.mf
17268 @end example
17269
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
17277 myfigures.300gf.
17278
17279 - Generate a PK file from the GF file using gftopk:
17280 @example
17281   gftopk myfigures.300gf myfigures.300pk
17282 @end example
17283
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
17291 find the PK file.
17292
17293 - To include your pictures in your document you have to tell TeX the font:
17294 @example
17295   \\font\\gnufigs=myfigures
17296 @end example
17297
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:
17302 @example
17303   \\centerline@{\\gnufigs\\char0@}
17304   \\centerline@{\\gnufigs\\char1@}
17305 @end example
17306
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.
17309
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."
17316
17317 @node mp, mgr, mf, terminal_
17318 @subsubsection mp
17319
17320 @c ?commands set terminal mpost
17321 @c ?set terminal mp
17322 @c ?set term mp
17323 @c ?terminal mp
17324 @c ?term mp
17325 @cindex mp
17326
17327 @cindex metapost
17328
17329
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.
17334
17335 Syntax:
17336 @example
17337    set term mp @{color | colour | monochrome@}
17338                @{solid | dashed@}
17339                @{notex | tex | latex@}
17340                @{magnification <magsize>@}
17341                @{psnfss | psnfss-version7 | nopsnfss@}
17342                @{prologues <value>@}
17343                @{a4paper@}
17344                @{amstex@}
17345                @{"<fontname>"@} @{<fontsize>@}
17346
17347 @end example
17348
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
17354 allowed.
17355
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.
17360
17361 The option `tex` sets the terminal to output its text for TeX to process.
17362
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.
17369
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)
17378 works as well.
17379
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 
17384 and textcomp.
17385
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.
17389
17390 The option `nopsnfss` is the default and uses the standard font (cmr10 if not
17391 otherwise specified).
17392
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.
17398
17399 The option `noprologues` is the default. No additional line specifying the prologue
17400 will be added.
17401
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.
17405
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
17408 included.
17409
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).
17418
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.
17423
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.
17429
17430 The following common ascii characters need special treatment in TeX:
17431 @example
17432    $, &, #, %, _;  |, <, >;  ^, ~,  \\, @{, and @}
17433 @end example
17434
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
17438 some guidance.
17439
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
17445 style of quotes.
17446
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.
17454
17455
17456
17457 @noindent --- METAPOST INSTRUCTIONS ---
17458
17459 @c ?commands set terminal mp detailed
17460 @c ?set terminal mp detailed
17461 @c ?set term mp detailed
17462 @c ?mp detailed
17463 @c ?metapost detailed
17464
17465 - Set your terminal to Metapost, e.g.:
17466 @example
17467    set terminal mp mono "cmtt12" 12
17468
17469 @end example
17470
17471 - Select an output-file, e.g.:
17472 @example
17473    set output "figure.mp"
17474
17475 @end example
17476
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.
17481
17482 - Quit gnuplot.
17483
17484 - Generate EPS files by running Metapost on the output of gnuplot:
17485 @example
17486    mpost figure.mp  OR  mp figure.mp
17487 @end example
17488
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
17491 for each picture.
17492
17493 - To include your pictures in your document you can use the graphics package
17494 in LaTeX or epsf.tex in plainTeX:
17495 @example
17496    \\usepackage@{graphics@} % LaTeX
17497    \\input epsf.tex       % plainTeX
17498 @end example
17499
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:
17502 @example
17503    \\DeclareGraphicsRule@{*@}@{eps@}@{*@}@{@}
17504 @end example
17505
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:
17509 @example
17510    \\includegraphics@{figure.2@} % LaTeX
17511    \\epsfbox@{figure.2@}         % plainTeX
17512
17513 @end example
17514
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."
17527
17528 @node mgr, mif, mp, terminal_
17529 @subsubsection mgr
17530
17531 @c ?commands set terminal mgr
17532 @c ?set terminal mgr
17533 @c ?set term mgr
17534 @c ?terminal mgr
17535 @c ?term mgr
17536 @cindex mgr
17537 @tmindex mgr
17538
17539
17540 The `mgr` terminal driver supports the Mgr Window system.  It has no options."
17541
17542 @node mif, mtos, mgr, terminal_
17543 @subsubsection mif
17544
17545 @c ?commands set terminal mif
17546 @c ?set terminal mif
17547 @c ?set term mif
17548 @c ?terminal mif
17549 @c ?term mif
17550 @cindex mif
17551 @tmindex mif
17552
17553
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".
17559
17560 Several options may be set in the MIF 3.00 driver.
17561
17562 Syntax:
17563 @example
17564       set terminal mif @{color | colour | monochrome@} @{polyline | vectors@}
17565                        @{help | ?@}
17566
17567 @end example
17568
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.
17575
17576 Examples:
17577 @example
17578       set term mif colour polylines    # defaults
17579       set term mif                     # defaults
17580       set term mif vectors
17581       set term mif help"
17582
17583 @end example
17584
17585 @node mtos, next, mif, terminal_
17586 @subsubsection mtos
17587
17588 @c ?commands set terminal mtos
17589 @c ?set terminal mtos
17590 @c ?set term mtos
17591 @c ?terminal mtos
17592 @c ?term mtos
17593 @cindex mtos
17594 @tmindex mtos
17595
17596
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."
17600
17601 @node next, Openstep_(next), mtos, terminal_
17602 @subsubsection next
17603
17604 @c ?commands set terminal next
17605 @c ?set terminal next
17606 @c ?set term next
17607 @c ?terminal next
17608 @c ?term next
17609 @cindex next
17610
17611 @cindex NeXT
17612
17613 Several options may be set in the next driver.
17614
17615 Syntax:
17616 @example
17617       set terminal next @{<mode>@} @{<type> @} @{<color>@} @{<dashed>@}
17618                  @{"<fontname>"@} @{<fontsize>@} title @{"<newtitle>"@}
17619
17620 @end example
17621
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.
17630
17631 Examples:
17632 @example
17633       set term next default
17634       set term next 22
17635       set term next color "Times-Roman" 14
17636       set term next color "Helvetica" 12 title "MyPlot"
17637       set term next old
17638
17639 @end example
17640
17641 Pointsizes may be changed with `set linestyle`."
17642
17643 @node Openstep_(next), pbm, next, terminal_
17644 @subsubsection Openstep (next)
17645
17646 @c ?commands set terminal openstep
17647 @c ?set terminal openstep
17648 @c ?set term openstep
17649 @c ?terminal openstep
17650 @c ?term openstep
17651 @cindex openstep
17652
17653 @cindex OpenStep
17654
17655 @cindex Openstep
17656
17657 /*
17658 @cindex next
17659
17660 @cindex NeXT
17661
17662 */
17663 Several options may be set in the openstep (next) driver.
17664
17665 Syntax:
17666 @example
17667       set terminal openstep @{<mode>@} @{<type> @} @{<color>@} @{<dashed>@}
17668                  @{"<fontname>"@} @{<fontsize>@} title @{"<newtitle>"@}
17669
17670 @end example
17671
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.
17680
17681 Examples:
17682 @example
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
17688
17689 @end example
17690
17691 Pointsizes may be changed with `set linestyle`."
17692
17693 @node pbm, dospc, Openstep_(next), terminal_
17694 @subsubsection pbm
17695
17696 @c ?commands set terminal pbm
17697 @c ?set terminal pbm
17698 @c ?set term pbm
17699 @c ?terminal pbm
17700 @c ?term pbm
17701 @cindex pbm
17702 @tmindex pbm
17703
17704
17705 Several options may be set in the `pbm` terminal---the driver for PBMplus.
17706
17707 Syntax:
17708 @example
17709       set terminal pbm @{<fontsize>@} @{<mode>@} @{size <x>,<y>@}
17710
17711 @end example
17712
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
17715 high.
17716
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).
17720
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/.
17726
17727 Examples:
17728 @example
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"
17732
17733 @end example
17734
17735 @node dospc, pdf, pbm, terminal_
17736 @subsubsection dospc
17737
17738 @c ?commands set terminal dospc
17739 @c ?set terminal dospc
17740 @c ?set term dospc
17741 @c ?terminal dospc
17742 @c ?term dospc
17743 @cindex dospc
17744 @tmindex dospc
17745
17746
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."
17750
17751 @node pdf, pstricks, dospc, terminal_
17752 @subsubsection pdf
17753
17754 @c ?commands set terminal pdf
17755 @c ?set terminal pdf
17756 @c ?set term pdf
17757 @c ?terminal pdf
17758 @c ?term pdf
17759 @cindex pdf
17760 @tmindex pdf
17761
17762
17763 This terminal produces files in the Adobe Portable Document Format
17764 (PDF), useable for printing or display with tools like Acrobat Reader
17765
17766 Syntax:
17767 @example
17768       set terminal pdf @{monochrome|color|colour@}
17769                        @{@{no@}enhanced@}
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@}@}
17775
17776 @end example
17777
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.
17782
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.
17787
17788 The `enhanced` option enables enhanced text processing features
17789 (subscripts, superscripts and mixed fonts). See `enhanced`.
17790
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.
17794
17795 `rounded` sets line caps and line joins to be rounded; `butt` is the
17796 default, butt caps and mitered joins.
17797
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).
17801
17802 * does not work.
17803
17804 @node pstricks, qms, pdf, terminal_
17805 @subsubsection pstricks
17806
17807 @c ?commands set terminal pstricks
17808 @c ?set terminal pstricks
17809 @c ?set term pstricks
17810 @c ?terminal pstricks
17811 @c ?term pstricks
17812 @cindex pstricks
17813 @tmindex pstricks
17814
17815
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.
17820
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.
17824
17825 Syntax:
17826 @example
17827       set terminal pstricks @{hacktext | nohacktext@} @{unit | nounit@}
17828
17829 @end example
17830
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`."
17833
17834 @node qms, regis, pstricks, terminal_
17835 @subsubsection qms
17836
17837 @c ?commands set terminal qms
17838 @c ?set terminal qms
17839 @c ?set term qms
17840 @c ?terminal qms
17841 @c ?term qms
17842 @cindex qms
17843 @tmindex qms
17844
17845
17846 The `qms` terminal driver supports the QMS/QUIC Laser printer, the Talaris
17847 1200 and others.  It has no options."
17848
17849 @node regis, regis_, qms, terminal_
17850 @subsubsection regis
17851
17852 @c ?commands set terminal regis
17853 @c ?set terminal regis
17854 @c ?set term regis
17855 @c ?terminal regis
17856 @c ?term regis
17857 @cindex regis
17858 @tmindex regis
17859
17860
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.
17863
17864 Syntax:
17865 @example
17866       set terminal regis @{4 | 16@}"
17867
17868 @end example
17869
17870 @node regis_, rgip, regis, terminal_
17871 @subsubsection regis
17872
17873 @c ?commands set terminal regis
17874 @c ?set terminal regis
17875 @c ?set term regis
17876 @c ?terminal regis
17877 @c ?term regis
17878 @cindex regis
17879 @tmindex regis
17880
17881
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.
17884
17885 Syntax:
17886 @example
17887       set terminal regis @{4 | 16@}"
17888
17889 @end example
17890
17891 @node rgip, sun, regis_, terminal_
17892 @subsubsection rgip
17893
17894 @c ?commands set terminal rgip
17895 @c ?set terminal rgip
17896 @c ?set term rgip
17897 @c ?terminal rgip
17898 @c ?term rgip
17899 @cindex rgip
17900 @tmindex rgip
17901
17902
17903 @c ?commands set terminal uniplex
17904 @c ?set terminal uniplex
17905 @c ?set term uniplex
17906 @c ?terminal uniplex
17907 @c ?term uniplex
17908 @cindex uniplex
17909 @tmindex uniplex
17910
17911
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
17914 given output file.
17915
17916 Syntax:
17917 @example
17918       set terminal rgip | uniplex @{portrait | landscape@}
17919                                   @{[<horiz>,<vert>]@} @{<fontsize>@}
17920
17921 @end example
17922
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].
17926
17927 Example:
17928 @example
17929       set terminal uniplex portrait [2,3]
17930
17931 @end example
17932
17933 puts six graphs on a page in three rows of two in portrait orientation."
17934
17935 @node sun, svg, rgip, terminal_
17936 @subsubsection sun
17937
17938 @c ?commands set terminal sun
17939 @c ?set terminal sun
17940 @c ?set term sun
17941 @c ?terminal sun
17942 @c ?term sun
17943 @cindex sun
17944 @tmindex sun
17945
17946
17947 The `sun` terminal driver supports the SunView window system.  It has no
17948 options."
17949
17950 @node svg, tek410x, sun, terminal_
17951 @subsubsection svg
17952
17953 @c ?commands set terminal svg
17954 @c ?set terminal svg
17955 @c ?set term svg
17956 @c ?terminal svg
17957 @c ?term svg
17958 @cindex svg
17959 @tmindex svg
17960
17961
17962 This terminal produces files in the W3C Scalable Vector Graphics format.
17963
17964 Syntax:
17965 @example
17966       set terminal svg @{size <x>,<y> @{|fixed|dynamic@}@}
17967                        @{@{no@}enhanced@}
17968                        @{fname "<font>"@} @{fsize <fontsize>@}
17969                        @{font "<fontname>@{,<fontsize>@}"@}
17970                        @{fontfile <filename>@}
17971                        @{rounded|butt@} @{solid|dashed@} @{linewidth <lw>@}
17972
17973 @end example
17974
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.
17978
17979 `linewidth <w>` increases the width of all lines used in the figure
17980 by a factor of <w>.
17981
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.
17985
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.
17990
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."
17999
18000 @node tek410x, tek410x_, svg, terminal_
18001 @subsubsection tek410x
18002
18003 @c ?commands set terminal tek410x
18004 @c ?set terminal tek410x
18005 @c ?set term tek410x
18006 @c ?terminal tek410x
18007 @c ?term tek410x
18008 @cindex tek410x
18009 @tmindex tek410x
18010
18011
18012 The `tek410x` terminal driver supports the 410x and 420x family of Tektronix
18013 terminals.  It has no options."
18014
18015 @node tek410x_, tek40, tek410x, terminal_
18016 @subsubsection tek410x
18017
18018 @c ?commands set terminal tek410x
18019 @c ?set terminal tek410x
18020 @c ?set term tek410x
18021 @c ?terminal tek410x
18022 @c ?term tek410x
18023 @cindex tek410x
18024 @tmindex tek410x
18025
18026
18027 The `tek410x` terminal driver supports the 410x and 420x family of Tektronix
18028 terminals.  It has no options."
18029
18030 @node tek40, texdraw, tek410x_, terminal_
18031 @subsubsection tek40
18032
18033 @c ?commands set terminal tek40xx
18034 @c ?set terminal tek40xx
18035 @c ?set term tek40xx
18036 @c ?terminal tek40xx
18037 @c ?term tek40xx
18038 @cindex tek40
18039 @tmindex tek40
18040
18041
18042 @c ?commands set terminal vttek
18043 @c ?set terminal vttek
18044 @c ?set term vttek
18045 @c ?terminal vttek
18046 @c ?term vttek
18047 @cindex vttek
18048 @tmindex vttek
18049
18050
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
18056 @cindex kc-tek40xx
18057 @tmindex kc-tek40xx
18058
18059
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
18065 @cindex km-tek40xx
18066 @tmindex km-tek40xx
18067
18068
18069 @c ?commands set terminal selanar
18070 @c ?set terminal selanar
18071 @c ?set term selanar
18072 @c ?terminal selanar
18073 @c ?term selanar
18074 @cindex selanar
18075 @tmindex selanar
18076
18077
18078 @c ?commands set terminal bitgraph
18079 @c ?set terminal bitgraph
18080 @c ?set term bitgraph
18081 @c ?terminal bitgraph
18082 @c ?term bitgraph
18083 @cindex bitgraph
18084 @tmindex bitgraph
18085
18086
18087 @c ?commands set terminal xterm
18088 @c ?set terminal xterm
18089 @c ?set term xterm
18090 @c ?terminal xterm
18091 @c ?term xterm
18092 @cindex xterm
18093 @tmindex xterm
18094
18095
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."
18102
18103 @node texdraw, tgif, tek40, terminal_
18104 @subsubsection texdraw
18105
18106 @c ?commands set terminal texdraw
18107 @c ?set terminal texdraw
18108 @c ?set term texdraw
18109 @c ?terminal texdraw
18110 @c ?term texdraw
18111 @cindex texdraw
18112 @tmindex texdraw
18113
18114
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.
18117
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.
18122
18123 It has no options."
18124
18125 @node tgif, tgif_, texdraw, terminal_
18126 @subsubsection tgif
18127
18128 @c ?commands set terminal tgif
18129 @c ?set terminal tgif
18130 @c ?set term tgif
18131 @c ?terminal tgif
18132 @c ?term tgif
18133 @cindex tgif
18134 @tmindex tgif
18135
18136
18137 Tgif is an X11-based drawing tool---it has nothing to do with GIF.
18138
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.
18143
18144 Syntax:
18145 @example
18146       set terminal tgif @{portrait | landscape | default@} @{<[x,y]>@}
18147                         @{monochrome | color@}
18148                         @{@{linewidth | lw@} <LW>@}
18149                         @{solid | dashed@}
18150                         @{font "<fontname>"@} @{<fontsize>@}
18151
18152 @end example
18153
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`.
18160
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
18163 chosen for that.
18164
18165 Multiplot is implemented in two different ways.
18166
18167 The first multiplot implementation is the standard gnuplot multiplot feature:
18168
18169 @example
18170       set terminal tgif
18171       set output "file.obj"
18172       set multiplot
18173       set origin x01,y01
18174       set size  xs,ys
18175       plot ...
18176            ...
18177       set origin x02,y02
18178       plot ...
18179       unset multiplot
18180
18181 @end example
18182
18183 See @ref{multiplot} for further information.
18184
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}).
18189
18190 If both multiplot methods are selected, the standard method is chosen and a
18191 warning message is given.
18192
18193 Examples of single plots (or standard multiplot):
18194 @example
18195       set terminal tgif                  # defaults
18196       set terminal tgif "Times-Roman" 24
18197       set terminal tgif landscape
18198       set terminal tgif landscape solid
18199
18200 @end example
18201
18202 Examples using the built-in multiplot mechanism:
18203 @example
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
18209                                         # directions"
18210
18211 @end example
18212
18213 @node tgif_, tkcanvas, tgif, terminal_
18214 @subsubsection tgif
18215
18216 @c ?commands set terminal tgif
18217 @c ?set terminal tgif
18218 @c ?set term tgif
18219 @c ?terminal tgif
18220 @c ?term tgif
18221 @cindex tgif
18222 @tmindex tgif
18223
18224
18225 Tgif is an X11-based drawing tool---it has nothing to do with GIF.
18226
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.
18231
18232 Syntax:
18233 @example
18234       set terminal tgif @{portrait | landscape | default@} @{<[x,y]>@}
18235                         @{monochrome | color@}
18236                         @{@{linewidth | lw@} <LW>@}
18237                         @{solid | dashed@}
18238                         @{font "<fontname>"@} @{<fontsize>@}
18239
18240 @end example
18241
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`.
18248
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
18251 chosen for that.
18252
18253 Multiplot is implemented in two different ways.
18254
18255 The first multiplot implementation is the standard gnuplot multiplot feature:
18256
18257 @example
18258       set terminal tgif
18259       set output "file.obj"
18260       set multiplot
18261       set origin x01,y01
18262       set size  xs,ys
18263       plot ...
18264            ...
18265       set origin x02,y02
18266       plot ...
18267       unset multiplot
18268
18269 @end example
18270
18271 See @ref{multiplot} for further information.
18272
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}).
18277
18278 If both multiplot methods are selected, the standard method is chosen and a
18279 warning message is given.
18280
18281 Examples of single plots (or standard multiplot):
18282 @example
18283       set terminal tgif                  # defaults
18284       set terminal tgif "Times-Roman" 24
18285       set terminal tgif landscape
18286       set terminal tgif landscape solid
18287
18288 @end example
18289
18290 Examples using the built-in multiplot mechanism:
18291 @example
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
18297                                         # directions"
18298
18299 @end example
18300
18301 @node tkcanvas, tpic, tgif_, terminal_
18302 @subsubsection tkcanvas
18303
18304 @c ?commands set terminal tkcanvas
18305 @c ?set terminal tkcanvas
18306 @c ?set term tkcanvas
18307 @c ?terminal tkcanvas
18308 @c ?term tkcanvas
18309 @cindex tkcanvas
18310 @tmindex tkcanvas
18311
18312
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
18316
18317 @example
18318  gnuplot> set term tkcanvas @{perltk@} @{interactive@}
18319  gnuplot> set output 'plot.file'
18320
18321 @end example
18322
18323 After invoking "wish", execute the following sequence of Tcl/Tk commands:
18324
18325 @example
18326  % source plot.file
18327  % canvas .c
18328  % pack .c
18329  % gnuplot .c
18330
18331 @end example
18332
18333 Or, for Perl/Tk use a program like this:
18334
18335 @example
18336  use Tk;
18337  my $top = MainWindow->new;
18338  my $c = $top->Canvas->pack;
18339  my $gnuplot = do "plot.pl";
18340  $gnuplot->($c);
18341  MainLoop;
18342
18343 @end example
18344
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.
18349
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.
18363
18364 The current version of `tkcanvas` supports neither @ref{multiplot} nor @ref{replot}."
18365
18366 @node tpic, unixpc, tkcanvas, terminal_
18367 @subsubsection tpic
18368
18369 @c ?commands set terminal tpic
18370 @c ?set terminal tpic
18371 @c ?set term tpic
18372 @c ?terminal tpic
18373 @c ?term tpic
18374 @cindex tpic
18375 @tmindex tpic
18376
18377
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.
18381
18382 Syntax:
18383 @example
18384       set terminal tpic <pointsize> <linewidth> <interval>
18385
18386 @end example
18387
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.
18391
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.
18399
18400 Examples:
18401 About label positioning:
18402 Use gnuplot defaults (mostly sensible, but sometimes not really best):
18403 @example
18404        set title '\\LaTeX\\ -- $ \\gamma $'
18405 @end example
18406
18407 Force centering both horizontally and vertically:
18408 @example
18409        set label '@{\\LaTeX\\ -- $ \\gamma $@}' at 0,0
18410 @end example
18411
18412 Specify own positioning (top here):
18413 @example
18414        set xlabel '[t]@{\\LaTeX\\ -- $ \\gamma $@}'
18415 @end example
18416
18417 The other label -- account for long ticlabels:
18418 @example
18419        set ylabel '[r]@{\\LaTeX\\ -- $ \\gamma $\\rule@{7mm@}@{0pt@}@}'"
18420
18421 @end example
18422
18423 @node unixpc, unixplot, tpic, terminal_
18424 @subsubsection unixpc
18425
18426 @c ?commands set terminal unixpc
18427 @c ?set terminal unixpc
18428 @c ?set term unixpc
18429 @c ?terminal unixpc
18430 @c ?term unixpc
18431 @cindex unixpc
18432 @tmindex unixpc
18433
18434
18435 The `unixpc` terminal driver supports AT&T 3b1 and AT&T 7300 Unix PC.  It has
18436 no options."
18437
18438 @node unixplot, vx384, unixpc, terminal_
18439 @subsubsection unixplot
18440
18441 @c ?commands set terminal unixplot
18442 @c ?set terminal unixplot
18443 @c ?set term unixplot
18444 @c ?terminal unixplot
18445 @c ?term unixplot
18446 @cindex unixplot
18447 @tmindex unixplot
18448
18449
18450 The `unixplot` terminal driver generates output in the Unix "plot" graphics
18451 language.  It has no options.
18452
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."
18455
18456 @node vx384, vgagl, unixplot, terminal_
18457 @subsubsection vx384
18458
18459 @c ?commands set terminal vx384
18460 @c ?set terminal vx384
18461 @c ?set term vx384
18462 @c ?terminal vx384
18463 @c ?term vx384
18464 @cindex vx384
18465 @tmindex vx384
18466
18467
18468 The `vx384` terminal driver supports the Vectrix 384 and Tandy color
18469 printers.  It has no options."
18470
18471 @node vgagl, VWS, vx384, terminal_
18472 @subsubsection vgagl
18473
18474 @c ?commands set terminal vgagl
18475 @c ?set terminal vgagl
18476 @c ?set term vgagl
18477 @c ?terminal vgagl
18478 @c ?term vgagl
18479 @cindex vgagl
18480 @tmindex vgagl
18481
18482
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.
18487
18488 Syntax:
18489 @example
18490    set terminal vgagl \\
18491                 background [red] [[green] [blue]] \\
18492                 [uniform | interpolate] \\
18493                 [dump "file"] \\
18494                 [mode]
18495
18496 @end example
18497
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
18503 color.
18504 The (mutually exclusive) options `interpolate` and `uniform` control
18505 if color interpolation is done while drawing triangles (on by default).
18506
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.
18512
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
18516 kernel.
18517
18518 The vgagl driver uses the first *available* vga mode from the following list:
18519 @example
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
18523  - G1024x768x256
18524  - G800x600x256
18525  - G640x480x256
18526  - G320x200x256
18527  - G1280x1024x256
18528  - G1152x864x256
18529  - G1360x768x256
18530  - G1600x1200x256
18531
18532 @end example
18533
18534
18535 @node VWS, windows, vgagl, terminal_
18536 @subsubsection VWS
18537
18538 @c ?commands set terminal VWS
18539 @c ?set terminal VWS
18540 @c ?set term VWS
18541 @c ?terminal VWS
18542 @c ?term VWS
18543 @cindex VWS
18544 @tmindex VWS
18545
18546
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."
18550
18551 @node windows, x11, VWS, terminal_
18552 @subsubsection windows
18553
18554 @c ?commands set terminal windows
18555 @c ?set terminal windows
18556 @c ?set term windows
18557 @c ?terminal windows
18558 @c ?term windows
18559 @cindex windows
18560 @tmindex windows
18561
18562
18563 Three options may be set in the `windows` terminal driver.
18564
18565 Syntax:
18566 @example
18567       set terminal windows @{color | monochrome@}
18568                            @{enhanced | noenhanced@}
18569                            @{@{font@} "fontname@{,fontsize@}" @{<fontsize>@}@}
18570
18571 @end example
18572
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.
18578
18579 Other options may be set with the graph-menu or the initialization file.
18580
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.
18589
18590
18591 @noindent --- GRAPH-MENU ---
18592
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
18597 @cindex graph-menu
18598 @tmindex graph-menu
18599
18600
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
18603 system menu:
18604
18605 `Bring to Top` when checked brings the graph window to the top after every
18606 plot.
18607
18608 `Color` when checked enables color linestyles.  When unchecked it forces
18609 monochrome linestyles.
18610
18611 `Copy to Clipboard` copies a bitmap and a Metafile picture.
18612
18613 `Background...` sets the window background color.
18614
18615 `Choose Font...` selects the font used in the graphics window.
18616
18617 `Line Styles...` allows customization of the line colors and styles.
18618
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
18622 drivers.
18623
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
18627 `WGNUPLOT.INI`.
18628
18629
18630 @noindent --- PRINTING ---
18631
18632 @c ?commands set terminal windows printing
18633 @c ?set terminal windows printing
18634 @c ?set term windows printing
18635 @c ?windows printing
18636 @cindex printing
18637 @tmindex printing
18638
18639
18640 In order of preference, graphs may be be printed in the following ways.
18641
18642 `1.` Use the `gnuplot` command @ref{terminal} to select a printer and @ref{output} to redirect output to a file.
18643
18644 `2.` Select the `Print...` command from the `gnuplot graph` window.  An extra
18645 command `screendump` does this from the text window.
18646
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
18652 printer.
18653
18654
18655 @noindent --- TEXT-MENU ---
18656
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
18661 @cindex text-menu
18662 @tmindex text-menu
18663
18664
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
18667 menu:
18668
18669 `Copy to Clipboard` copies marked text to the clipboard.
18670
18671 `Paste` copies text from the clipboard as if typed by the user.
18672
18673 `Choose Font...` selects the font used in the text window.
18674
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
18677 white background.
18678
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
18681 `WGNUPLOT.INI`.
18682
18683 `MENU BAR`
18684
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.
18687 Menu commands:
18688
18689 [Menu] starts a new menu with the name on the following line.
18690
18691 [EndMenu] ends the current menu.
18692
18693 [--] inserts a horizontal menu separator.
18694
18695 [|] inserts a vertical menu separator.
18696
18697 [Button] puts the next macro on a push button instead of a menu.
18698
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:
18701
18702 [INPUT] --- Input string with prompt terminated by [EOS] or @{ENTER@}
18703
18704 [EOS] --- End Of String terminator.  Generates no output.
18705
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
18708 @{ENTER@}.
18709
18710 [SAVE] --- Get name of file to save.  Similar to [OPEN]
18711
18712 Macro character substitutions:
18713
18714 @{ENTER@} --- Carriage Return '\\r'
18715
18716 @{TAB@} --- Tab '\\011'
18717
18718 @{ESC@} --- Escape '\\033'
18719
18720 @{^A@} --- '\\001'
18721
18722 ...
18723
18724 @{^_@} --- '\\031'
18725
18726 Macros are limited to 256 characters after expansion.
18727
18728
18729 @noindent --- WGNUPLOT.INI ---
18730
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
18737
18738
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:
18741
18742 @example
18743       [WGNUPLOT]
18744       TextOrigin=0 0
18745       TextSize=640 150
18746       TextFont=Terminal,9
18747       GraphOrigin=0 150
18748       GraphSize=640 330
18749       GraphFont=Arial,10
18750       GraphColor=1
18751       GraphToTop=1
18752       GraphBackground=255 255 255
18753       Border=0 0 0 0 0
18754       Axis=192 192 192 2 2
18755       Line1=0 0 255 0 0
18756       Line2=0 255 0 0 1
18757       Line3=255 0 0 0 2
18758       Line4=255 0 255 0 3
18759       Line5=0 0 128 0 4
18760
18761 @end example
18762
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."
18772
18773 @node x11, x11_, windows, terminal_
18774 @subsubsection x11
18775
18776 @c ?commands set terminal x11
18777 @c ?set terminal x11
18778 @c ?set term x11
18779 @c ?terminal x11
18780 @c ?term x11
18781 @cindex x11
18782
18783 @cindex X11
18784
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.
18789
18790 Syntax:
18791 @example
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@}
18797                     @{close@}
18798                     @{size XX,YY@} @{position XX,YY@}
18799    set terminal x11 @{reset@}
18800
18801 @end example
18802
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).
18808
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.
18813
18814 @example
18815    set term x11 enhanced font "arial,15" 
18816    set title '@{/=20 Big@} Medium @{/=5 Small@}' 
18817
18818 @end example
18819
18820 @example
18821    set term x11 enhanced font "terminal-14" 
18822    set title '@{/=20 Big@} Medium @{/=5 Small@}' 
18823
18824 @end example
18825
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.
18835
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
18839 location.
18840
18841 Plot windows will automatically be closed at the end of the session
18842 unless the `-persist` option was given.
18843
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}.
18851
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.
18855
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.
18858
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.
18861
18862 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
18863 window.
18864
18865 Linewidths and pointsizes may be changed from within `gnuplot` with
18866 `set linestyle`.
18867
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.
18872
18873 @cindex X resources
18874
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})
18880
18881
18882 @noindent --- X11_FONTS ---
18883
18884 @c ?commands set terminal x11 x11_fonts
18885 @c ?set terminal x11 x11_fonts
18886 @c ?set term x11 x11_fonts
18887 @c ?x11 x11_fonts
18888 @cindex x11_fonts
18889
18890 @cindex fonts
18891
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.
18894
18895 Example:
18896 @example
18897       gnuplot*font: lucidasans-bold-12
18898 @end example
18899
18900 A new default font may be specified to the x11 driver from inside
18901 gnuplot using
18902 @example
18903      `set term x11 font "<fontspec>"`
18904 @end example
18905
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
18909 of the form
18910 @example
18911       -*-<font>-<weight>-<s>-*-*-<size>-*-*-*-*-*-<encoding>
18912
18913 @end example
18914
18915 @example
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}).
18921 @end example
18922
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.
18929 @example
18930       gnuplot*encoding: iso8859-15
18931 @end example
18932
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}.
18936
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.
18943
18944 Example:
18945 @example
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-*'
18952
18953 @end example
18954
18955 The same syntax applies to the default font in Xresources settings,
18956 for example,
18957 @example
18958       gnuplot*font: \\
18959           mbfont:-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0
18960
18961 @end example
18962
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:".
18966
18967
18968
18969 @noindent --- COMMAND-LINE_OPTIONS ---
18970
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
18976
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)`:
18981
18982 @example
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
18996
18997 @end example
18998
18999 @cindex X resources
19000
19001 The options are shown above in their command-line syntax.  When entered as
19002 resources in ".Xdefaults", they require a different syntax.
19003
19004 Example:
19005 @example
19006       gnuplot*gray:  on
19007       gnuplot*ctrlq: on
19008
19009 @end example
19010
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.
19017
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.
19021
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.
19027
19028
19029
19030 @noindent --- MONOCHROME_OPTIONS ---
19031
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
19037
19038 @cindex X resources
19039
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.
19043
19044
19045
19046 @noindent --- COLOR_RESOURCES ---
19047
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
19053
19054 @cindex X resources
19055
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.
19062
19063 @example
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
19076
19077 @end example
19078
19079
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
19084
19085 Examples:
19086
19087 @example
19088       gnuplot -background coral
19089 @end example
19090
19091 to change the background color.
19092
19093 @example
19094       gnuplot -xrm 'gnuplot*line1Color:blue'
19095 @end example
19096
19097 to override the first linetype color.
19098
19099
19100
19101 @noindent --- GRAYSCALE_RESOURCES ---
19102
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
19108
19109 @cindex X resources
19110
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.
19114
19115 @example
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
19128
19129 @end example
19130
19131
19132
19133
19134 @noindent --- LINE_RESOURCES ---
19135
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
19141
19142 @cindex X resources
19143
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
19147 some plots.
19148
19149 @example
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
19160
19161 @end example
19162
19163
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 
19173
19174 @example
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
19186
19187 @end example
19188
19189 , "
19190
19191
19192 @noindent --- X11 PM3D_RESOURCES ---
19193
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
19199
19200 @c ?x11 pm3d
19201 @cindex X resources
19202
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.
19206
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).
19213
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.
19221
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).
19225
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
19230 preferred choice.
19231
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.
19239
19240 Example: on an 8bit PseudoColor visual you can force a private color map
19241 by specifying `gnuplot*maxcolors: 240` and `gnuplot*mincolors: 240`.
19242
19243
19244 @example
19245  gnuplot*maxcolors:  <integer>
19246  gnuplot*mincolors:  <integer>
19247  gnuplot*visual:     <visual name>
19248
19249 @end example
19250
19251 , "
19252
19253
19254 @noindent --- X11 OTHER_RESOURCES ---
19255
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
19261
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.
19265
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'
19269
19270
19271 @example
19272  gnuplot*exportselection:  off
19273  gnuplot*fastrotate:  on
19274  gnuplot*ctrlq:  off
19275
19276 @end example
19277
19278
19279
19280 @node x11_, xlib, x11, terminal_
19281 @subsubsection x11
19282
19283 @c ?commands set terminal x11
19284 @c ?set terminal x11
19285 @c ?set term x11
19286 @c ?terminal x11
19287 @c ?term x11
19288 @cindex x11
19289
19290 @cindex X11
19291
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.
19296
19297 Syntax:
19298 @example
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@}
19304                     @{close@}
19305                     @{size XX,YY@} @{position XX,YY@}
19306    set terminal x11 @{reset@}
19307
19308 @end example
19309
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).
19315
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.
19320
19321 @example
19322    set term x11 enhanced font "arial,15" 
19323    set title '@{/=20 Big@} Medium @{/=5 Small@}' 
19324
19325 @end example
19326
19327 @example
19328    set term x11 enhanced font "terminal-14" 
19329    set title '@{/=20 Big@} Medium @{/=5 Small@}' 
19330
19331 @end example
19332
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.
19342
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
19346 location.
19347
19348 Plot windows will automatically be closed at the end of the session
19349 unless the `-persist` option was given.
19350
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}.
19358
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.
19362
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.
19365
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.
19368
19369 The size or aspect ratio of a plot may be changed by resizing the `gnuplot`
19370 window.
19371
19372 Linewidths and pointsizes may be changed from within `gnuplot` with
19373 `set linestyle`.
19374
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.
19379
19380 @cindex X resources
19381
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})
19387
19388
19389 @noindent --- X11_FONTS ---
19390
19391 @c ?commands set terminal x11 x11_fonts
19392 @c ?set terminal x11 x11_fonts
19393 @c ?set term x11 x11_fonts
19394 @c ?x11 x11_fonts
19395 @cindex x11_fonts
19396
19397 @cindex fonts
19398
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.
19401
19402 Example:
19403 @example
19404       gnuplot*font: lucidasans-bold-12
19405 @end example
19406
19407 A new default font may be specified to the x11 driver from inside
19408 gnuplot using
19409 @example
19410      `set term x11 font "<fontspec>"`
19411 @end example
19412
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
19416 of the form
19417 @example
19418       -*-<font>-<weight>-<s>-*-*-<size>-*-*-*-*-*-<encoding>
19419
19420 @end example
19421
19422 @example
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}).
19428 @end example
19429
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.
19436 @example
19437       gnuplot*encoding: iso8859-15
19438 @end example
19439
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}.
19443
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.
19450
19451 Example:
19452 @example
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-*'
19459
19460 @end example
19461
19462 The same syntax applies to the default font in Xresources settings,
19463 for example,
19464 @example
19465       gnuplot*font: \\
19466           mbfont:-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0
19467
19468 @end example
19469
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:".
19473
19474
19475
19476 @noindent --- COMMAND-LINE_OPTIONS ---
19477
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
19483
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)`:
19488
19489 @example
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
19503
19504 @end example
19505
19506 @cindex X resources
19507
19508 The options are shown above in their command-line syntax.  When entered as
19509 resources in ".Xdefaults", they require a different syntax.
19510
19511 Example:
19512 @example
19513       gnuplot*gray:  on
19514       gnuplot*ctrlq: on
19515
19516 @end example
19517
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.
19524
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.
19528
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.
19534
19535
19536
19537 @noindent --- MONOCHROME_OPTIONS ---
19538
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
19544
19545 @cindex X resources
19546
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.
19550
19551
19552
19553 @noindent --- COLOR_RESOURCES ---
19554
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
19560
19561 @cindex X resources
19562
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.
19569
19570 @example
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
19583
19584 @end example
19585
19586
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
19591
19592 Examples:
19593
19594 @example
19595       gnuplot -background coral
19596 @end example
19597
19598 to change the background color.
19599
19600 @example
19601       gnuplot -xrm 'gnuplot*line1Color:blue'
19602 @end example
19603
19604 to override the first linetype color.
19605
19606
19607
19608 @noindent --- GRAYSCALE_RESOURCES ---
19609
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
19615
19616 @cindex X resources
19617
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.
19621
19622 @example
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
19635
19636 @end example
19637
19638
19639
19640
19641 @noindent --- LINE_RESOURCES ---
19642
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
19648
19649 @cindex X resources
19650
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
19654 some plots.
19655
19656 @example
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
19667
19668 @end example
19669
19670
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 
19680
19681 @example
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
19693
19694 @end example
19695
19696 , "
19697
19698
19699 @noindent --- X11 PM3D_RESOURCES ---
19700
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
19706
19707 @c ?x11 pm3d
19708 @cindex X resources
19709
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.
19713
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).
19720
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.
19728
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).
19732
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
19737 preferred choice.
19738
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.
19746
19747 Example: on an 8bit PseudoColor visual you can force a private color map
19748 by specifying `gnuplot*maxcolors: 240` and `gnuplot*mincolors: 240`.
19749
19750
19751 @example
19752  gnuplot*maxcolors:  <integer>
19753  gnuplot*mincolors:  <integer>
19754  gnuplot*visual:     <visual name>
19755
19756 @end example
19757
19758 , "
19759
19760
19761 @noindent --- X11 OTHER_RESOURCES ---
19762
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
19768
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.
19772
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'
19776
19777
19778 @example
19779  gnuplot*exportselection:  off
19780  gnuplot*fastrotate:  on
19781  gnuplot*ctrlq:  off
19782
19783 @end example
19784
19785
19786
19787 @node xlib, xlib_, x11_, terminal_
19788 @subsubsection xlib
19789
19790 @c ?commands set terminal xlib
19791 @c ?set terminal xlib
19792 @c ?set term xlib
19793 @c ?terminal xlib
19794 @c ?term xlib
19795 @cindex xlib
19796 @tmindex xlib
19797
19798
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`."
19804
19805 @node xlib_,  , xlib, terminal_
19806 @subsubsection xlib
19807
19808 @c ?commands set terminal xlib
19809 @c ?set terminal xlib
19810 @c ?set term xlib
19811 @c ?terminal xlib
19812 @c ?term xlib
19813 @cindex xlib
19814 @tmindex xlib
19815
19816
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`."
19822
19823 @node Graphical_User_Interfaces, Bugs, Terminal_types, Top
19824 @chapter Graphical User Interfaces
19825
19826 @c ?graphical user interfaces
19827 @cindex gui's
19828
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
19831 interface at
19832 @uref{http://py-gnuplot.darwinports.com/,http://py-gnuplot.darwinports.com/
19833 }
19834
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
19838 }
19839
19840 In addition three Tcl/Tk located at the usual Tcl/Tk repositories exist.
19841
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/
19848 }
19849
19850
19851 @menu
19852 * Bugs::                        
19853 @end menu
19854
19855 @node Bugs, Concept_Index, Graphical_User_Interfaces, Top
19856 @chapter Bugs
19857
19858 @cindex bugs
19859
19860 Bugs reported since the current release as well as older ones
19861 may be located via the official distribution site on SourceForge.
19862
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}.
19868
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.
19872
19873
19874 @menu
19875 * Gnuplot_limitations::         
19876 * External_libraries::          
19877 @end menu
19878
19879 @node Gnuplot_limitations, External_libraries, Bugs, Bugs
19880 @section Gnuplot limitations
19881
19882 @c ?bugs gnuplot
19883 @cindex gamma
19884 @findex gamma
19885
19886
19887 @cindex bessel
19888
19889 @cindex timefmt
19890 @opindex timefmt
19891
19892
19893 @cindex load
19894 @cmindex load
19895
19896
19897 @cindex nohidden3d
19898
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.
19905
19906 The gamma and bessel functions do not work for complex arguments.
19907
19908 If a command line contains a "load" command, then anything on the line after
19909 the "load <filename>" is ignored.
19910
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.
19914
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.
19918
19919 Error bars are not handled properly in polar/spherical coordinate plot modes.
19920
19921 The 'nohidden3d' option that is supposed to exempt individual plots from the
19922 global property 'set hidden3d' does not work for parametric curves.
19923
19924
19925 @node External_libraries,  , Gnuplot_limitations, Bugs
19926 @section External libraries
19927
19928 @c ?bugs external_libraries
19929 @cindex libgd
19930
19931 @cindex svgalib
19932 @tmindex svgalib
19933
19934
19935 @cindex locale
19936 @opindex locale
19937
19938
19939 @cindex internationalization
19940
19941 @cindex pdf
19942 @tmindex pdf
19943
19944
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.
19949
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.
19954
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.
19958
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
19967 @printindex cp
19968
19969 @node Command_Index, Options_Index, Concept_Index, Top
19970 @unnumbered Command Index
19971 @printindex cm
19972
19973 @node Options_Index, Function_Index, Command_Index, Top
19974 @unnumbered Options Index
19975 @printindex op
19976
19977 @node Function_Index, Terminal_Index, Options_Index, Top
19978 @unnumbered Function Index
19979 @printindex fn
19980
19981 @node Terminal_Index,  , Function_Index, Top
19982 @unnumbered Terminal Index
19983 @printindex tm
19984
19985 @c @shortcontents
19986 @contents
19987 @bye