diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/KPMtools/suptitle.m | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/KPMtools/suptitle.m')
| -rw-r--r-- | sourcecodes/bnt-master/KPMtools/suptitle.m | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMtools/suptitle.m b/sourcecodes/bnt-master/KPMtools/suptitle.m new file mode 100644 index 00000000..fa12c541 --- /dev/null +++ b/sourcecodes/bnt-master/KPMtools/suptitle.m @@ -0,0 +1,105 @@ +function hout=suptitle(str, fs) +%SUPTITLE Puts a title above all subplots. +% SUPTITLE('text') adds text to the top of the figure +% above all subplots (a "super title"). Use this function +% after all subplot commands. + +% Drea Thomas 6/15/95 drea@mathworks.com + +% Warning: If the figure or axis units are non-default, this +% will break. + +% Parameters used to position the supertitle. + +% Amount of the figure window devoted to subplots +plotregion = .92; + +% Y position of title in normalized coordinates +titleypos = .95; + +% Fontsize for supertitle +if nargin < 2 + fs = get(gcf,'defaultaxesfontsize')+4; +end + +% Fudge factor to adjust y spacing between subplots +fudge=1; + +haold = gca; +figunits = get(gcf,'units'); + +% Get the (approximate) difference between full height (plot + title +% + xlabel) and bounding rectangle. + + if (~strcmp(figunits,'pixels')), + set(gcf,'units','pixels'); + pos = get(gcf,'position'); + set(gcf,'units',figunits); + else, + pos = get(gcf,'position'); + end + ff = (fs-4)*1.27*5/pos(4)*fudge; + + % The 5 here reflects about 3 characters of height below + % an axis and 2 above. 1.27 is pixels per point. + +% Determine the bounding rectange for all the plots + +% h = findobj('Type','axes'); + +% findobj is a 4.2 thing.. if you don't have 4.2 comment out +% the next line and uncomment the following block. + +h = findobj(gcf,'Type','axes'); % Change suggested by Stacy J. Hills + +% If you don't have 4.2, use this code instead +%ch = get(gcf,'children'); +%h=[]; +%for i=1:length(ch), +% if strcmp(get(ch(i),'type'),'axes'), +% h=[h,ch(i)]; +% end +%end + + + + +max_y=0; +min_y=1; + +oldtitle =0; +for i=1:length(h), + if (~strcmp(get(h(i),'Tag'),'suptitle')), + pos=get(h(i),'pos'); + if (pos(2) < min_y), min_y=pos(2)-ff/5*3;end; + if (pos(4)+pos(2) > max_y), max_y=pos(4)+pos(2)+ff/5*2;end; + else, + oldtitle = h(i); + end +end + +if max_y > plotregion, + scale = (plotregion-min_y)/(max_y-min_y); + for i=1:length(h), + pos = get(h(i),'position'); + pos(2) = (pos(2)-min_y)*scale+min_y; + pos(4) = pos(4)*scale-(1-scale)*ff/5*3; + set(h(i),'position',pos); + end +end + +np = get(gcf,'nextplot'); +set(gcf,'nextplot','add'); +if (oldtitle), + delete(oldtitle); +end +ha=axes('pos',[0 1 1 1],'visible','off','Tag','suptitle'); +ht=text(.5,titleypos-1,str);set(ht,'horizontalalignment','center','fontsize',fs); +set(gcf,'nextplot',np); +axes(haold); +if nargout, + hout=ht; +end + + + |
