Maple export graphics with loop

Hi Everyone!

I want to export several Figures with Maple at the same time. I tried

with(plots):

for i from 1 to 5 do
interface(plotdevice=ps, plotoutput=`c:/test||i.eps`, plotoptions=`color,portrait,

noborder,width=16cm,height=12cm`);
 plot(cos(i*x), x = -5..5);
 interface(plotdevice=inline);

od:

but it did not work. How can I create one file per Figure?

Thanks a lot,

Bernardo

 

acer's picture

quote placement

The quote placement in `c:/test||i.eps` is not right. You might have meant something like,

> for i from 1 to 3 do
>   "c:/test/"||i||".eps";
> end do;
                                "c:/test/1.eps"

                                "c:/test/2.eps"

                                "c:/test/3.eps"

or,

> for i from 1 to 3 do
>   `c:/test/`||i||`.eps`;
> end do;
                                 c:/test/1.eps

                                 c:/test/2.eps

                                 c:/test/3.eps

If you place name quotes around the Maple || concatenation operator and the  i then it won't do anything. Also, you were probably missing a / directory separator.

acer

hmmm, it seems to be not

hmmm, it seems to be not working. Let me try to say it again:

I want to export plots to the root c:\ of my PC, no directories involved. Since I want to export more than 1 plot, I want to create a loop that gives different names to each file: test1.eps, test2.eps, test3.eps, test4.eps and test5.eps.

I tried to incorporate your suggestions concerning the quotes but It did not work. BTW, I use Maple 11:

with(plots):
>
> for i from 1 to 5 do
> interface(plotdevice=ps, plotoutput="c:/test"||i||".eps", plotoptions=`color,portrait,noborder,width=16cm,height=12cm`);
> plot(cos(i*x), x = -5..5);
> interface(plotdevice=inline);
>
> od;

It generated 5 files but no Adobve Illustrator could not open the files.

What can be wrong?

 

Thanks,

Bernardo

 

acer's picture

worked for me

This worked for me, using Maple 11.02.

> for i from 1 to 5 do
> plotsetup(ps, plotoutput="/tmp/test"||i||".eps",
>   plotoptions=`color,portrait,noborder,width=16cm,height=12cm`);
> plot(cos(i*x), x = -5..5);
> plotsetup(inline);
> end do;

I did it on Linux, and used /tmp/ as the base location. Modify the location for Windows accordingly. (Try backslash, perhaps?) The .eps files that came out were OK.

acer

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}