📄 subplot.cpp
字号:
// % if we haven't recovered position yet, generate it from mnp info:
// elseif(isempty(position))
//
} else if (tobool(mwVe(isempty(mwVv(position, "position"))))) {
//
// if (min(thisPlot) < 1)
//
if (mclLtBool(mwVe(min(mwVa(thisPlot, "thisPlot"))), _mxarray5_)) {
//
// error('Illegal plot number.')
//
error(_mxarray32_);
//
// elseif (max(thisPlot) > ncols*nrows)
//
} else if (mclGtBool(
mwVe(max(mwVa(thisPlot, "thisPlot"))),
mwVa(ncols, "ncols") * mwVa(nrows, "nrows"))) {
//
// error('Index exceeds number of subplots.')
//
error(_mxarray17_);
//
// else
//
} else {
//
// % This is the percent offset from the subplot grid of the plotbox.
// PERC_OFFSET_L = 2*0.09;
//
PERC_OFFSET_L = _mxarray34_;
//
// PERC_OFFSET_R = 2*0.045;
//
PERC_OFFSET_R = _mxarray35_;
//
// PERC_OFFSET_B = PERC_OFFSET_L;
//
PERC_OFFSET_B = mwVsv(PERC_OFFSET_L, "PERC_OFFSET_L");
//
// PERC_OFFSET_T = PERC_OFFSET_R;
//
PERC_OFFSET_T = mwVsv(PERC_OFFSET_R, "PERC_OFFSET_R");
//
// if nrows > 2
//
if (mclGtBool(mwVa(nrows, "nrows"), _mxarray19_)) {
//
// PERC_OFFSET_T = 0.9*PERC_OFFSET_T;
//
PERC_OFFSET_T
= _mxarray36_ * mwVv(PERC_OFFSET_T, "PERC_OFFSET_T");
//
// PERC_OFFSET_B = 0.9*PERC_OFFSET_B;
//
PERC_OFFSET_B
= _mxarray36_ * mwVv(PERC_OFFSET_B, "PERC_OFFSET_B");
//
// end
//
}
//
// if ncols > 2
//
if (mclGtBool(mwVa(ncols, "ncols"), _mxarray19_)) {
//
// PERC_OFFSET_L = 0.9*PERC_OFFSET_L;
//
PERC_OFFSET_L
= _mxarray36_ * mwVv(PERC_OFFSET_L, "PERC_OFFSET_L");
//
// PERC_OFFSET_R = 0.9*PERC_OFFSET_R;
//
PERC_OFFSET_R
= _mxarray36_ * mwVv(PERC_OFFSET_R, "PERC_OFFSET_R");
//
// end
//
}
//
//
// row = (nrows-1) -fix((thisPlot-1)/ncols);
//
row
= mwVa(nrows, "nrows") - _mxarray5_
- mwVe(
fix(
(mwVa(thisPlot, "thisPlot") - _mxarray5_)
/ mwVa(ncols, "ncols")));
//
// col = rem (thisPlot-1, ncols);
//
col
= rem(
mwVa(thisPlot, "thisPlot") - _mxarray5_,
mwVa(ncols, "ncols"));
//
//
// % For this to work the default axes position must be in normalized coordinates
// if ~strcmp(get(gcf,'defaultaxesunits'),'normalized')
//
if (mclNotBool(
mwVe(
strcmp(
mwVe(Nget(1, mwVarargin(mwVe(gcf()), _mxarray37_))),
_mxarray39_)))) {
//
// warning('DefaultAxesUnits not normalized.')
//
ans.EqPrintAns(Nwarning(0, NULL, _mxarray41_));
//
// tmp = axes;
//
tmp = Naxes(1, mwVarargin());
//
// set(axes,'units','normalized')
//
ans.EqPrintAns(
Nset(
0,
mwVarargin(
mwVe(Naxes(1, mwVarargin())), _mxarray43_, _mxarray39_)));
//
// def_pos = get(tmp,'position');
//
def_pos = Nget(1, mwVarargin(mwVv(tmp, "tmp"), _mxarray20_));
//
// delete(tmp)
//
delete_func(mwVarargin(mwVv(tmp, "tmp")));
//
// else
//
} else {
//
// def_pos = get(gcf,'DefaultAxesPosition');
//
def_pos = Nget(1, mwVarargin(mwVe(gcf()), _mxarray45_));
//
// end
//
}
//
// col_offset = def_pos(3)*(PERC_OFFSET_L+PERC_OFFSET_R)/ ...
//
col_offset
= mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 3))
* (mwVv(PERC_OFFSET_L, "PERC_OFFSET_L")
+ mwVv(PERC_OFFSET_R, "PERC_OFFSET_R"))
/ (mwVa(ncols, "ncols") - mwVv(PERC_OFFSET_L, "PERC_OFFSET_L")
- mwVv(PERC_OFFSET_R, "PERC_OFFSET_R"));
//
// (ncols-PERC_OFFSET_L-PERC_OFFSET_R);
// row_offset = def_pos(4)*(PERC_OFFSET_B+PERC_OFFSET_T)/ ...
//
row_offset
= mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 4))
* (mwVv(PERC_OFFSET_B, "PERC_OFFSET_B")
+ mwVv(PERC_OFFSET_T, "PERC_OFFSET_T"))
/ (mwVa(nrows, "nrows") - mwVv(PERC_OFFSET_B, "PERC_OFFSET_B")
- mwVv(PERC_OFFSET_T, "PERC_OFFSET_T"));
//
// (nrows-PERC_OFFSET_B-PERC_OFFSET_T);
// totalwidth = def_pos(3) + col_offset;
//
totalwidth
= mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 3))
+ mwVv(col_offset, "col_offset");
//
// totalheight = def_pos(4) + row_offset;
//
totalheight
= mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 4))
+ mwVv(row_offset, "row_offset");
//
// width = totalwidth/ncols*(max(col)-min(col)+1)-col_offset;
//
width
= mwVv(totalwidth, "totalwidth") / mwVa(ncols, "ncols")
* (mwVe(max(mwVv(col, "col"))) - mwVe(min(mwVv(col, "col")))
+ _mxarray5_)
- mwVv(col_offset, "col_offset");
//
// height = totalheight/nrows*(max(row)-min(row)+1)-row_offset;
//
height
= mwVv(totalheight, "totalheight") / mwVa(nrows, "nrows")
* (mwVe(max(mwVv(row, "row"))) - mwVe(min(mwVv(row, "row")))
+ _mxarray5_)
- mwVv(row_offset, "row_offset");
//
// position = [def_pos(1)+min(col)*totalwidth/ncols ...
//
position
= horzcat(
mwVarargin(
mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 1))
+ mwVe(min(mwVv(col, "col")))
* mwVv(totalwidth, "totalwidth")
/ mwVa(ncols, "ncols"),
mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 2))
+ mwVe(min(mwVv(row, "row")))
* mwVv(totalheight, "totalheight")
/ mwVa(nrows, "nrows"),
mwVv(width, "width"),
mwVv(height, "height")));
//
// def_pos(2)+min(row)*totalheight/nrows ...
// width height];
// if width <= 0.5*totalwidth/ncols
//
if (mclLeBool(
mwVv(width, "width"),
_mxarray47_ * mwVv(totalwidth, "totalwidth")
/ mwVa(ncols, "ncols"))) {
//
// position(1) = def_pos(1)+min(col)*(def_pos(3)/ncols);
//
mclIntArrayAssign(
&position,
mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 1))
+ mwVe(min(mwVv(col, "col")))
* (mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 3))
/ mwVa(ncols, "ncols")),
1);
//
// position(3) = 0.7*(def_pos(3)/ncols)*(max(col)-min(col)+1);
//
mclIntArrayAssign(
&position,
_mxarray48_
* (mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 3))
/ mwVa(ncols, "ncols"))
* (mwVe(max(mwVv(col, "col"))) - mwVe(min(mwVv(col, "col")))
+ _mxarray5_),
3);
//
// end
//
}
//
// if height <= 0.5*totalheight/nrows
//
if (mclLeBool(
mwVv(height, "height"),
_mxarray47_ * mwVv(totalheight, "totalheight")
/ mwVa(nrows, "nrows"))) {
//
// position(2) = def_pos(2)+min(row)*(def_pos(4)/nrows);
//
mclIntArrayAssign(
&position,
mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 2))
+ mwVe(min(mwVv(row, "row")))
* (mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 4))
/ mwVa(nrows, "nrows")),
2);
//
// position(4) = 0.7*(def_pos(4)/nrows)*(max(row)-min(row)+1);
//
mclIntArrayAssign(
&position,
_mxarray48_
* (mwVe(mclIntArrayRef(mwVsv(def_pos, "def_pos"), 4))
/ mwVa(nrows, "nrows"))
* (mwVe(max(mwVv(row, "row"))) - mwVe(min(mwVv(row, "row")))
+ _mxarray5_),
4);
//
// end
//
}
//
// end
//
}
//
// end
//
}
//
//
// % kill overlapping siblings if mnp specifier was used:
// nextstate = get(gcf,'nextplot');
//
nextstate = Nget(1, mwVarargin(mwVe(gcf()), _mxarray49_));
//
// if strncmp(nextstate,'replace',7), nextstate = 'add'; end
//
if (tobool(
mwVe(
strncmp(mwVv(nextstate, "nextstate"), _mxarray51_, _mxarray53_)))) {
nextstate = _mxarray54_;
}
//
// if(kill_siblings)
//
if (tobool(mwVv(kill_siblings, "kill_siblings"))) {
//
// if delay_destroy
//
if (tobool(mwVv(delay_destroy, "delay_destroy"))) {
//
// if nargout
//
if (tobool(nargout_)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -