updatesR4/graphics - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : updatesR4/graphics

New Graphics Features That Have Been Added to Maple V for Release 4

 

The plottools Package:

Coordinate Systems:

Geometry:

DEplot, DEplot3d, PDEplot:

Various Types of Plots:

Various Improvements in the plot Routine:

The plottools Package:

• 

The plottools package provides easy access to, and manipulation of plotting primitives in both two and three dimensions.

with(plots,display): with(plottools):

display(disk([-2,0]),line([-2,0],[2,0]),disk([2,0]),scaling=constrained,
axes=box);

p := display(cutout(dodecahedron(),3/4)):

q := display(cutout(icosahedron([0,0,0],2),7/8)):

r := display(cutout(octahedron([0,0,0],2.5),7/8)):

display(p,q,r,scaling=constrained,orientation=[0,32],lightmodel='light4');

• 

Various transformations are supported. They are: plottools[rotate], plottools[scale], plottools[stellate], plottools[transform], and plottools[translate].

with(plots,contourplot,display): with(plottools,transform):

p := plot3d(-5*x/(x^2 + y^2 + 1),x=-3..3,y=-3..3,style=contour,contours=8):

q := contourplot(-5*x/(x^2 + y^2 + 1),x=-3..3,y=-3..3,filled=true):

f := transform((x,y) -> [x,y,-3]):

display({p,f(q)});

Coordinate Systems:

• 

Maple previously supported 4 different coordinate systems; this is now extended to 45 systems. See coords, plots[coordplot] and plots[coordplot3d].

with(plots,coordplot,coordplot3d):

coordplot(elliptic,title=`Elliptic`);

coordplot3d(sixsphere, title=`Six Sphere`);

• 

Also, the routines changecoords and addcoords allow users to change from one coordinate system to another and to work in user-defined coordinate systems.

with(plots,changecoords,coordplot3d):

p := plot3d([(1.3)^x * sin(y),x,y],x=-1..2*Pi,y=0..Pi,
lightmodel='light3',orientation=[37,40],style=patch):

changecoords(p,spherical);

readlib(addcoords)(my_coord_system, [r,theta,z], [r*cos(theta),r*sin(theta),z],
[[1.5],[Pi/3],[.5],[0..2,0..2*Pi,-1..1],[-4..4,-4..4,-1..1]]):

coordplot3d(my_coord_system);

Geometry:

• 

The geometry package is re-designed where graphical visualization is provided:

with(geometry,circle,point,Appolonius,draw):

  

Define the Appolonius circles of three given circles:

circle(c1, (x+3)^2 + y^2 = 4, [x,y]):

circle(c2,[point(O1,6,0),3],[x,y]):

circle(c3, x^2 + (y-7)^2 = 1, [x,y]):

App := Appolonius(c1, c2, c3):

draw([c1(color=plum),c2(color=plum),c3(color=plum),op(App)],
scaling=constrained,printtext=false,axes=none,filled=true,
color=yellow,style=line,title=`Appolonius Circles`);

DEplot, DEplot3d, PDEplot:

• 

The routines DEtools[DEplot], DEtools[DEplot3d], and PDEtools[PDEplot] have been greatly enhanced in all aspects (interface, robustness, speed). More options are also provided.

with(DEtools,DEplot3d,PDEplot):

DEplot3d({D(x)(t)=y(t),D(y)(t)=-x(t)-y(t)},[x(t),y(t)],t=0..10,[[x(0)=0,
y(0)=1],[x(0)=0,y(0)=.5]],scene=[t,x(t),y(t)],stepsize=.1,
linecolor=t-sqrt(t),method=classical[rk2]);

PDEplot(D[1](z)(x,y)+z(x,y)*D[2](z)(x,y)=0,z(x,y),[cos(s),sin(s),sech(s)],
s=-7..7,numsteps=[20,30],numchar=40,basechar=false,initcolor=blue,
style=PATCHNOGRID,obsrange=false,z(x,y)=0..0.8,y=-2..2);

Various Types of Plots:

• 

Arrays of plots allow for easy presentation of alternative views of related data:

with(plots,conformal,display):

c := conformal(z, z = 0..2*Pi+Pi*I, grid = [20,20], axes = boxed):

p := conformal(cos(z), z = 0..2*Pi+Pi*I, grid = [20,20], axes = boxed):

plots[display]( array( 1..2, [c,p]));

• 

Plotting lists of data and point plottings:

with(plots,listplot,listplot3d,pointplot,pointplot3d):

listplot( [10,20,10,40,50,70], color=red );

listplot3d([seq([seq(irem(j,i),i=1..30)],j=1..30)],
style=patch,orientation=[-55,30],lightmodel='light4');

pointplot({seq([n,sin(n/10)],n=0..30)});

pointplot3d({ seq([cos(Pi*T/40),sin(Pi*T/40),T/40],T=0..40) });

  

See plots[listplot], plots[listplot3d], plots[pointplot] and plots[pointplot3d].

• 

Filled contour plots:

with(plots,contourplot):

contourplot(-5*x/(x^2 + y^2 + 1),x=-3..3,y=-3..3,grid=[15,15],
filled=true);

  

See plots[contourplot].

• 

Contour plots of grids:

with(plots,listcontplot):

listcontplot([seq([seq( sin(x/5*y/5), x=-15..15)], y=-15..15)]);

  

See plots[listcontplot].

• 

Density plots of grids:

with(plots,densityplot):

densityplot(sin(x*y),x=-Pi..Pi,y=-Pi..Pi,axes=boxed);

  

See plots[densityplot].

• 

Semi-Logarithmic plots (plotting of functions where the horizontal axis is in logarithmic scale.

with(plots,semilogplot):

semilogplot({ x->2^(sin(x)), x->2^(cos(x))}, 1..10);

  

See plots[semilogplot].

• 

Two and three-dimensional complex plots:

with(plots,complexplot3d):

complexplot3d( sec(z), z = -2 - 2*I .. 2 + 2*I, lightmodel = 'light3', style = patch );

  

See plots[complexplot3d].

• 

Plotting 2D linear inequalities: plot regions defined by linear inequalities

with(plots,inequal):

inequal( { x+y>0, x-y<=1}, x=-3..3, y=-3..3,
    optionsexcluded=(color=tan,thickness=2) );

  

See plots[inequal].

• 

Pareto diagrams:

with(plots,pareto):

Pdata:=[ `Engine 1`=327,
         `Engine 2`= 240,
         `Engine 3`=176,
         `Wire 1`=105,
         `Wire 2`=43,
         `Wire 3`=36,
         `Oil`=33,
         `Coils`=90,
         `Gear Box`=61,
         `Steam line`=50,
         `Others`=166]:

Fdata:=map(rhs,Pdata): Lab:=map(lhs,Pdata):

pareto(Fdata,tags=Lab,misc=Others,style=patch,color=red,title=`Plant Problems`);

  

See plots[pareto].

• 

Root locus plots:

with(plots,rootlocus):

rootlocus( (s^3-1)/s, s, -5..5 );

  

See plots[rootlocus].

Various Improvements in the plot Routine:

• 

Adaptive plotting is rewritten. Allows specification of points to plot.

f:=(x)->if x>=1 then 2 else x fi:

  

Ordinary plot

plot(f,-2..2);

  

Now specify the initial sample for the adaptive plotting code:

plot(f,-2..2,sample=[-2,1,2]);

  

Now plot the function based only on the sample points; in other words this plot will use only the 3 points corresponding to the parameter values specified in the sample.

plot(f,-2..2,adaptive=false,sample=[-2,1,2]);

• 

Plots of multiple functions:

  

Multiple functions can now be plotted by placing a list of functions in the first argument. Options such as color, thickness, style, linestyle, symbol can be specified for each function by placing a list in the appropriate option argument.

plot([sin(x), -sin(x)], x=-2*Pi..2*Pi,color=[red,blue],
style=point,symbol=[cross,diamond]);

  

See plot and plot[options].

• 

Animation: background plots supported

with(plots,animate,display):

a:=plots[animate](sin(i*x),x=-Pi..Pi,i=1..2):

b:=plot(sin(x),x=-Pi..Pi):

plots[display]({a,b});

• 

Conversion:

  

The following new conversion routines support plotting: convert[PLOT3Doptions], convert[PLOToptions], and convert[POLYGONS].

convert([color=red, title=`My Beautiful Plot`], PLOT3Doptions);

 [TITLE(My Beautiful Plot), COLOUR(RGB, 1.00000000, 0., 0.)]

p := convert(plot3d(sin(x*y),x=-1..1,y=-1..1,grid=[4,4]), POLYGONS):

plots[display]( plottools[cutin](p, 2/3),orientation=[-44,101],shading=Z,
lightmodel='light4' );