I am making some graphs in GAUSS 12 with multiple subplots. I would like the scale to be the same on all of the plots. Is there an easy way to do this?

## 1 Answer

0

At the bottom of this post is GAUSS procedure that will control the extent of the x and y axes on your plots with the graphics for version 12 and beyond. You can either pass in two 2x1 vectors with the minimum and maximum value for the respective axes or you can pass in a vector of any length and it will scale the plot to include the smallest and largest elements of that vector. It should be called immediately after the graph is drawn. Here is a simple usage example:

x = seqa(1, 1, 10); y = cos(x); xrange = { -3, 12 }; yRange = { -2, 2 }; plotXY(x, y); scalePlot(xRange, yRange);

proc(0) = scaleplot1(x,y); struct plotControl MyPlot; MyPlot = plotGetDefaults("xy"); //Turn off legend for this line plotSetLegend(&MyPlot,"off"); //SetLineStyle to 0 so the line does not appear plotSetLineStyle(&MyPlot,0); //Draw an invisible line from smallest x and smallest y to // the largest x and largest y. plotAddXY(MyPlot,minc(x)|maxc(x),minc(y)|maxc(y)); //Reset SetLineStyle to show line plotSetLineStyle(&MyPlot,1); endp;

## Your Answer

## 1 Answer

At the bottom of this post is GAUSS procedure that will control the extent of the x and y axes on your plots with the graphics for version 12 and beyond. You can either pass in two 2x1 vectors with the minimum and maximum value for the respective axes or you can pass in a vector of any length and it will scale the plot to include the smallest and largest elements of that vector. It should be called immediately after the graph is drawn. Here is a simple usage example:

x = seqa(1, 1, 10); y = cos(x); xrange = { -3, 12 }; yRange = { -2, 2 }; plotXY(x, y); scalePlot(xRange, yRange);

proc(0) = scaleplot1(x,y); struct plotControl MyPlot; MyPlot = plotGetDefaults("xy"); //Turn off legend for this line plotSetLegend(&MyPlot,"off"); //SetLineStyle to 0 so the line does not appear plotSetLineStyle(&MyPlot,0); //Draw an invisible line from smallest x and smallest y to // the largest x and largest y. plotAddXY(MyPlot,minc(x)|maxc(x),minc(y)|maxc(y)); //Reset SetLineStyle to show line plotSetLineStyle(&MyPlot,1); endp;