Vertical Xticks
3 次查看(过去 30 天)
显示 更早的评论
Instead of being shown as horizontal numbers I want the X axis to show the numbers vertically. How can I do this?
0 个评论
回答(2 个)
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!