creating subplot

Dear Madam or Sir,

I'm trying to create the subplots with the following code.

for i (1, 94, 1);
   temp=selif(subject_ov[.,1 3], subject_ov[.,2].==firmid[i]);

The matrix subject_ov and firmID are as follows.


1990  2   5.41
1991  2   8.67
1992  2   8.67
1993  2   8.67
1994  2   10.08
1995  2   10.09
1996  2   11.09
1997  2   12.82
1998  2   12.82
1999  2   12.82
2000 2   12.82

1999  4   0.00
2000  4  0.08





My question is when I run this code. The graph always come out as two separate graphs instead of two subplots under 1 graph. Would you kindly advise why it is happening and how should I do to make it in one graph?

Thanks and looking forward to your reply!




5 Answers



Thank you for advices but it is not what I want exactly.

What I want is the xy plots to be in ONE graph instead of multiple graphs. So it is not about getting graphs in old or new windows.

The ploylayout function divides the canvas into different subareas and assign each plot into these subareas. However, my above code is generating two graphs instead of two plots in one graph. would you kindly take a look at it or run it from your end. Thank you so much!




  1. First, you did not run your code before you writing them here.

plotXY(x, rndu(10, 1); is not closed


2. Both codes give the same outputs, try it yourself. As long as you use

plotLayout statement, the plots are in the same graph, but one end up producing 4 graphs. Yes, it has nothing to do with the windows, they are in the same window. However, on the tab you could see 4 graphs are produced.

Still if you don't think so. Try to use the plotsave function below to see if they are in the same graph or not for your second code.

dim = { 30, 18 };
plotSave("mygraph.pdf", dim);





I do apologize for the mistakes in the code in the last post. With Tools->Preferences->Graphics Set to open the next graph in a new tab
The code:

x = seqa(1, 1, 10);
for i(1, 4, 1);
    plotLayout(2, 2, i);
    plotXY(x, rndu(10, 1));

produces these 4 tabbed graphs below. If I am understanding you correctly, this is the problem that you are having--each graph is being drawn in a different graph tab.
GAUSS graphs in 4 tabs
This code:

struct plotControl myPlot;
myPlot = plotGetDefaults("xy");
plotSetNewWindow(&myPlot, 0);

x = seqa(1, 1, 10);
for i(1, 4, 1);
    plotLayout(2, 2, i);
    plotXY(myPlot, x, rndu(10, 1));

Produces the graph below. I think what you want is something like the graph below:
Four graphs in one graph tab
If that illustrates the problem you are having and what you would like to see, you can either change the preferences shown in the first image in this post or you can use plotSetNewWindow().


Or if you are looking to draw multiple lines within the same set of axes, you would need to use plotAddXY.


There is an option of whether each graph is drawn in a new window or whether it reuses the last graph window. You can control this from the main GAUSS menu Tools->Preferences->Graphics, or you can use the function plotSetNewWindow.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy