1
$\begingroup$

I am writing an small note including limits for undergraduate students, and indeed I need some figures inside it. By default, Maple outputs (plots of functions or surfaces) can be manipulated in such a way you can change plots widths and also height.

Is there a way (maybe a code) in which we can order machine to make the plot in my desire size? I have not met such this situation while working Maple. Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

For 2-D plots the size option can be used. That is accepted by the plots:-display command, which can be wrapped around any 2-D plot (or sequence of same).

Eg,

plot(5*x^3-1*x^2-50*x, x=-4..4, size=[600,200]);

P:=plots:-implicitplot( x^3-y^2-y, x=-2..2, y=-2..2, gridrefine=2 ):
plots:-display(P, size=[800,300]);

See the help page for the plot,options topic, which has an entry for this.

For 3-D plots there are a couple of related approaches. Note that an unconstrained 3-D plot gets rendered using in a square region, using the minimum of the height and width. So in practice it usally looks best to keep the two dimensions equal.

One undocumented but relatively easy way is to extract the ROOT substructure from a 2-D plot (created using the size option), and then adding it into the PLOT3D structure. (Note that the plots:-display command will not know how to handle such a result, so tailoring with the ROOT substructure is best left as a final step prior to rendering.) Eg,

restart;
Q:=plot(x, x=0..1, size=[700,700]):
r:=indets(Q,specfunc(anything,ROOT))[1];

           r := ROOT(BOUNDS_X(0), BOUNDS_Y(0), BOUNDS_WIDTH(700), 
                     BOUNDS_HEIGHT(700))

P3D:=plot3d(sin(x)*y,x=-Pi..Pi,y=-1..1):

op(0,P3D)(op(P3D), r);

Another way is to insert a PlotComponent and set its height and width, and then make the 3-D plot its value. Those steps can be done either using the mouse and menus, or programmatically.

If you really want to get fancy you can write code (or a re-usable procedure) which constructs and embeds the PlotComponent on demand. See here. I consider that advanced usage.

You question is about Maple programming rather than mathematics, and is more suitable for www.stackoverflow.com or www.mapleprimes.com the Maplesoft user forum.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .