user1558881
user1558881

Reputation: 225

Multiple Plots in Maxima

I am writing a code in Maxima and I have three plots. I have no trouble plotting these individually but I can not figure out how to have them all on one plot with out doing it in one for loop, with out going into too much detail this would be difficult with my code.

    for i:1 step 1 while i<=n-1 do(figgdown[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[p[i],p[i]]]));
    for i:1 step 1 while i<=n-1 do(figgup[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[q[i], q[i]]]));
    for i:1 step 1 while i<=n-1 do(figgmiddle[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[pq[i], pq[i]]]));

Is there a way i can do something like the Show function in Mathematica, where the graphics appear together? Best, Ben

Upvotes: 4

Views: 5875

Answers (2)

Adam
Adam

Reputation: 1386

slitvinov answer is great, but ther is also another option.

One can use also multiple plot option from draw. Then you have one image ( plot) with few subplots, scenes each with own axes and title:

draw(scene1,scene2, scene3)

Here is an example with code

enter image description here

Upvotes: 1

slitvinov
slitvinov

Reputation: 5768

You can keep a list

n: 10;
x: makelist(2*%pi*i/n, i, 0, n);

p: [];
y1: sin(x);
p: endcons([discrete, x, y1], p);

y2: cos(x);
p: endcons([discrete, x, y2], p);

/* display all plots in p */
plot2d(p);

Upvotes: 5

Related Questions