comparison toolboxes/FullBNT-1.0.7/KPMtools/rotate_xlabel.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function hText = rotate_xlabel(degrees, newlabels)
2
3 % Posted to comp.soft-sys.matlab on 2003-05-01 13:45:36 PST
4 % by David Borger (borger@ix.netcom.com)
5
6 xtl = get(gca,'XTickLabel');
7 set(gca,'XTickLabel','');
8 lxtl = length(xtl);
9 xtl = newlabels;
10 if 0 % nargin>1
11 lnl = length(newlabels);
12 if lnl~=lxtl
13 error('Number of new labels must equal number of old');
14 end;
15 xtl = newlabels;
16 end;
17
18
19 hxLabel=get(gca,'XLabel');
20 xLP=get(hxLabel,'Position');
21 y=xLP(2);
22 XTick=get(gca,'XTick');
23 y=repmat(y,length(XTick),1);
24 %fs=get(gca,'fontsize');
25 fs = 12;
26 hText=text(XTick,y,xtl,'fontsize',fs);
27 set(hText,'Rotation',degrees,'HorizontalAlignment','right');
28
29 % Modifications by KPM
30
31 ylim = get(gca,'ylim');
32 height = ylim(2)-ylim(1);
33 N = length(hText);
34 for i=1:N
35 voffset = ylim(2) - 0*height;
36 set(hText(i), 'position', [i voffset 0]);
37 end