1 % Quick Reference Card for gnuplot 2004
3 % $Id: gpcard.tex,v 1.5 2004/04/30 09:28:24 mikulik Exp $
5 % Format stolen shamelessly from the GNU Emacs reference card
8 \newcount\columnsperpage
10 % This file can be printed with 1, 2, or 3 columns per page (see below).
11 % Specify how many you want here. Nothing else needs to be changed.
12 % For gnuplot refcard, entries are too wide for 3 columns. Print
17 % Copyright (c) 1987 Free Software Foundation, Inc.
19 % This file is part of GNU Emacs, but was adapted for the gnuplot
20 % reference card because it was so nicely set up.
22 % This file is intended to be processed by plain TeX (TeX82).
24 % The final reference card has six columns, three on each side.
25 % This file can be used to produce it in any of three ways:
27 % produces six separate pages, each of which needs to be reduced to 80%.
28 % This gives the best resolution.
30 % produces three already-reduced pages.
31 % You will still need to cut and paste.
33 % produces two pages which must be printed sideways to make a
34 % ready-to-use 8.5 x 11 inch reference card.
35 % For this you need a dvi device driver that can print sideways.
36 % Which mode to use is controlled by setting \columnsperpage above.
38 % Author of GNU Emacs Refcard:
40 % UUCP: mit-erl!gildea
41 % Internet: gildea@erl.mit.edu
43 % Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
44 % for their many good ideas.
46 % Person who ripped off the formatter:
48 % NASA Ames Research Center
49 % Internet: woo@ames.arc.nasa.gov
51 % Modified on 9 Dec 1992 by:
53 % University of Illinois
54 % Internet: d-lewart@uiuc.edu
56 % make \bye not \outer so that the \def\bye in the \else clause below
57 % can be scanned without complaint.
58 \def\bye{\par\vfill\supereject\end}
61 \vskip 1ex plus 2 fill\begingroup\small
62 Layout adapted from the \TeX\ source for Stephen Gildea's GNU Emacs
63 Reference Card (version 1.8).
65 PostScript is a registered trademark of Adobe Systems Incorporated.
66 GNU, Versatec, Imagen, Printronix, Canon, GraphOn, Visual, MicroVAX,
67 UIS, Tektronix, Unix, VAX, VMS, NeWS, SunView, and em4010 are all
68 trademarks of various companies. We endorse none of them.
72 \newdimen\intercolumnskip
76 \def\ncolumns{\the\columnsperpage}
78 \message{[\ncolumns\space
79 column\if 1\ncolumns\else s\fi\space per page]}
81 \def\scaledmag#1{ scaled \magstep #1}
83 % This multi-way format was designed by Stephen Gildea
85 % modified for gnuplot refcard by Alex Woo
92 \font\titlefont=\fontname\tenbf \scaledmag3
93 \font\headingfont=\fontname\tenbf \scaledmag2
94 \font\smallfont=\fontname\sevenrm
95 \font\smallsy=\fontname\sevensy
98 \def\makefootline{\baselineskip10pt\hsize6.5in\line{\the\footline}}
105 \font\titlefont=cmbx10 \scaledmag2
106 \font\headingfont=cmbx10 \scaledmag1
120 \normalbaselineskip=.8\normalbaselineskip
121 \normallineskip=.8\normallineskip
122 \normallineskiplimit=.8\normallineskiplimit
123 \normalbaselines\rm %make definitions take effect
127 \footline{\hss\rm\folio\hss}
128 \def\makefootline{\vskip 2in \hsize=6.86in\line{\the\footline}}
133 \errhelp{You must set \columnsperpage equal to 1, 2, or 3.}
134 \errmessage{Illegal number of columns per page}
137 \intercolumnskip=.46in
140 % This next line is useful when designing the layout.
141 %\immediate\write16{Column \folio\abc\space starts with \firstmark}
142 \if \maxcolumn\abc \multicolumnformat \global\def\abc{a}
144 \global\setbox\columna\columnbox \global\def\abc{b}
145 %% in case we never use \columnb (two-column mode)
146 \global\setbox\columnb\hbox to -\intercolumnskip{}
148 \global\setbox\columnb\columnbox \global\def\abc{c}\fi\fi}
149 \def\multicolumnformat{\shipout\vbox{\makeheadline
150 \hbox{\box\columna\hskip\intercolumnskip
151 \box\columnb\hskip\intercolumnskip\columnbox}
152 \makefootline}\advancepageno}
153 \def\columnbox{\leftline{\pagebody}}
155 \def\bye{\par\vfill\supereject
156 \if a\abc \else\null\vfill\eject\fi
157 \if a\abc \else\null\vfill\eject\fi
161 % we won't be using math mode much, so redefine some of the characters
162 % we might want to talk about
170 \hyphenation{mini-buf-fer}
173 \parskip 1ex plus .5ex minus .5ex
175 \def\small{\smallfont\textfont2=\smallsy\baselineskip=.8\baselineskip}
177 \outer\def\newcolumn{\vfill\eject}
179 \outer\def\title#1{{\titlefont\centerline{#1}}\vskip 1ex plus .5ex}
181 \outer\def\section#1{\par\filbreak
182 \vskip 3ex plus 2ex minus 2ex {\headingfont #1}\mark{#1}%
183 \vskip 2ex plus 1ex minus 1.5ex}
187 \def\beginindentedkeys{\keyindent=1em}
188 \def\endindentedkeys{\keyindent=0em}
191 \def\paralign{\vskip\parskip\halign}
193 \def\<#1>{$\langle${\rm #1}$\rangle$}
195 \def\kbd#1{{\tt#1}\null} %\null so not an abbrev even if period follows
197 \def\beginexample{\par\leavevmode\begingroup
198 \obeylines\obeyspaces\parskip0pt\tt}
199 {\obeyspaces\global\let =\ }
200 \def\endexample{\endgroup}
203 \def\key#1#2{\leavevmode\hbox to \hsize{\vtop
204 % {\hsize=.75\hsize\rightskip=1em
205 {\hsize=.5\hsize\rightskip=1em
206 \hskip\keyindent\relax#1}\kbd{#2}\hfil}}
209 \setbox\metaxbox\hbox{\kbd{M-x }}
211 \metaxwidth=\wd\metaxbox
213 \def\metax#1#2{\leavevmode\hbox to \hsize{\hbox to .75\hsize
214 {\hskip\keyindent\relax#1\hfil}%
215 \hskip -\metaxwidth minus 1fil
218 \def\threecol#1#2#3{\hskip\keyindent\relax#1\hfil&\kbd{#2}\quad
224 \title{gnuplot Quick Reference}
226 \centerline{(Copyright(c) Alex Woo 1992 June 1)}
227 \centerline{Updated by Hans-Bernhard Br\"o{}ker, April 2004}
229 \section{Starting gnuplot}
231 \key{to enter gnuplot}{gnuplot}
232 \key{to enter batch gnuplot}{gnuplot macro_file}
233 \key{to pipe commands to gnuplot}{application | gnuplot}
235 see below for environment variables you might want to change
236 before entering gnuplot.
238 \section{Exiting gnuplot}
240 \key{exit gnuplot}{quit}
242 All gnuplot commands can be abbreviated to the first few
243 unique letters, usually three characters. This reference uses
244 the complete name for clarity.
246 \section{Getting Help}
248 \key{introductory help} {help plot}
249 \key{help on a topic}{help <topic>}
250 \key{list of all help available}{help or ?}
251 \key{show current environment}{show all}
252 \section{Command-line Editing}
254 The UNIX, MS-DOS and VMS versions of gnuplot support command-line
255 editing and a command history. EMACS style editing is supported.
261 \key{move back a single character}{^ B}
262 \key{move forward a single character}{^ F}
263 \key{moves to the beginning of the line}{^ A}
264 \key{moves to the end of the line}{^ E}
265 \key{delete the previous character} {^ H and DEL }
266 \key{deletes the current character} {^ D}
267 \key{deletes to the end of line}{^ K}
268 \key{redraws line in case it gets trashed}{ ^ L,^ R}
269 \key{deletes the entire line}{ ^ U}
270 \key{deletes the last word}{ ^ W}
276 \key{moves back through history}{ ^ P }
277 \key{moves forward through history}{ ^ N }
280 The following arrow keys may be used on most PC versions if READLINE
286 \key{Left Arrow}{same as ^ B}
287 \key{Right Arrow}{same as ^ F}
288 \key{Ctrl Left Arrow}{same as ^ A}
289 \key{Ctrl Right Arrow}{same as ^ E}
290 \key{Up Arrow}{same as ^ P}
291 \key{Down Arrow}{same as ^ N}
296 \section{Graphics Devices}
298 All screen graphics devices are specified by names and options. This
299 information can be read from a startup file (.gnuplot in UNIX). If
300 you change the graphics device, you must replot with the \kbd{replot}
301 command or recreate it repeating the \kbd{load} of the script that
304 \key{get a list of valid devices }{set terminal [options]}
310 \key{Mac OS X} {set term aqua}
311 \key{AED 512 Terminal} {set term aed512}
312 \key{AED 767 Terminal} {set term aed767}
313 \key{Amiga} {set term amiga}
314 \key{Adobe Illustrator 3.0 Format} {set term aifm}
315 \key{Apollo graphics primitive, rescalable} {set term apollo}
316 \key{Atari ST} {set term atari}
317 \key{BBN Bitgraph Terminal} {set term bitgraph}
318 \key{SCO CGI Driver} {set term cgi}
319 \key{Apollo graphics primitive, fixed window} {set term gpr}
320 \key{SGI GL window} {set term iris4d [8 24]}
321 \key{MS-DOS Kermit Tek4010 term - color} {set term kc_tek40xx}
322 \key{MS-DOS Kermit Tek4010 term - mono} {set term km_tek40xx}
323 \key{NeXTstep window system} {set term next}
324 \key{OS/2 Presentation Manager} {set term pm}
325 \key{REGIS graphics language} {set term regis}
326 \key{Selanar Tek Terminal} {set term selanar}
327 \key{SunView window system} {set term sun}
328 \key{Tektronix 4106, 4107, 4109 \& 420X } {set term tek4OD10x}
329 \key{Tektronix 4010; most TEK emulators} {set term tek40xx}
330 \key{VAX UIS window system} {set term VMS}
331 \key{VT-like tek40xx terminal emulator} {set term vttek}
332 \key{UNIX plotting (not always supplied)} {set term unixplot}
333 \key{AT\&T 3b1 or 7300 UNIXPC} {set term unixpc}
334 \key{MS Windows} {set term windows}
335 \key{X11 display terminal} {set term x11}
341 Turbo C PC Graphics Modes:
343 \key{Hercules}{set term hercules}
344 \key{Color Graphics Adaptor}{set term cga}
345 \key{Monochrome CGA}{set term mcga}
346 \key{Extended Graphics Adaptor}{set term ega}
347 \key{VGA} {set term vga}
348 \key{Monochrome VGA} {set term vgamono}
349 \key{Super VGA - requires SVGA driver}{set term svga}
350 \key{AT\&T 6300 Micro}{set term att}
358 \key{Unknown - not a plotting device} {set term unknown}
359 \key{Dump ASCII table of X Y [Z] values}{set term table}
360 \key{printer or glass dumb terminal} {set term dumb}
361 \key{Roland DXY800A plotter} {set term dxy800a}
365 \key{Epson-style 60-dot per inch printers} {set term epson_60dpi}
366 \key{Epson LX-800, Star NL-10 }{set term epson_lx800}
367 \key{NX-1000, PROPRINTER }{set term epson_lx800}
368 \key{NEC printer CP6, Epson LQ-800 }
369 {set term nec_cp6 [monochrome color draft]}
370 \key{Star Color Printer} {set term starc}
371 \key{Tandy DMP-130 60-dot per inch } {set term tandy_60dpi}
372 \key{Vectrix 384 \& Tandy color printer} {set term vx384}
376 \key{Talaris EXCL language}{set term excl}
377 \key{Imagen laser printer} {set term imagen}
378 \key{LN03-Plus in EGM mode} {set term ln03}
379 \key{PostScript graphics language }
380 {set term post [mode color `font' size]}
382 {set term corel [mode color `font' size]}
383 \key{Prescribe - for the Kyocera Laser Printer} {set term prescribe}
384 \key{Kyocera Laser Printer with Courier font} {set term kyo}
385 \key{QMS/QUIC Laser (also Talaris 1200 )}{set term qms}
389 \key{AutoCAD DXF (120x80 default)} {set term dxf}
390 \key{FIG graphics language: SunView or X }{set term fig}
391 \key{FIG graphics language: Large Graph}{set term bfig}
392 \key{SCO hardcopy CGI}{set term hcgi}
393 \key{Frame Maker MIF 3.0}
394 {set term mif [pentype curvetype help]}
395 \key{Portable bitmap} {set term pbm [fontsize color]}
396 \key{Uniplex Redwood Graphics Interface Protocol}{set term rgip}
397 \key{TGIF language} {set term tgif}
401 \key{HP2623A and maybe others} {set term hp2623A}
402 \key{HP2648 and HP2647} {set term hp2648}
403 \key{HP7580, \& probably other HPs (4 pens)} {set term hp7580B}
404 \key{HP7475 \& lots of others (6 pens)} {set term hpgl}
405 \key{HP Laserjet series II \& clones} {set term hpljii [75 100 150 300]}
406 \key{HP DeskJet 500} {set term hpdj [75 100 150 300]}
407 \key{HP PaintJet \& HP3630 }
408 {set term hppj [FNT5X9 FNT9X17 FNT13x25]}
409 \key{HP laserjet III ( HPGL plot vectors)}
410 {set term pcl5 [mode font fontsize ]}
412 TeX picture environments
414 \key{LaTeX picture environment} {set term latex}
415 \key{EEPIC -- extended LaTeX picture } {set term eepic}
416 \key{LaTeX picture with emTeX specials} {set term emtex}
417 \key{PSTricks macros for TeX or LaTeX} {set term pstricks}
418 \key{TPIC specials for TeX or LaTeX} {set term tpic}
419 \key{MetaFont font generation input} {set term mf}
421 Saving and restoring terminal
423 \key{restore default or pushed terminal} {set term pop}
424 \key{save (push) current terminal} {set term push}
426 Commands associated to interactive terminals
428 \key{change mouse settings} {set mouse}
429 \key{change hotkey bindings} {bind}
436 \key{{\bf plot} a data file}{plot `fspec'}
437 \key{{\bf load} in a macro file}{load `fspec'}
438 \key{{\bf save} command buffer to a macro file}{save `fspec'}
439 \key{{\bf save settings} for later reuse}{save set `fpec'}
441 \section{PLOT \& SPLOT commands}
444 {\bf plot} and {\bf splot} are the primary commands
445 {\bf plot} is used to plot 2-d
446 functions and data, while {\bf splot} plots 3-d surfaces and data.
450 plot $\{$ranges$\}$ $<$function$> \{$title$\} \{$style$\}$
451 $\{, <$function$> \{$title$\} \{$style$\}...\}$
453 splot $\{$ranges$\} <$function$> \{$title$\} \{$style$\}$
454 $\{, <$function$> \{$title$\} \{$style$\}...\}$
456 where $<$function$>$ is either a mathematical expression, the name of a
457 data file enclosed in quotes, or a pair ({\bf plot}) or triple ({\bf splot})
458 of mathematical expressions in the case of parametric functions.
459 User-defined functions and variables may also be defined here.
460 Examples will be given below.
462 \section{Plotting Data}
463 Discrete data contained in a file can displayed by specifying the
464 name of the data file (enclosed in quotes) on the {\bf plot} or {\bf splot}
465 command line. Data files should contain one data point per line.
466 Lines beginning with \# (or ! on VMS) will be treated as comments
467 and ignored. For {\bf plot}s, each data point represents an (x,y)
468 pair. For {\bf splot}s, each point is an (x,y,z) triple. For {\bf plot}s with
469 error bars (see {\bf plot errorbars}), each data point is either
470 (x,y,ydelta), (x,y,ylow,yhigh), (x,y,xlow,xhigh), (x,y,xdelta,ydelta), or
471 (x,y,xlow,xhigh,ylow,yhigh). In all cases, the numbers on each
472 line of a data file must be separated by blank space. This blank
473 space divides each line into columns.
475 For {\bf plot}s the x value may be omitted, and for {\bf splot}s the x
476 and y values may be omitted. In either case the omitted values are
477 assigned the current coordinate number. Coordinate numbers start at 0
478 and are incremented for each data point read.
480 \section{Surface Plotting}
481 Implicitly, there are two types of 3-d datafiles. If all the isolines
482 are of the same length, the data is assumed to be a grid data, i.e.,
483 the data has a grid topology. Cross isolines in the other parametric
484 direction (the ith cross isoline passes thru the ith point of all the
485 provided isolines) will also be drawn for grid data. (Note contouring
486 is available for grid data only.) If all the isolines are not of the
487 same length, no cross isolines will be drawn and contouring that data
490 \section{Using Pipes}
492 On some computer systems with a popen function (Unix, plus some
493 others), the datafile can be piped through a shell command by starting
494 the file name with a '$<$'. For example:
496 pop(x) = 103*exp(x/10)
497 plot "$<$ awk '$\{$ print \$1-1965 \$2 $\}$' population.dat", pop(x)
499 would plot the same information as the first population example
500 but with years since 1965 as the x axis. Simple manipulations
501 of this kind can also be done using the extended capabilties of {\bf using}
503 Similarly, output can be piped to another application, e.g.
505 set out "$|$lpr -Pmy\_laser\_printer"
507 \section{Plot Data Using}
508 The format of data within a file can be selected with the {\bf using}
509 option. An explicit scanf string can be used, or simpler column
512 \key{plot "datafile"}{ $\{$ using $\{ <$ycol$> |$}
513 \key{}{$<$xcol$>:<$ycol$> |$}
514 \key{}{$<$xcol$>:<$ycol$>:<$ydelta$> |$}
515 \key{}{$<$xcol$>:<$ycol$>:<$width$> |$}
516 \key{}{$<$xcol$>:<$ycol$>:<$xdelta$> |$}
517 \key{}{$<$xcol$>:<$ycol$>:<$ylo$>:<$yhi$> |$}
518 \key{}{$<$xcol$>:<$ycol$>:<$xlo$>:<$xhi$> |$}
519 \key{}{$<$xcol$>:<$ycol$>:<$xdelta$>:<$ydelta$> |$}
520 \key{}{$<$xcol$>:<$ycol$>:<$ydelta$>:<$width$> |$}
521 \key{}{$<$xcol$>:<$ycol$>:<$ylo$>:<$yhi$>:<$width$> |$}
522 \key{}{$<$xc$>:<$yc$>:<$xlo$>:<$xhi$>:<$ylo$>:<$yhi$> \}$}
523 \key{}{$\{$"<scanf string>"$\} \} ...$}
525 \key{splot "datafile"}
526 {$\{$ using $\{ <$xcol$>:<$ycol$>:<$zcol$> \}$}
527 \key{}{$\{"<$scanf string$>"\} \} ...$}
529 $<$xcol$>$, $<$ycol$>$, and $<$zcol$>$ explicitly select the columns
530 to plot from a space or tab separated multicolumn data file. If only
531 $<$ycol$>$ is selected for {\bf plot}, $<$xcol$>$ defaults to 1. If
532 only $<$zcol$>$ is selected for {\bf splot}, then only that column is
533 read from the file. An $<$xcol$>$ of 0 forces $<$ycol$>$ to be plotted
534 versus its coordinate number. $<$xcol$>$, $<$ycol$>$, and $<$zcol$>$
535 can be entered as constants or expressions. Expressions enclosed in
536 parentheses can be used to compute a column data value from all
537 numbers in the input record.
539 If errorbars (see also {\bf plot errorbars}) are used for {\bf plot}s,
540 xdelta or ydelta (for example, a +/- error) should be provided as the
541 third column, or (x,y)low and (x,y)high as third and fourth columns.
542 These columns must follow the x and y columns. If errorbars in both
543 directions are wanted then xdelta and ydelta should be in the third
544 and fourth columns, respectively, or xlow, xhigh, ylow, yhigh should
545 be in the third, fourth, fifth, and sixth columns, respectively.
547 Scanf strings override any $<$xcol$>$:$<$ycol$>$(:$<$zcol$>$) choices,
548 except for ordering of input, e.g.,
550 \key{plot "datafile"}{ using 2:1 "\%f\%*f\%f"}
552 causes the first column to be y and the third column to be x.
554 If the scanf string is omitted, the default is generated based on the
555 $<$xcol$>$:$<$ycol$>$(:$<$zcol$>$) choices. If the {\bf using} option
556 is omitted, ''\%f\%f'' is used for {\bf plot} (''\%f\%f\%f\%f'' or
557 ''\%f\%f\%f\%f\%f\%f'' for {\bf errorbar} {\bf plot}s) and
558 ''\%f\%f\%f'' is used for {\bf splot}.
560 \key{plot "MyData"} {using "\%*f\%f\%*20[^$\backslash$n]\%f" w lines}
562 Data are read from the file ``MyData'' using the format
563 ''\%*f\%f\%*20[^$\backslash$n]\%f''. The meaning of this format is:
564 ''\%*f'' ignore the first number, ''\%f'' then read in the second and
565 assign to x, ''\%*20[^$\backslash$n]'' then ignore 20 non-newline
566 characters, ''\%f'' then read in the y value.
568 \section{Plot With Errorbars}
569 Error bars are supported for 2-d data file plots by reading one to
570 four additional columns specifying ydelta, ylow and yhigh, xdelta,
571 xlow and xhigh, xdelta and ydelta, or xlow, xhigh, ylow, and yhigh
572 respectively. No support exists for error bars for {\bf splot}s.
574 In the default situation, gnuplot expects to see three to six
575 numbers on each line of the data file, either (x, y, ydelta),
576 (x, y, ylow, yhigh), (x, y, xdelta), (x, y, xlow, xhigh),
577 (x, y, xdelta, ydelta), or (x, y, xlow, xhigh, ylow, yhigh). The x
578 coordinate must be specified. The order of the numbers must be exactly
579 as given above. Data files in this format can easily be plotted with error
582 plot "data.dat" with errorbars (or yerrorbars)
584 plot "data.dat" with xerrorbars
586 plot "data.dat" with xyerrorbars
588 The error bar is a line plotted from (x, ylow) to (x,
589 yhigh) or (xlow, y) to (xhigh, y). If ydelta is specified instead
590 of ylow and yhigh, ylow=y-ydelta and yhigh=y+ydelta are derived. The
591 values for xlow and xhigh are derived similarly from xdelta. If there
592 are only two numbers on the line, yhigh and ylow are both set to
593 y and xhigh and xlow are both set to x. To get lines plotted between
594 the data points, {\bf plot} the data file twice, once with errorbars and
597 If x or y autoscaling is on, the x or y range will be adjusted to fit the
600 Boxes may be drawn with y error bars using the {\bf boxerrorbars} style. The
601 width of the box may be either set with the "set boxwidth" command, given in
602 one of the data columns, or calculated automatically so each box touches the
604 Boxes may be drawn instead of the cross drawn for the {\bf xyerrorbars} style
605 by using the {\bf boxxyerrorbars} style.
607 \key{x,y,ylow \& yhigh from columns 1,2,3,4}{plot "data.dat" us 1:2:3:4 w errorbars}
608 \key{x from third, y from second, xdelta from 6}{plot "data.dat" using 3:2:6 w xerrorbars}
609 \key{x,y,xdelta \& ydelta from columns 1,2,3,4}{plot "data.dat" us 1:2:3:4 w
612 \section{Plot Ranges}
613 The optional range specifies the region of the plot that will be
616 Ranges may be provided on the {\bf plot} and {\bf splot} command line and
617 affect only that plot, or in the {\bf set xrange}, {\bf set yrange}, etc.,
618 commands, to change the default ranges for future plots.
620 \key{[$\{<$dummy-var$> =\} \{<$xmin$> : <$xmax$>\}$]} { $\{$ [$\{<$ymin$> : <$ymax$>\}$] $\}$}
622 where $<$dummy-var$>$ is the independent variable (the defaults are x and
623 y, but this may be changed with {\bf set dummy}) and the min and max
624 terms can be constant expressions.
626 Both the min and max terms are optional. The ':' is also optional
627 if neither a min nor a max term is specified. This allows '[ ]' to
628 be used as a null range specification.
630 Specifying a range in the {\bf plot} command line turns autoscaling for
631 that axis off for that plot. Using one of the {\bf set} range commands
632 turns autoscaling off for that axis for future plots, unless changed
633 later. (See {\bf set autoscale}).
635 \key{This uses the current ranges}{plot cos(x)}
636 \key{This sets the x range only}{plot [-10:30] sin(pi*x)/(pi*x)}
637 \key{This sets both the x and y ranges}{plot [-pi:pi] [-3:3] tan(x), 1/x}
638 \key{sets only y range, \&} {plot [ ] [-2:sin(5)*-8] sin(x)**besj0(x)}
639 \key{turns off autoscaling on both axes}{}
640 \key{This sets xmax and ymin only}{plot [:200] [-pi:] exp(sin(x))}
641 \key{This sets the x, y, and z ranges}{splot [0:3] [1:4] [-1:1] x*y}
643 \section{Plot With Style}
644 Plots may be displayed in one of twelve styles: {\bf lines}, {\bf points},
645 {\bf linespoints}, {\bf impulses}, {\bf dots}, {\bf steps},
646 {\bf errorbars} (or {\bf yerrorbars}), {\bf xerrorbars}, {\bf xyerrorbars},
647 {\bf boxes}, {\bf boxerrorbars}, or {\bf boxxyerrorbars}. The {\bf lines} style
648 connects adjacent points with lines. The {\bf points} style displays a
649 small symbol at each point. The {\bf linespoints} style does both
650 {\bf lines} and {\bf points}. The {\bf impulses} style displays a vertical line
651 from the x axis (or from the grid base for {\bf splot}) to each point. The
652 {\bf dots} style plots a tiny dot at each point; this is useful for
653 scatter plots with many points. The {\bf steps} style is used for drawing
654 stairstep-like functions. The {\bf boxes} style may be used for barcharts.
656 The {\bf errorbars} style is only relevant to 2-d data file plotting. It
657 is treated like {\bf points} for {\bf splot}s and function {\bf plot}s. For
659 {\bf plot}s, {\bf errorbars} is like {\bf points}, except that a vertical error
660 bar is also drawn: for each point (x,y), a line is drawn from
661 (x,ylow) to (x,yhigh). A tic mark is placed at the ends of the error
662 bar. The ylow and yhigh values are read from the data file's columns,
663 as specified with the {\bf using} option to plot. The {\bf xerrorbars}
664 style is similar except that it draws a horizontal error bar from xlow to
665 xhigh. The {\bf xyerrorbars} or {\bf boxxyerrorbars} style is used for data
666 with errors in both x and y. A barchart style may be used in conjunction with y
667 error bars through the use of {\bf boxerrorbars}. The See {\bf plot errorbars}
668 for more information.
670 Default styles are chosen with the {\bf set function style} and
671 {\bf set data style} commands.
673 By default, each function and data file will use a different
674 line type and point type, up to the maximum number of available
675 types. All terminal drivers support at least six different point
676 types, and re-use them, in order, if more than six are required.
677 The LaTeX driver supplies an additional six point types (all variants
678 of a circle), and thus will only repeat after twelve curves are
681 If desired, the style and (optionally) the line type and point type
682 used for a curve can be specified.
684 \key{with $<$style$>$}{$ \{<$linetype$> \{<$pointtype$>\}\}$}
686 where $<$style$>$ is either {\bf lines}, {\bf points}, {\bf linespoints}, {\bf impulses},
687 {\bf dots}, {\bf steps}, {\bf errorbars} (or {\bf yerrorbars}),
688 {\bf xerrorbars}, {\bf xyerrorbars}, {\bf boxes}, {\bf boxerrorbars},
689 {\bf boxxyerrorbars}.
691 The $<$linetype$>$ \& $<$pointtype$>$ are positive
692 integer constants or expressions and specify the line type and point
693 type to be used for the plot. Line type 1 is the first line type used
694 by default, line type 2 is the second line type used by default, etc.
696 \key{plots sin(x) with impulses}{plot sin(x) with impulses}
697 \key{plots x*y with points, x**2 + y**2 default}{splot x*y w points, x**2 + y**2}
698 \key{plots tan(x) with default function style}
699 {plot [ ] [-2:5] tan(x)}
700 \key{plots ``data.1'' with lines}{plot "data.1" with l}
701 \key{plots ``leastsq.dat'' with impulses} {plot 'leastsq.dat' w i}
702 \key{plots ``exper.dat'' with errorbars \& }
703 {plot 'exper.dat' w l, 'exper.dat' w err}
704 \key{ lines connecting points}{}
706 Here 'exper.dat' should have three or four data columns.
708 \key{plots x**2 + y**2 and x**2 - y**2 with the same line type}
709 {splot x**2 + y**2 w l 1, x**2 - y**2 w l 1}
710 \key{plots sin(x) and cos(x) with linespoints, using}
711 {plot sin(x) w linesp 1 3, \\}
712 \key{ the same line type but different point types}{ cos(x) w linesp 1 4}
713 \key{plots file ``data'' with points style 3}
714 {plot "data" with points 1 3}
716 Note that the line style must be specified when specifying the point
717 style, even when it is irrelevant. Here the line style is 1 and the
718 point style is 3, and the line style is irrelevant.
720 See {\bf set style} to change the default styles.
724 A title of each plot appears in the key. By default the title is
725 the function or file name as it appears on the plot command line.
726 The title can be changed by using the {\bf title} option. This option
727 should precede any {\bf with} option.
729 \key{ title "$<$title$>$"}{}
731 where $<$title$>$ is the new title of the plot and must be enclosed in
732 quotes. The quotes will not be shown in the key.
734 \key{plots y=x with the title 'x'} {plot x}
735 \key{plots the ``glass.dat'' file}
736 {splot "glass.dat" tit 'revolution surface'}
737 \key{with the title 'revolution surface'}{}
738 \key{plots x squared with title ``x^2'' and ``data.1''}
739 {plot x**2 t "x^2", \\}
740 \key{ with title 'measured data'}{ "data.1" t 'measured data'}
742 \section{Set-Show Commands}
744 All commands below begin with either {\bf set} or {\bf unset}, and
745 usually their state can be shown by passing their name to the {\bf
749 \key{unit any angles are given in}{angles [degrees|radians]}
750 \key{arrows from point to}{arrow [<tag>][from <sx>,<sy>,<sz>]}
751 \key{}{ [to <ex>,<ey>,<ez>][head|nohead|heads]}
752 \key{force autoscaling of an axis}{autoscale [<axes>]}
753 \key{enter/exit parametric mode} {parametric}
754 \key{display border}{border [<choice>] [<style>]}
755 \key{clip points/line near boundaries}{clip <clip-type>}
756 \key{specify parameters for contour plots}{cntrparam
757 [spline][points][order][levels]}
758 \key{enable splot contour plots}{contour [base|surface|both]}
759 \key{default plotting style for data}{data style <style-choice>}
760 \key{specify dummy variable}{dummy <dummy1>,<dummy2>...}
761 \key{tic-mark label format specification}{format
762 [<axes>]["format-string"]}
763 \key{function plotting style}{function style <style-choice>}
764 \key{draw a grid at tick positions}{grid [<which tics>...] [<linestyle>]}
765 \key{enables hiddenline removal}{hidden3d [\dots]}
766 \key{specify number of isolines}{isosamples <n1>[,<n2>]}
767 \key{enables key of curves in plot}{key [\dots]}
768 \key{logscaling of axes (optionally giving base)}{logscale <axes> [<base>]}
769 \key{mapping 3D coordinates}{mapping [cartesian|spherical|cylindrical]}
770 \key{offsets from center of graph}{offsets <left>,<right>,<top>,<bottom>}
771 \key{color-mapped plotting modes}{pm3d [\dots]}
772 \key{mapping 2D coordinates}{polar}
773 \key{set radial range}{rrange [<rmin>:<rmax>]}
774 \key{set sampling rate of functions}{samples <expression>}
775 \key{set scaling factors of plot}{size <xsize>,<ysize>}
776 \key{control display of isolines of surface}{surface}
777 \key{control graphics device}{terminal <device>}
778 \key{change direction of tics}{tics <direction>}
779 \key{adjust relative height of vertical axis}{ticslevel <level>}
780 \key{adjust size of tick marks}{ticscale [<size>]}
781 \key{turn on time/date stamp}{time}
782 \key{set centered plot title}{title "title-text" <xoff>,<yoff>}
783 \key{set parametric range}{trange [<tmin>:<tmax>]}
784 \key{set surface parametric ranges}{urange or vrange}
785 \key{sets the view point for {\bf splot}}{view
786 <rot_x>,<rot_z>,<scale>,<scale_z>}
787 \key{sets the top view (map) for {\bf splot}}{view map}
788 \key{sets x-axis label}{xlabel "<label>" <xoff>,<yoff>}
789 \key{set horizontal range}{xrange [<xmin>:<xmax>]}
790 \key{change horizontal tics}{xtics <start>,<incr>,<end>,}
791 \key{}{"<label>" <pos> }
792 \key{adjust number of minor tick marks}{mxtics OR mytics [<freq>]}
793 \key{draw x-axis}{xzeroaxis}
794 \key{sets y-axis label}{ylabel "<label>" <xoff>,<yoff>}
795 \key{set vertical range}{yrange [<ymin>:<ymax>]}
796 \key{change vertical tics}{ytics <start>,<incr>,<end>,}
797 \key{}{"<label>" <pos> }
798 \key{draw y-axis}{yzeroaxis}
799 \key{set default threshold for values near 0}{zero <expression>}
800 \key{draw axes}{zeroaxis}
801 \key{sets z-axis label}{zlabel "<label>" <xoff>,<yoff>}
802 \key{set vertical range}{zrange [<zmin>:<zmax>]}
803 \key{change vertical tics}{ztics <start>,<incr>,<end>,}
804 \key{}{"<label>" <pos> }
805 \key{draw z-axis}{zzeroaxis}
808 \section{Contour Plots}
809 Enable contour drawing for surfaces. This option is available for {\bf splot}
813 set contour $\{$ base $|$ surface $|$ both $\}$
816 If no option is provided to {\bf set contour}, the default is {\bf base}.
817 The three options specify where to draw the contours: {\bf base} draws
818 the contours on the grid base where the x/ytics are placed, {\bf surface}
819 draws the contours on the surfaces themselves, and {\bf both} draws the
820 contours on both the base and the surface.
822 See also {\bf set cntrparam} for the parameters that affect the drawing of
825 \section{Contour Parameters}
826 Sets the different parameters for the contouring plot (see also {\bf contour}).
828 \key{set cntrparam}{ $\{ \{$ linear $|$ cubicspline $|$ bspline $\} |$}
829 \key{}{points $<$n$>$ $|$ }
830 \key{}{order $<$n$>$ $|$ }
831 \key{}{levels \{ [ auto ] $<$n$>$ $|$ }
832 \key{}{discrete $<$z1$>$ $<$z2$>$ ... $|$ }
833 \key{}{incr $<$start$>$ $<$increment$>$ [ $<$n$>$ ] $\} \}$ }
835 \key{5 automatic levels}{set cntrparam levels auto 5}
836 \key{3 discrete levels at 10\%, 37\% and 90\%}
837 {set cntrp levels discrete .1 1/exp(1) .9}
838 \key{5 incremental levels at 0, .1, .2, .3 and .4}
839 {set cntrparam levels incremental 0 .1 5 }
840 \key{sets n = 10 retaining current setting of auto, incr., or discr.}
841 {set cntrparam levels 10 }
842 \key{set start = 100 and increment = 50, retaining old n}
843 {set cntrparam levels incremental 100 50}
845 This command controls the way contours are plotted. $<$n$>$ should be an
846 integral constant expression and $<$z1$>$, $<$z2$>$ any constant expressions.
849 {\bf linear}, {\bf cubicspline}, {\bf bspline} - Controls type of approximation or
850 interpolation. If {\bf linear}, then the contours are drawn piecewise
851 linear, as extracted from the surface directly. If {\bf cubicspline}, then
852 piecewise linear contours are interpolated to form a somewhat smoother
853 contours, but which may undulate. The third option is the uniform
854 {\bf bspline}, which only approximates the piecewise linear data but is
855 guaranteed to be smoother.
857 {\bf points} - Eventually all drawings are done with piecewise linear
858 strokes. This number controls the number of points used to
859 approximate a curve. Relevant for {\bf cubicspline} and {\bf bspline} modes
862 {\bf order} - Order of the bspline approximation to be used. The bigger this
863 order is, the smoother the resulting contour. (Of course, higher order
864 bspline curves will move further away from the original piecewise linear
865 data.) This option is relevant for {\bf bspline} mode only. Allowed values are
866 integers in the range from 2 (linear) to 10.
868 {\bf levels} - Number of contour levels, 'n'. Selection of the levels is
869 controlled by 'auto' (default), 'discrete', and 'incremental'. For 'auto',
870 if the surface is bounded by zmin and zmax then contours will be
871 generated from zmin+dz to zmax-dz in steps of size dz, where
872 dz = (zmax - zmin) / (levels + 1). For 'discrete', contours will be
873 generated at z = z1, z2 ... as specified. The number of discrete levels
874 is limited to MAX\_DISCRETE\_LEVELS, defined in plot.h to be 30. If
875 'incremental', contours are generated at $<$n$>$ values of z beginning at
876 $<$start$>$ and increasing by $<$increment$>$.
878 \section{Specifying Labels}
879 Arbitrary labels can be placed on the plot using the {\bf set label}
880 command. If the z coordinate is given on a {\bf plot} it is ignored; if
881 it is missing on a {\bf splot} it is assumed to be 0.
883 \key{set label $\{<$tag$>\} \{"<$label_text$>"\}$}
884 {$\{$at $<$x$>,<$y$>\{,<$z$>\}\}$}
885 \key{}{$\{<$justification$>\}$}
886 \key{unset label $\{<$tag$>\}$}{}
889 The text defaults to '''', and the position to 0,0,0. The $<$x$>$, $<$y$>$, and
890 $<$z$>$ values are in the graph's coordinate system. The tag is an
891 integer that is used to identify the label. If no $<$tag$>$ is given, the
892 lowest unused tag value is assigned automatically. The tag can be used
893 to delete or change a specific label. To change any attribute of an
894 existing label, use the {\bf set label} command with the appropriate tag,
895 and specify the parts of the label to be changed.
897 By default, the text is placed flush left against the point x,y,z.
898 To adjust the way the label is positioned with respect to the point
899 x,y,z, add the parameter $<$justification$>$, which may be {\bf left}, {\bf right}
900 or {\bf center}, indicating that the point is to be at the left, right or
901 center of the text. Labels outside the plotted boundaries are
902 permitted but may interfere with axes labels or other text.
904 \key{label at (1,2) to ``y=x'' }{set label "y=x" at 1,2}
905 \key{label ``y=x^2'' w right of the text at (2,3,4), }
906 {set label 3 "y=x^2" at 2,3,4 right}
907 \key{\& tag the label number 3 }{}
908 \key{change preceding label to center justification}{set label 3 center}
909 \key{delete label number 2 }{unset label 2}
910 \key{delete all labels}{unset label}
911 \key{show all labels (in tag order)}{show label}
913 (The EEPIC, Imagen, LaTeX, and TPIC drivers allow $\backslash$$\backslash$
914 in a string to specify a newline.)
916 \section{Miscellaneous Commands}
918 For further information on these commands, print out a copy
919 of the gnuplot manual.
921 \key{change working directory}{cd}
922 \key{erase current screen or device}{clear}
923 \key{exit gnuplot}{exit or quit or EOF}
924 \key{display text and wait}{pause <time> ["<string>"]}
925 \key{print the value of $<$expression$>$}{print <expression>}
926 \key{print working directory}{pwd}
927 \key{repeat last {\bf plot} or {\bf splot}}{replot}
928 \key{spawn an interactive shell}{! (UNIX) or \$ (VMS)}
930 \section{Environment Variables}
932 A number of shell environment variables are understood by gnuplot.
933 None of these are required, but may be useful.
934 See 'help environment' for the complete description.
936 If GNUTERM is defined, it is used as the name of the terminal type to
937 be used. This overrides any terminal type sensed by gnuplot on start
938 up, but is itself overridden by the .gnuplot (or equivalent) start-up
939 file (see {\bf start-up}), and of course by later explicit changes.
941 On Unix, OS/2, AmigaOS, and MS-DOS, GNUHELP may be defined to be the pathname
942 of the HELP file (gnuplot.gih).
944 On VMS, the symbol GNUPLOT\$HELP should be defined as the name of
945 the help library for gnuplot.
947 On Unix, HOME is used as the name of a directory to search for
948 a .gnuplot file if none is found in the current directory.
949 On OS/2, AmigaOS and MS-DOS, GNUPLOT is used to search for gnuplot.ini file.
950 On VMS, SYS\$LOGIN: is used. See 'help start-up'.
952 GNUPLOT\_LIB may be used to define additional search directories for
953 data and command (script) files.
955 On Unix, PAGER is used as an output filter for help messages.
957 GDFONTPATH is the directory where png terminal searches TrueType fonts,
958 i.e.~files like arial.ttf.
959 GNUPLOT\_FONTPATH is that for the postscript terminal.
961 On Unix and AmigaOS, SHELL is used for the {\bf shell} command. On MS-DOS,
962 COMSPEC is used for the {\bf shell} command.
964 On AmigaOS, GNUFONT is used for the screen font. For example:
965 ``setenv GNUFONT sapphire/14''.
967 On MS-DOS, if the BGI interface is used, the variable {\bf BGI} is used to point
968 to the full path to the BGI drivers directory. Furthermore SVGA is used to
969 name the Super VGA BGI driver in 800x600 res., and its mode of operation
971 For example, if the Super VGA driver is
972 C:$\backslash$TC$\backslash$BGI$\backslash$SVGADRV.BGI
973 and mode 3 is used for 800x600 res., then:
974 'set BGI=C:$\backslash$TC$\backslash$BGI' and 'set SVGA=SVGADRV.3'.
976 GNUFITLOG holds the name of a directory or a file that saves fit results.
979 \section{Expressions}
980 In general, any mathematical expression accepted by C, FORTRAN,
981 Pascal, or BASIC is valid. The precedence of these operators is
982 determined by the specifications of the C programming language.
983 White space (spaces and tabs) is ignored inside expressions.
985 Complex constants may be expressed as $\{<$real$>,<$imag$>\}$, where
986 $<$real$>$ and $<$imag$>$ must be numerical constants. For example,
987 $\{3,2\}$ represents 3 + 2{\bf i} and $\{0,1\}$ represents {\bf i}
988 itself. The curly braces are explicitly required here.
990 The functions in gnuplot are the same as the corresponding functions
991 in the Unix math library, except that all functions accept integer,
992 real, and complex arguments, unless otherwise noted. The {\bf sgn}
993 function is also supported, as in BASIC.
996 %\begin{tabular}{|ccl|} \hline
1000 \def\ff#1{\hbox{\rm #1}\,}
1001 \def\fff#1{\hbox{\rm #1}\,}
1005 \def\sinh{\ff{sinh}}
1006 \def\cosh{\ff{cosh}}
1007 \def\tanh{\ff{tanh}}
1011 \+Function & Arguments & Returns \cr
1013 \+ abs(x) & any & absolute value of {\tt x}, $|x|$; same type \cr
1014 \+ abs(x) & complex & length of {\tt x}, $\sqrt{{\hbox{real}(x)^{2} +
1015 \hbox{imag}(x)^{2}}}$ \cr
1016 \+ acos(x) & any & $\cos^{-1} x$ (inverse cosine) in radians \cr
1017 \+ arg(x) & complex & the phase of $x$ in radians\cr
1018 \+ asin(x) & any & $\sin^{-1} x$ (inverse sin) in radians \cr
1019 \+ atan(x) & any & $\tan^{-1} x$ (inverse tangent) in radians \cr
1020 \+ besj0(x) & radians & $j_{0}$ Bessel function of $x$ \cr
1021 \+ besj1(x) & radians & $j_{1}$ Bessel function of $x$ \cr
1022 \+ besy0(x) & radians & $y_{0}$ Bessel function of $x$ \cr
1023 \+ besy1(x) & radians & $y_{1}$ Bessel function of $x$ \cr
1024 \+ ceil(x) & any & $\lceil x \rceil$, smallest integer not less than $x$
1026 \+ cos(x) & radians & $\cos x$, cosine of $x$ \cr
1027 \+ cosh(x) & radians & $\cosh x$, hyperbolic cosine of $x$ \cr
1028 \+ erf(x) & any & $\hbox{Erf}(\hbox{real}(x))$, error function of real($x$) \cr
1029 \+ erfc(x) & any & $\hbox{Erfc}(\hbox{real}(x))$, 1.0 $-$ error function of real($x$) \cr
1030 \+ exp(x) & any & $e^{x}$, exponential function of $x$ \cr
1031 \+ floor(x) & any & $\lfloor x \rfloor$, largest integer not greater
1032 than $x$ (real part) \cr
1033 \+ gamma(x) & any & $\hbox{Gamma}(\hbox{real}(x))$, gamma function of real($x$) \cr
1034 \+ ibeta(p,q,x) & any & $\hbox{Ibeta}(\hbox{real}(p,q,x))$, ibeta function of real($p$,$q$,$x$) \cr
1035 \+ igamma(a,x) & any & $\hbox{Igamma}(\hbox{real}(a,x))$, igamma function of real($a$,$x$) \cr
1036 \+ imag(x) & complex & imaginary part of $x$ as a real number \cr
1037 \+ int(x) & real & integer part of $x$, truncated toward zero \cr
1038 \+ lgamma(x) & any & $\hbox{Lgamma}(\hbox{real}(x))$, lgamma function of real($x$) \cr
1039 \+ log(x) & any & $\log_{e} x$, natural logarithm (base $e$) of $x$ \cr
1040 \+ log10(x) & any & $\log_{10} x$, logarithm (base $10$) of $x$ \cr
1041 \+ rand(x) & any & $\hbox{Rand}(\hbox{real}(x))$, pseudo random number generator \cr
1042 \+ real(x) & any & real part of $x$ \cr
1043 \+ sgn(x) & any & 1 if $x>0$, -1 if $x<0$, 0 if $x=0$. imag($x$) ignored \cr
1044 \+ sin(x) & radians & $\sin x$, sine of $x$ \cr
1045 \+ sinh(x) & radians & $\sinh x$, hyperbolic sine $x$ \cr
1046 \+ sqrt(x) & any & $\sqrt{x}$, square root of $x$ \cr
1047 \+ tan(x) & radians & $\tan x$, tangent of $x$ \cr
1048 \+ tanh(x) & radians & $\tanh x$, hyperbolic tangent of $x$\cr
1056 The operators in gnuplot are the same as the corresponding operators
1057 in the C programming language, except that all operators accept
1058 integer, real, and complex arguments, unless otherwise noted.
1059 The ** operator (exponentiation) is supported, as in FORTRAN.
1061 Parentheses may be used to change order of evaluation.
1065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1067 \subsubsection{Binary}
1068 The following is a list of all the binary operators and their
1073 \begin{tabular}{|ccl|} \hline
1074 \multicolumn{3}{|c|}{Binary Operators} \\
1075 Symbol & Example & Explanation \\ \hline
1076 \verb~**~ & \verb~a**b~ & exponentiation\\
1077 \verb~*~ & \verb~a*b~ & multiplication\\
1078 \verb~/~ & \verb~a/b~ & division\\
1079 \verb~%~ & \verb~a%b~ & * modulo\\
1080 \verb~+~ & \verb~a+b~ & addition\\
1081 \verb~-~ & \verb~a-b~ & subtraction\\
1082 \verb~==~ & \verb~a==b~ & equality\\
1083 \verb~!=~ & \verb~a!=b~ & inequality\\
1084 \verb~&~ & \verb~a&b~ & * bitwise AND\\
1085 \verb~^~ & \verb~a^b~ & * bitwise exclusive OR\\
1086 \verb~|~ & \verb~a|b~ & * bitwise inclusive OR\\
1087 \verb~&&~ & \verb~a&&b~ & * logical AND\\
1088 \verb~||~ & \verb~a||b~ & * logical OR\\
1089 \verb~?:~ & \verb~a?b:c~ & * ternary operation\\
1093 (*) Starred explanations indicate that the operator requires
1096 Logical AND (\&\&) and OR ($|$$|$) short-circuit the way they do in C.
1097 That is, the second \&\& operand is not evaluated if the first is
1098 false; the second $|$$|$ operand is not evaluated if the first is true.
1100 The ternary operator evaluates its first argument (a). If it is
1101 true (non-zero) the second argument (b) is evaluated and returned,
1102 otherwise the third argument (c) is evaluated and returned.
1103 \subsubsection{Unary}
1104 The following is a list of all the unary operators and their
1109 \begin{tabular}{|ccl|} \hline
1110 \multicolumn{3}{|c|}{Unary Operators}\\
1111 Symbol & Example & Explanation \\ \hline
1112 \verb@-@ & \verb@-a@ & unary minus \\
1113 \verb@~@ & \verb@~a@ & * one's complement \\
1114 \verb@!@ & \verb@!a@ & * logical negation \\
1115 \verb@!@ & \verb@a!@ & * factorial \\
1119 (*) Starred explanations indicate that the operator requires an
1122 The factorial operator returns a real number to allow a greater range.
1123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5