annotate _FullBNT/KPMtools/plotBox.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function [h, ht] =plotBox(box, col, str)
matthiasm@8 2 % function h=plotBox(box, col, str)
matthiasm@8 3 %
matthiasm@8 4 % box = [xlow xhigh ylow yhigh]
matthiasm@8 5 % col = color (default - red)
matthiasm@8 6 % str = string printed at center (default '')
matthiasm@8 7
matthiasm@8 8 if nargin < 2, col = 'r'; end
matthiasm@8 9 if nargin < 3, str = ''; end
matthiasm@8 10
matthiasm@8 11 box = double(box); % fails on single
matthiasm@8 12
matthiasm@8 13 h = plot([box(1) box(2) box(2) box(1) box(1)], [ box(3) box(3) box(4) box(4) box(3)]);
matthiasm@8 14 set(h, 'color', col);
matthiasm@8 15 set(h, 'linewidth', 2);
matthiasm@8 16 if ~isempty(str)
matthiasm@8 17 xc = mean(box(1:2));
matthiasm@8 18 yc = mean(box(3:4));
matthiasm@8 19 ht = text(xc, yc, str);
matthiasm@8 20 else
matthiasm@8 21 ht = [];
matthiasm@8 22 end