| www.delorie.com/gnu/docs/maxima/maxima_28.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[[x1,y1,x2,y2,...],[u1,v1,u2,v2,...],..] or [[[x1,y1],[x2,y2],...],.. ] |
"{xrange -3 4}"
The following plots two curves, using big points, labeling the first one
jim and the second one jane.
openplot_curves([["{plotpoints 1} {pointsize 6} {label jim}
{text {xaxislabel {joe is nice}}}"] ,
[1,2,3,4,5,6,7,8],
["{label jane} {color pink } "], [3,1,4,2,5,7]]);
|
Some other special keywords are xfun, color, plotpoints, linecolors, pointsize, nolines, bargraph, labelposition, xaxislabel, and yaxislabel.
plot2d(sin(x),[x,-5,5]); plot2d(sec(x),[x,-2,2],[y,-20,20],[nticks,200]); |
A point set may be of the form
[x0,y0,x1,y1,x2,y2,...] or [[x0,y0],[x1,y1],....] |
xgraph_curves([pt_set1,pt_set2,pt_set3]); |
pt_set:append(["NoLines: True","LargePixels: true"],
[x0,y0,x1,y1,...])
|
would make the point set [and subsequent ones], have no lines between points, and to use large pixels. See the man page on xgraph for more options to specify.
pt_set:append([concat("\"","x^2+y")],[x0,y0,x1,y1,...])
|
" at the beginning is what tells
xgraph this is a label.
pt_set:append([concat("TitleText: Sample Data")],[x0,...])
|
To make a bar graph with bars which are .2 units wide, and to plot two possibly different such bar graphs:
xgraph_curves(
[append(["BarGraph: true","NoLines: true","BarWidth: .2"],
create_list([i-.2,i^2],i,1,3)),
append(["BarGraph: true","NoLines: true","BarWidth: .2"],
create_list([i+.2,.7*i^2],i,1,3))
]);
|
A temporary file `xgraph-out' is used.
[X, - 3, 3] [Y, - 3, 3] |
are the x range and y range respectively.
[TRANSFORM_XY, FALSE] if not false, should be the output of
make_transform([x,y,z], [f1(x,y,z),f2(x,y,z),f3(x,y,z)]) |
make_transform([r,th,z],[r*cos(th),r*sin(th),z]) |
[RUN_VIEWER,TRUE] if not false, means run the viewer software - don't just output a data file.
[GRID,30,30] means plot3d should divide the x range into 30 intervals and similarly the y range.
[COLOUR_Z,false] applies to colouring done with plot_format ps.
[PLOT_FORMAT,OPENMATH] is for plot3d and currently OPENMATH, GNUPLOT, PS, and GEOMVIEW are supported.
There are good quality public domain viewers for these formats. They are openmath, izic, gnuplot, ghostview, and geomview.
The Openmath viewer is in the distribution, and is based on tcl/tk. The executable is `maxima/bin/omplotdata'. The viewer lets you zoom in, slide around, and rotate (if 3 dimensional). This format is also the one used by netmath, for making plots with Netmath. (see `http://www.ma.utexas.edu/users/wfs/netmath.html')
geomview is from the Geometry Center at the University of Minnesota, and is available from `http://www.geom.umn.edu/software/download/geomview.html' or by anonymous ftp from `ftp://ftp.geom.umn.edu/pub/software/geomview/'. It is currently not quite as pretty as izic, but provides excellent support for multiple objects and multiple lights.
gnuplot is everywhere as is ghostview. We also provide mgnuplot, a tcl interface for gnuplot, which lets you rotate the plots using the mouse and a scale.
izic is available by ftp from zenon.inria.fr. Contact one of
{fournier,kajler,mourrain}@sophia.inria.fr.
It has beautiful colour gouraud shading, and very fast wireframe. It runs on X windows.
plot3d(2^(-u^2+v^2),[u,-5,5],[v,-7,7]); |
An example of the second pattern of arguments is
plot3d([cos(x)*(3+y*cos(x/2)),sin(x)*(3+y*cos(x/2)),y*sin(x/2)], [x,-%pi,%pi],[y,-1,1],['grid,50,15]) |
which will plot a moebius band, parametrized by the 3 expressions given as the first argument to plot3d. An additional optional argument [grid,50,15] gives the grid number of rectangles in the x direction and y direction.
/* REal part of z ^ 1/3 */
plot3d(r^.33*cos(th/3),[r,0,1],[th,0,6*%pi],
['grid,12,80],['PLOT_FORMAT,ps],
['TRANSFORM_XY,POLAR_TO_XY],['VIEW_DIRECTION,1,1,1.4],
['COLOUR_Z,true])
|
Another example is a moebius band:
plot3d([cos(x)*(3+y*cos(x/2)),
sin(x)*(3+y*cos(x/2)),y*sin(x/2)],
[x,-%pi,%pi],[y,-1,1],['grid,50,15]);
|
or a klein bottle:
plot3d([5*cos(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3.0) - 10.0,
-5*sin(x)*(cos(x/2)*cos(y)+sin(x/2)*sin(2*y)+3.0),
5*(-sin(x/2)*cos(y)+cos(x/2)*sin(2*y))],
[x,-%pi,%pi],[y,-%pi,%pi],['grid,40,40])
|
or a torus
plot3d([cos(y)*(10.0+6*cos(x)),
sin(y)*(10.0+6*cos(x)),
-6*sin(x)], [x,0,2*%pi],[y,0,2*%pi],
['grid,40,40])
|
plot3d(2^(x^2-y^2),[x,-1,1],[y,-2,2],[plot_format,gnuplot]) |
Sometimes you may need to define a function to plot the expression. All the arguments to plot3d are evaluated before being passed to plot3d, and so trying to make an expression which does just what you want may be difficult, and it is just easier to make a function.
M:MATRIX([1,2,3,4],[1,2,3,2],[1,2,3,4],[1,2,3,3])$ f(x,y):=float(M[?round(x),?round(y)]); plot3d(f,[x,1,4],[y,1,4],['grid,4,4]); |
SET_PLOT_OPTION([grid,30,40]) |
SET_PLOT_OPTION(['grid,30,40]) |
Draws a curve connecting the points in PTLIST. The latter may be of the form [x0,y0,x1,y1,...] or [[x0,y0],[x1,y1],...] The function JOIN is handy for taking a list of x's and a list of y's and splicing them together. PSDRAW_CURVE simply invokes the more primitive function PSCURVE. Here is the definition:
(defun $psdraw_curve (lis) (p "newpath") ($pscurve lis) (p "stroke")) |
?DRAW2D may also be used to produce a list
points1:?draw2d(1/x,[.05,10],.03) |
COM will be inserted in the poscript file eg
pscom("4.5 72 mul 5.5 72 mul translate 14 14 scale");
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |