Hi there,
I am trying yo export a graph in pdf format, but I got the following Gauss message: "no active graph to export". My code lines are following:
dograph(parameters,"Model 1",root$+"1.pdf"); proc (0) = dograph(dat,figtitle,figname); local x,y; title(model 1); figtitle;; dat;?; x = dat[.,1]; y = dat[.,2:cols(dat)]; plotSave(figname,11|8.5, "in", 300); xy(x,y); retp; endp;
Any suggestion about what is wrong?
Thank you in advance
1 Answer
0
The problem here is that xy
(and title
) are part of the deprecated PQG graphics and plotSave
does not work with them. The solution is to use plotXY
and plotSetTitle
. Here is a modified version of your example:
dograph(parameters,"Model 1",root$+"1.pdf"); proc (0) = dograph(dat,figtitle,figname); local x,y; struct plotControl myPlot; // Fill plotcontrol structure with // default settings for 'xy' plots myPlot = plotGetDefaults("xy"); // Set plot title and make it large enough for output size plotSetTitle(&myplot, figtitle, "arial", 80); // Increase size of tick labels so they can be seen on output plotSetTicLabelFont(&myPlot, "arial", 40); // Thicker line to be seen on larger output plotSetLineThickness(&myPlot, 4); figtitle;; dat;?; x = dat[.,1]; y = dat[.,2:cols(dat)]; // Draw plot using settings in 'myPlot' plotXY(myPlot, x,y); // Call 'plotSave' AFTER XY plot is drawn plotSave(figname,11|8.5, "in", 300); retp; endp;
Your Answer
1 Answer
0
The problem here is that xy
(and title
) are part of the deprecated PQG graphics and plotSave
does not work with them. The solution is to use plotXY
and plotSetTitle
. Here is a modified version of your example:
dograph(parameters,"Model 1",root$+"1.pdf"); proc (0) = dograph(dat,figtitle,figname); local x,y; struct plotControl myPlot; // Fill plotcontrol structure with // default settings for 'xy' plots myPlot = plotGetDefaults("xy"); // Set plot title and make it large enough for output size plotSetTitle(&myplot, figtitle, "arial", 80); // Increase size of tick labels so they can be seen on output plotSetTicLabelFont(&myPlot, "arial", 40); // Thicker line to be seen on larger output plotSetLineThickness(&myPlot, 4); figtitle;; dat;?; x = dat[.,1]; y = dat[.,2:cols(dat)]; // Draw plot using settings in 'myPlot' plotXY(myPlot, x,y); // Call 'plotSave' AFTER XY plot is drawn plotSave(figname,11|8.5, "in", 300); retp; endp;