Question: Plot multiple plot structures to PNG or PS from within procedures

G'Day

I would like to save the output of a plot structure (resulting graph) or a combination of multiple plots (using display[list]) into a PNG or postscript file from within a procedure. I have managed to successfully save a plot in one of the graphics format using this approach (Pseudo-Code):

intVec := [list of numbers];
myGraphs := proc(intVec)
  myplot[1] := Statistics[PieChart](intVec, color = red .. yellow);
  myplot[2] := textplot("some stuff");
  plotsetup(png, plotoutput = name, plotoptions = "height=600,width=800");
  print(myplot[1]);
  plotsetup(postscript, plotoutput = name, plotoptions = "colour=cmyk,noborder");
  print(myplot);
  plotsetup(default);     
  return 0;
end proc:

However I would like to save the plot of both plot structures (i.e. myplot[1] & myplot[2]) combined and interpreted into a PNG. If one is in a general worksheet mode, you can combine the plot structures using the display command, as follows:

display([myplot[1], myplot[2]]);

Being inside a Maple procedure the above command does not work anymore as expected when the interface for the plot display output changes to a file, instead of internal (default). So my question is: How can I combine one of more plot structures and store the resulting graphical representation (plot output) into a file of my desire (be it PNG or PS or whatever) from inside a Maple procedure?

I have spent roughly three days trying to figure it out with the help of Google, Mapleprimes or possible books that could describe the solution to my problem but I have found nothing that would shed some light.

Reading contributions on the web such as the following:

http://www.math.rwth-aachen.de/mapleAnswers/html/1503.html

led me to the premature assumption that one can simply wrap plot structures into a list or set using display and wrap this one into a print statement. I have tried the following set of combinations already in vain:

display(myplot);
diplay(myplot[1],myplot[2]);
print(myplot);
print([myplot[1],myplot[2]]);
print(diplay(myplot[1],myplot[2]));
print(diplay({myplot[1],myplot[2]}));

Thanks in advance for the quite possibly extremely simple solution!

 

Please Wait...