Path: utzoo!utgpu!watmath!uunet!fernwood!apple!brutus.cs.uiuc.edu!psuvax1!gatech!ncar!asuvax!noao!arizona!naucse!jdc From: jdc@naucse.UUCP (John Campbell) Newsgroups: unix-pc.sources Subject: gnuplot.shar.07 Message-ID: <1686@naucse.UUCP> Date: 4 Sep 89 16:43:23 GMT Organization: Northern Arizona University, Flagstaff, AZ Lines: 1496 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh './docs/gnuplot.doc' <<'END_OF_FILE' X X X X X X X X X X X X X X X X X X X X X X X GNUPLOT X An Interactive Plotting Program X X X X Thomas Williams & Colin Kelley X X Department of Electrical Engineering X Villanova University X Villanova, PA 19085 X May 26, 1989 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X May 26, 1989 X X X X X X X X X X X X X X X X _I_N_T_R_O_D_U_C_T_I_O_N X X GNUPLOT is a command-driven interactive function plotting program. X It is case sensitive (commands and function names written in lower- X case are not the same as those written in CAPS). All command names X may be abbreviated, as long as the abbreviation is not ambiguous. X Any number of commands may appear on a line, separated by semicolons X (;). X X X X X _1. _c_l_e_a_r X X X This command erases the current screen or output device as specified X by 'set output'. This usually generates a formfeed on hardcopy dev- X ices. Use 'set terminal' to set the device type. X X X X X _2. _e_x_i_t X X X 'exit', 'quit' and your computer's END-OF-FILE character will exit X GNUPLOT. All these commands will clear the output device (as the X 'clear' command does) before exiting. X X X X X _3. _e_x_p_r_e_s_s_i_o_n_s X X X X X X X _3._1. _f_u_n_c_t_i_o_n_s X X X X X X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 2 X X X _3._1._1. _a_b_s X X X This function returns the absolute value of its argument. X The returned value is of the same type as the argument. X X For complex arguments, abs(x) is defined as the length of X x in the complex plane [i.e. sqrt(real(x)**2 + X imag(x)**2) ]. X X X X _3._1._2. _a_c_o_s X X X This function returns the arc cosine (inverse cosine) of X its argument. 'acos' returns its argument in radians. X X X X _3._1._3. _a_r_g X X X This function returns the phase of a complex number, in X radians. X X X X _3._1._4. _a_s_i_n X X X This function returns the arc sin (inverse sin) of its X argument. 'asin' returns its argument in radians. X X X X _3._1._5. _a_t_a_n X X X This function returns the arc tangent (inverse tangent) of X its argument. 'atan' returns its argument in radians. X X X X _3._1._6. _b_e_s_j_0 X X X This function returns the j0th Bessel function of its X argument. 'besj0' expects its argument to be in radians. X X X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 3 X X X _3._1._7. _b_e_s_j_1 X X X This function returns the j1st Bessel function of its X argument. 'besj1' expects its argument to be in radians. X X X X _3._1._8. _b_e_s_y_0 X X X This function returns the y0th Bessel function of its X argument. 'besy0' expects its argument to be in radians. X X X X _3._1._9. _b_e_s_y_1 X X X This function returns the y1st Bessel function of its X argument. 'besy1' expects its argument to be in radians. X X X X _3._1._1_0. _c_e_i_l X X X This function returns the largest integer not less than X its argument. For complex numbers, 'ceil' returns the X largest integer not less than the real part of its argu- X ment. X X X X _3._1._1_1. _c_o_s X X X This function returns the cosine of its argument. 'cos' X expects its argument to be in radians. X X X X _3._1._1_2. _c_o_s_h X X X This function returns the hyperbolic cosine of its argu- X ment. 'cosh' expects its argument to be in radians. X X X X _3._1._1_3. _e_x_p X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 4 X X X This function returns the exponential function of its X argument (e raised to the power of its argument). X X X X _3._1._1_4. _f_l_o_o_r X X X This function returns the smallest integer not greater X than its argument. For complex numbers, 'floor' returns X the smallest integer not greater than the real part of its X argument. X X X X _3._1._1_5. _i_m_a_g X X X This function returns the imaginary part of its argument X as a real number. X X X X _3._1._1_6. _i_n_t X X X This function returns the integer part of its argument, X truncated toward zero. X X X X _3._1._1_7. _l_o_g X X X This function returns the natural logarithm (base e) of X its argument. X X X X _3._1._1_8. _l_o_g_1_0 X X X This function returns the logarithm (base 10) of its argu- X ment. X X X X _3._1._1_9. _r_e_a_l X X X This function returns the real part of its argument. X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 5 X X X _3._1._2_0. _s_g_n X X X This function returns 1 if its argument is positive, -1 if X its argument is negative, and 0 if its argument is 0. If X the argument is a complex value, the imaginary component X is ignored. X X X X _3._1._2_1. _s_i_n X X X This function returns the sine of its argument. 'sin' X expects its argument to be in radians. X X X X _3._1._2_2. _s_i_n_h X X X This function returns the hyperbolic sine of its argument. X 'sinh' expects its argument to be in radians. X X X X _3._1._2_3. _s_q_r_t X X X This function returns the square root of its argument. X X X X _3._1._2_4. _t_a_n X X X This function returns the tangent of its argument. 'tan' X expects its argument to be in radians. X X X X _3._1._2_5. _t_a_n_h X X X This function returns the hyperbolic tangent of its argu- X ment. 'tanh' expects its argument to be in radians. X X X X _3._2. _o_p_e_r_a_t_o_r_s X X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 6 X X X _3._2._1. _b_i_n_a_r_y X X X The following is a list of all the binary operators and X their usages: X X Symbol Example Explanation X ** a**b exponentiation X * a*b multiplication X / a/b division X % a%b * modulo X + a+b addition X - a-b subtraction X == a==b equality X != a!=b inequality X & a&b * bitwise and X ^ a^b * bitwise exclusive or X | a|b * bitwise inclusive or X && a&&b * logical and X || a||b * logical or X ?: a?b:c * ternary operation X X (*) Starred explanations indicate that the operator X requires integer arguments. X X Logical AND (&&) and OR (||) short-circuit the way they do X in C. That is, the second && operand is not evaluated if X the first is false; the second || operand is not evaluated X if the first is true. X X The ternary operator evaluates its first argument (a). If X it is true (non-zero) the second argument (b) is evaluated X and returned, otherwise the third argument (c) is X evaluated and returned. X X X X _3._2._2. _u_n_a_r_y X X X The following is a list of all the unary operators and X their usages: X X Symbol Example Explanation X - -a unary minus X ~ ~a * one's complement X ! !a * logical negation X ! a! * factorial X X (*) Starred explanations indicate that the operator X requires an integer argument. X X The factorial operator returns a real number to allow a X X X X May 26, 1989 X X X X X X X GNUPLOT Page 7 X X X greater range. X X X X X _4. _h_e_l_p X X X The 'help' command displays on-line help. To specify information on X a particular topic use the syntax: X X help X X Help is actually a separate program. If help doesn't work for you, X ask your administrator how to set up the GNUHELP environment vari- X able (and possibly the HELPDIR environment variable). X X You may exit the help utility and return to GNUPLOT by either press- X ing (s) at the 'HELP >' prompt or pressing your computer's X END-OF-FILE character at any help prompt. X X X X X _5. _l_o_a_d X X X This command executes each line of the specified input file as if it X had been typed in interactively. Files created by the 'save' com- X mand can later be 'load'ed. Any text file containing valid commands X can be created and then executed by the 'load' command. Files being X 'load'ed may themselves contain 'load' commands. Lines beginning X with # (or ! if using VMS) will be treated as comments and ignored. X X The 'load' command must be the last command on the line. X X Syntax: X load X X The name of the input file must be enclosed in quotes. X X Examples: X X load 'work.gnu' X load "func.dat" X X X X X _6. _p_a_u_s_e X X X Pause is useful in conjunction with `load` files. The command X X X X May 26, 1989 X X X X X X X GNUPLOT Page 8 X X X 'pause' displays any text associated with the command and then waits X the specified amount of time. This allows one to build a 'load' X file and control the amount of time a finished graph is displayed. X The first argument is an expression that can be -1, 0, 1, 2, ... -1 X will wait until a carriage return is hit. 0 won't pause at all, and X 1, 2, etc. will wait the specified number of seconds. X X Note: Since pause is not part of the plot it may interact with dif- X ferent device drivers differently (depending upon how text and X graphics are mixed). X X Examples: X pause -1 ! Wait until a carriage return is hit X pause 3 ! Wait three seconds X pause -1 "Hit return to continue" X pause 10 "Isn't this pretty? It's a cubic-spline." X X Syntax: X pause ["string"] X X X X X _7. _p_l_o_t X X X X X X X _7._1. _d_a_t_a__f_i_l_e X X X Discrete data contained in a file can displayed by specifying X the name of the data file (enclosed in quotes) on the 'plot' X command line. X X Data files should contain one data point per line. A data X point may be specified either as an X and Y value separated by X blank space, or as just the Y value, in which case the program X will use the number of the coordinate as the X value. Coordi- X nate numbers starts at 0 and are incremented for each data X point read. Blank lines and lines beginning with # will be X treated as comments and ignored. X X X This example compares the data in the file population.dat to a X theoretical curve: X X pop(x) = 103*exp((1965-x)/10) X plot [1960:1990] 'population.dat', pop(x) X X The file population.dat might contain: X X X X May 26, 1989 X X X X X X X GNUPLOT Page 9 X X X # Gnu population in Antarctica since 1965 X 1965 103 X 1970 55 X 1975 34 X 1980 24 X 1985 10 X X X X _7._2. _r_a_n_g_e_s X X X This option specifies the region of the plot which will be X displayed. X X Ranges may be provided on the 'plot' command line as synonyms X for the 'set xrange' and 'set yrange' commands. X X Syntax: X [{dummy-var =} {xmin : xmax}] { [{ymin : ymax}] } X X Where dummy-var is the independent variable (the default is X 'x', but this may be changed with the 'set dummy' command) and X the min and max terms can be expressions or constants. X X Both the min and max terms are optional. The ':' is also X optional if neither a min nor a max term is specified. This X allows '[]' to be used as a null range specification. X X Specifying a Y range turns autoscaling OFF. X X X Examples: X X This uses current ranges: X plot cos(x) X X This sets the xrange only: X plot [-10:30] sin(pi*x)/(pi*x) X X This is the same, but uses t as the dummy-variable: X plot [t = -10 :30] sin(pi*t)/(pi*t) X X This sets both the x and yranges: X plot [-pi:pi] [-3:3] tan(x), 1/x X X This sets only the yrange: X plot [] [-2:sin(5)*-8] sin(x)**besj0(x) X X This sets xmax and ymin only: X plot [:200] [-pi:] exp(sin(x)) X X X X X X May 26, 1989 X X X X X X X GNUPLOT Page 10 X X X _7._3. _s_t_y_l_e X X X Plots may be displayed in one of three styles: 'lines', X 'points', or 'impulses'. The 'lines' style connects adjacent X points with lines. The 'points' style displays a small symbol X at each point. The 'impulses' style displays a vertical line X from the X axis to each point. X X Default styles are chosen with the 'set function style' and X 'set data style' commands. X X Syntax: X with