This is a primer for PLOT2 (SHARE;PLOT2 PRIMER). Please look at SHARE;PLOT2 USAGE for full documentation of PLOT2. (Last revision of this file: August 1981.) This file contains the "Easy Examples" excerpted from PLOT2 USAGE. You will quite likely be able to figure out what's going on just from these examples. Only read the relevant section later, if something is unclear. To see the general capabilities of PLOT2 do DEMO(PLOT2,DEMO,DSK,SHARE); (type spaces after the plots) and most of these examples will be tried. (Sec 1.1) PLOT2(SIN(X),X,-%PI,%PI); plots sin(X) against X as X takes on PLOTNUM values between -%PI to %PI PLOT2(X!,X,0,6,INTEGER); plots X! as X takes integral values between 0 and 6 F(X):=SQRT(X+%PI); PLOT2(F(X),X,[-2,3,100.12]); plots F(X) as X takes the values in the values in the list PLOT2([X+1,X^2+1],X,-1,1); plots 2 curves on top of each other (Sec 1.2) GRAPH2([1,2,3],[5,10,6]); draws a line connecting [1,5], [2,10], [3,6] (Sec 1.3) PARAMPLOT2(COS(T),SIN(T),T,0,2*%PI); Plots cos(T) for the x-axis and sin(T) for the y-axis as T takes on PLOTNUM (Sec 1.5) values between 0 and 2*%PI. (If EQUALSCALE is TRUE (Sec 8.3) this draws a circle.) (Sec 1.4) LOAD('[WORLD,FASL,DSK,SHARE]); WORLDPLOT(-15, 10, 48, 60); draws a map of the United Kingdom. (Sec 3.1) PLOT3D(EXP(-X^2-Y^2)*X,X,-2,2,Y,-1.5,2.5); Plots exp(-X^2-Y^2)*X as X takes on PLOTNUM values between -2 and 2 and y takes on PLOTNUM1 values between -1.5 and 2.5 TRANSLATE:TRUE; causes automatic translation G(X,Y):=(MODEDECLARE([X,Y],FLOAT),EXP(-X*X-Y*Y)); define a function G PLOT3D(G,-2,2,-2,2); plot it (Sec 3.3) PLOT3D(SIN(X)+A,X,-%PI,%PI,A,[-2,3,4,6],NOT3D); plots sin(X)+A for X from -%PI to %PI (PLOTNUM points) and A taking the values in the list. This is equivalent to: PLOT2([SIN(X)-2,SIN(X)+3,SIN(X)+4,SIN(X)+6],X,-%PI,%PI); but requires less typing. (Sec 4.1) CONTOURS:10; Do 10 contours LABELCONTOURS:FALSE; Don't label the contours CONTOURPLOT2(Y^2/2+COS(X)+X/2,X,-6,6,Y,-3,3); Do a contour plot of Y^2/2+cos(X) as X takes PLOTNUM values between -6 and 6 and as Y takes PLOTNUM1 values between -3 and 3. (This gives you the phase space orbits of a particle in a periodic potential superimposed on a constant field). PLOT3D(Y^2/2+COS(X)+X/2,X,-6,6,Y,-3,3,CONTOUR); The same CONTOURS:[0]; Plot only the zero contour. CONTOURPLOT2([REALPART((X+%I*Y)^3-1),IMAGPART((X+%I*Y)^3-1)], X,-1.5,1.5,Y,-1.5,1.5,[0,1]); Finds the zeroes of Z^3=-1 in the complex plane. CONTOURS:PLOTNUM:PLOTNUM1:10; Work with a 10x10 grid CONTOURPLOT2(RANDOM(100),X,0,1,Y,0,1); Plot something random (Sec 5.1) PLOT2(1,X,0,2*%PI); Plots a straight line REPLOT(TRUE,POLAR); Plots it in polar coordinates (Sec 13.1). This will appear as an ellipse unless EQUALSCALE:TRUE (Sec 8.3) EQUALSCALE:TRUE; REPLOT(); Replots the ellipse with EQUALSCALE equal to TRUE; this will then appear as a circle. (Sec 5.2) PLOTMODE(DISPLAY,XGP); Set things up for plotting on the XGP and a datapoint. (Sec 6.1) PLOT2(EXP(X),X,0,3,X,EXP(X),"THIS IS A PLOT OF EXP(X) VS. X"); plots a curve of exp(X) with an x-label of "X", a y-label of "EXP(X)" and a tile of "THIS IS A PLOT OF EXP(X) VS. X" (the labels don't appear with the "'s) A:3; PLOT2(SIN(X)+A,X,-%PI,%PI,FALSE,FALSE,LABEL(A)); plots sin(X)+A and sticks an the title "A=3". PLOT2(SIN(X),X,-%PI,%PI,FALSE,SIN(X)); labels the y-axis with "SIN(X)". (Sec 9.1) PLOT2([SIN(X),COS(X)],X,-%PI,%PI,[0,1]); Plots sin(X) with line type 0 (a solid line) and cos(X) with line type 1 (a dashed line) PARAMPLOT2(RANDOM(),RANDOM(),X,0,1,[19]); Plots PLOTNUM "random" points with symbol 1 (no connecting lines drawn) TT:[0,1,2,3,4,5,6,7,8]; PLOTNUM1:9; PLOT3D(SIN(X)+A,X,-%PI,%PI,A,0,2,TT,NOT3D); Gives the full repertory of line types TT:9+10*(TT+1); TT is now [19,29,39 ... ] REPLOT(TRUE,TT); Gives the full repertory of symbol types. (Sec 13.1) PLOT2(1,T,0,2*%PI,POLAR); Plots a circle REPLOT(TRUE,LIN); Replots the previous plot on a linear scale (i.e., gives a horizontal line) PLOT2(EXP(X),X,0,10,LINLOG); Plots exp(X) on a Lin-Log scale (appears as a straight line) GRAPH2([1,2,5,10,50,100],[1,1.5,2.5,3,7,10],LOG); Plots some random points on Log-Log scale. Slope shows that y=sqrt(x).