help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vertical xtick labels


From: Eric Chassande-Mottin
Subject: vertical xtick labels
Date: Tue, 21 Jul 2009 06:26:10 -0700 (PDT)


here is a script that illustrates how to rotate the xtick label and put them
vertically.

i thought that may be useful to others.

eric

clear

## init demo plot
clf
plot(1:4);
xtick=[1 2 3 4];
set(gca,'xtick',xtick);
xticklabel=["a";"b";"c";"d"];
set(gca,'xticklabel',xticklabel);

## get position of current xtick labels
h = get(gca,'xlabel');
xlabelstring = get(h,'string');
xlabelposition = get(h,'position');

## construct position of new xtick labels
yposition = xlabelposition(2);
yposition = repmat(yposition,length(xtick),1);

## disable current xtick labels
set(gca,'xtick',[]);

## set up new xtick labels and rotate
hnew = text(xtick, yposition, xticklabel);
set(hnew,'rotation',90,'horizontalalignment','right');
-- 
View this message in context: 
http://www.nabble.com/vertical-xtick-labels-tp24587620p24587620.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]