Is there a way to lower the XTickLabels a little?

My XTickLabels and YTickLabels slightly overlap for the two values at the plot origin (bottom left). I could simply use a smaller font but would prefer the following... Is there a way to lower the XTickLabels a little?

 Accepted Answer

aH = axes;
plot(rand(10,1));
xCoord = get(aH,'Xtick');
yCoord = get(aH,'YLim');
yCoord(2) = [];
offset = 0.05; %How far from the axes, in axes units
yCoord = yCoord-offset;
set(aH,'XTickLabel',[]); %Comment out this line to see where the old ticks were
for ii = xCoord
text(ii,yCoord,num2str(ii),...
'HorizontalAlignment','center',...
'VerticalAlignment','middle');
end

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!