annotate _FullBNT/KPMtools/rotate_xlabel.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 hText = rotate_xlabel(degrees, newlabels)
matthiasm@8 2
matthiasm@8 3 % Posted to comp.soft-sys.matlab on 2003-05-01 13:45:36 PST
matthiasm@8 4 % by David Borger (borger@ix.netcom.com)
matthiasm@8 5
matthiasm@8 6 xtl = get(gca,'XTickLabel');
matthiasm@8 7 set(gca,'XTickLabel','');
matthiasm@8 8 lxtl = length(xtl);
matthiasm@8 9 xtl = newlabels;
matthiasm@8 10 if 0 % nargin>1
matthiasm@8 11 lnl = length(newlabels);
matthiasm@8 12 if lnl~=lxtl
matthiasm@8 13 error('Number of new labels must equal number of old');
matthiasm@8 14 end;
matthiasm@8 15 xtl = newlabels;
matthiasm@8 16 end;
matthiasm@8 17
matthiasm@8 18
matthiasm@8 19 hxLabel=get(gca,'XLabel');
matthiasm@8 20 xLP=get(hxLabel,'Position');
matthiasm@8 21 y=xLP(2);
matthiasm@8 22 XTick=get(gca,'XTick');
matthiasm@8 23 y=repmat(y,length(XTick),1);
matthiasm@8 24 %fs=get(gca,'fontsize');
matthiasm@8 25 fs = 12;
matthiasm@8 26 hText=text(XTick,y,xtl,'fontsize',fs);
matthiasm@8 27 set(hText,'Rotation',degrees,'HorizontalAlignment','right');
matthiasm@8 28
matthiasm@8 29 % Modifications by KPM
matthiasm@8 30
matthiasm@8 31 ylim = get(gca,'ylim');
matthiasm@8 32 height = ylim(2)-ylim(1);
matthiasm@8 33 N = length(hText);
matthiasm@8 34 for i=1:N
matthiasm@8 35 voffset = ylim(2) - 0*height;
matthiasm@8 36 set(hText(i), 'position', [i voffset 0]);
matthiasm@8 37 end