plot_box.m

来自「基于Matlab的地震数据处理显示和测井数据显示于处理的小程序」· M 代码 · 共 41 行

M
41
字号
function handle=plot_box(loc,color,linewidth)
% Function plots a rectangular box
%
%        handle=plot_box(loc,color,linewidth)
% INPUT
% loc    vector with elements xa xe ya ye
%        so the box has the corner coordinates (xa,ya), (xe,ya), (xe,ye), (xa,ye)
%        This vector is identical to the one output by the command AXIS
% color  string with color and line style. 
%        Default: 'r-'
% linewidth  line width of the outlin of the box. 
%        Default: 2
% OUTPUT
% handle "handle" to box

if nargin < 3
   linewidth=2;
end
if nargin < 2
   color='r';
end
if length(color) > 1
   linestyle=color(2:end);
else
   linestyle='-';
end

axis manual
if nargout == 1
   handle=line([loc(1),loc(2),loc(2),loc(1),loc(1)], ...
      [loc(3),loc(3),loc(4),loc(4),loc(3)],'Color',color(1),'LineWidth',linewidth, ...
      'LineStyle',linestyle','EraseMode','none');
else
   line([loc(1),loc(2),loc(2),loc(1),loc(1)], ...
      [loc(3),loc(3),loc(4),loc(4),loc(3)],'Color',color(1),'LineWidth',linewidth, ...
      'LineStyle',linestyle','EraseMode','none');
end



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?