2

Maxima plotting in a loop, must shut one plot to see the next one. Iam working in windows environment, but in linux will the function plotted in one view.

For example this function :

for d:0.1 thru 1 step 0.1 do
  draw2d(explicit(x^d,x,0,1));

I have also tried this:

set_plot_option(['plot_format, 'gnuplot_pipes]);

But this didnt solve it. Is there an option, where i can set the plotting in one view?

Thank you.

AngularLover
  • 364
  • 1
  • 12

1 Answers1

3

You could make a list of curves in the loop and plot them all on a single graph. You can use a loop or makelist to build the curve list.

makelist(x^d, d, 0, 1, 0.1);
plot2d(%, [x, 0, 1]);

enter image description here

If you're using wxMaxima, you can the with_slider_draw function to animate the plot:

with_slider_draw(
    d, /* the name of the variable to attach to the slider */
    makelist(i,i,0,1,0.1), /* a list of values that the variable can have */
    explicit(x^d, x, 0, 1) /* plot the function */
)$

If you prefer plot2d arguments, use with_slider to do the same thing:

with_slider(
   d,
   makelist(i,i,0.1,1,0.1),
   [x^d], [x,0,1]
);

Click on the graph and then use the Play button on the toolbar to play the animation. You can use the slider on the toolbar or your mouse wheel to move back and forth between animation frames. You can even save the animation as an animated gif by right-clicking the plot and choosing Save Animation.

enter image description here

Fred Senese
  • 660
  • 5
  • 9
  • but there is no animation.. i want to animate with a loop. I just want that i dont have to shut down all views. Kind regards. – AngularLover Dec 19 '14 at 19:14
  • 2
    OK, I didn't understand that you were trying to animate it. I think the closest thing to what you want is multiplot\_mode: see the manual entry for that. The trouble is that a) it won't work with Windows, only Linux and b) it won't erase the previous "frames" in the animation, it will write over them. You can also take a slider-based approach rather than animating... – Fred Senese Dec 19 '14 at 20:00
  • yes i was looking for the multi_plot. Its ok for me if its overwriting the frames. But this will build something like an animation. Its like a workaraound i think. And the with_slider isnt nice documentated.. May can you do a slider fot the above given function? – AngularLover Dec 19 '14 at 21:01
  • and can you also tell me why its not working on windows? – AngularLover Dec 19 '14 at 21:07
  • thank you very much, I tried to add nticks, but it isnt working.. is there a way to do that? – AngularLover Dec 22 '14 at 17:14
  • You can add any plot2d options you want in the with_slider form; for example with_slider( d, makelist(i,i,0.1,1,0.1), [x^d], [x,0,1], [nticks, 300], [style, points] ); That works (you'll see the points drawn change a bit when you change the nticks) but remember that nticks just sets the intial number of points the adaptive plotting routine uses. If it thinks that isn't enough points it seems to decide to use more. – Fred Senese Dec 22 '14 at 17:43