Vertical Xticks

조회 수: 11 (최근 30일)
Jonathan
Jonathan 2011년 8월 5일
Instead of being shown as horizontal numbers I want the X axis to show the numbers vertically. How can I do this?

답변 (2개)

Oleg Komarov
Oleg Komarov 2011년 8월 5일
There are submission that do this kind of stuff, nevertheless the "manual" implementation with text labels:
% Dummy plot
plot(1:10,1:10)
% Retrieve number of Xticks
xticks = get(gca,'Xtick');
nticks = numel(xticks)-1;
% Clear Xlabels
set(gca,'Xtickl',[])
% Text options for new Xlabels
opt = {'Units' ,'Normalized',...
'HorizontalAlignment' ,'Center',...
'Rotation' ,90};
% Create text for each Xlabel
arrayfun(@(x,xlbl) text(x,-.025,sprintf('%d',xlbl),opt{:}),0:1/nticks:1,xticks)

Jan
Jan 2011년 8월 5일
There are some tools in the FEX: Search tick+rotate in the FEX

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by