creating subplot

Dear Madam or Sir,

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

for i (1, 94, 1);
   plotLayout(47,2,i);
   temp=selif(subject_ov[.,1 3], subject_ov[.,2].==firmid[i]);
   plotxy(temp[.,1],temp[.,2]);
endfor;
plotClearLayout();

The matrix subject_ov and firmID are as follows.

subject_ov:

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

FirmID:

2

4

 

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!

 

best,

zhiying

5 Answers



0



Hi,

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!

 

best,

zhiying



0



  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);

 

 

 



0



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
g16_pref_new_window
The code:

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

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));
endfor;
plotClearLayout();

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().

aptech

1,488


0



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

aptech

1,488


-1



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.

aptech

1,488

Your Answer


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 30 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy