Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIconACON       Home/Topics   |   Commands   |   More Examples

Multiple Plots

Multiple Plots

/*----------------------------------------------*/
/* This script demonstrates Multiple Plots */
/*----------------------------------------------*/

Function Label_Axis(thisplot,thispage,totalplots)
{ /* this function labels the axes of "outside" plots */
nperow = INT((right - left) /
sizex * 1.0);
npercol = INT((top - bot) / sizey * 1.0);
nperpage = nperow * npercol;
npages = CEIL(totalplots * 1.0 / nperpage);
if (thispage < npages) {
nplotpage = nperpage
}
else{
nplotpage = totalplots - (nperpage * (thispage - 1));
};
nfullrows = nplotpage / nperow;
thisrow = INT((top - y) / sizey * 1.0) + 1;
thiscol = INT((x - left) / sizex * 1.0) + 1;
lastcol = nplotpage - (nperow * nfullrows);
if (y == top) then axtop = 1 else axtop = 0;
if (x == left) then axleft = 1 else axleft = 0;
if (thisrow > nfullrows) then axbot = 1 else axbot = 0;
if ((thisrow == nfullrows) && (thiscol > lastcol)) then axbot = 1;
if ((thisrow == nfullrows) && (thispage < npages)) then axbot = 1;
if ((thisrow <= nfullrows) && (thiscol == nperow)) then axright = 1 else axright = 0;
if ((thisrow > nfullrows) && (thiscol == lastcol)) then axright = 1;
Axis(1,1,.5,.5,axleft,axright,axbot,axtop,0);
};// end function Label_Axis
/*----------------------------------------------*/
/* plot a number of plots per page, each from a different file */
/*----------------------------------------------*/
Function multifile(filename,nplots)
{
sizex = 75; /* width of subplot in mm */
sizey = 63; /* height of subplot in mm */
filenum = 0;
bot = 40; /* window within which subplot will be drawn */
top = 260;
left = 30;
right = 200;
y = top; /* top of page */
x = left; plot = 1; page = 1;
while (nplots >= filenum = filenum + 1) do
{
Data_Viewport(mm(x),mm(x + sizex),mm(y - sizey),mm(y));
fullname = cat(filename,str(filenum + 90));
draw_text (mm(x + sizex - 15),mm(y - sizey + 2), cat("19", str(filenum + 90)));
print("Now working on ",fullname);
Matrix_Read(fullname,"xyz_data",-1);
Overlay_File(mappath("Coast1"));
/* Aggregate the data into Total per 1 deg. squares */
aggdata = Aggregate(xyz_data[;4], 1., xyz_data[;5], 1., "TOTAL", xyz_data[;6]); // new syntax
aggdata[;1] -= 0.5; // move result to center of square
aggdata[;2] += 0.5;
Negate_X_axis_Data(xyz_data[;4 5 6]);
/* Aggregate the data into Total per 1/3 deg. squares */
aggdata = Aggregate(xyz_data[;4], 1.0/3.0, xyz_data[;5], 1.0/3.0, "TOTAL", xyz_data[;6]); // new syntax
aggdata[;1] -= 1.0/3.0; // move result to center of square
aggdata[;2] += 1.0/3.0;
Scaled_Symbols(aggdata);
Label_Axis(plot,page,nplots);
x = x + sizex; plot = plot + 1;
if ((x + sizex) >= right)
{ x = left;
y = y - sizey;
};
if (((y - sizey) <= bot) && (filenum < nplots))
{ page = page + 1;
next_page();
y = top;
};
};//end while
};// end function multifile

/*----------------------------------------------*/
/* Plot the data from Haddock Research surveys */
/* input data filenames: Test_HaddockSurvey91 and Test_HaddockSurvey92*/
/*----------------------------------------------*/
Data_Window(-69.,-62.,41.,46.);
data_projection("MERCATOR");
Continuous_Scaling(2, 0, mm(1.), mm(4.), 0.1, 800., 0.1,30., 100., 300., 800);
Data_Contour_Levels(0.,0.5);
Data_Contour_Levels(0,0.8, 20,0.65, 50,.5, 100,0.35, 150,0.2);
Multifile(cat(HostPath(),"Test Data/Test_HaddockSurvey"),2);
Symbol_legend(mm(192),mm(260));


AconIconACON       Home/Topics   |   Commands   |   More Examples



Last Modified : 2003-11-19