2009年7月17日星期五

Scilab: subplot

If one wants to plot several subfigures in a large figure, the command is subplot.

Calling Sequence :

subplot(m,n,p)
subplot(mnp)

Parameters :

m,n,p : positive integers.

Here m means the line number, n means the column number, p means the subfigure number. Just imagine the large figure is an m×n matrix and each element in it is a subfigure.

The following code generates this picture.




ff = fscanfMat('D:\WORK\Scilab\spc-only-Ez1.txt');
t = ff(:,1);

scf(1);clf(1); //create figure 1, and clean it.
Ez = ff(:,2);
subplot(2,2,1) //figure 1 contains 4 subfigures, this is the first one.
plot(t,Ez,'k.','markersize',3); //plot the first subfigure
xtitle("Ez at z = 10um");
xgrid(1);
a=get("current_axes");
a.x_label.text="t*C(m)";
a.y_label.text="Ez(MV/m)";

Ez = ff(:,3);
subplot(2,2,2) //figure 1 contains 4 subfigures, this is the second one.
plot(t,Ez,'k.','markersize',3); //plot the second subfigure
xtitle("Ez at z = 20um");
xgrid(1);
a=get("current_axes");
a.x_label.text="t*C(m)";
a.y_label.text="Ez(MV/m)";

Ez = ff(:,4);
subplot(2,2,3) //figure 1 contains 4 subfigures, this is the third one.
plot(t,Ez,'k.','markersize',3); // plot the third subfigure.
xtitle("Ez at z = 30um");
xgrid(1);
a=get("current_axes");
a.x_label.text="t*C(m)";
a.y_label.text="Ez(MV/m)";

没有评论:

发表评论