wrap and center justify axes and tick label

I have been tried to get text wrapping and center justifying axes and ticklabel, I tried textwrap and uicontrol and so on but seen not work. can you teach me how to do that

 Respuesta aceptada

Grzegorz Knor
Grzegorz Knor el 22 de Oct. de 2011
Analyze this example:
plot(1:5)
xTick = 1:5;
set(gca,'xtick',xTick)
yTick = get(gca,'ytick');
set(gca,'xticklabel',[])
xTickLabel = {{'first';'label'},'second',{'third';'label'},'long fourth tick label ','fifth'};
for k = 1:length(xTick)
text(xTick(k),yTick(1)-0.05*(yTick(end)-yTick(1)),xTickLabel{k},'HorizontalAlignment','center')
end

Más respuestas (1)

Andi Rusdin
Andi Rusdin el 24 de Oct. de 2011

0 votos

i have one more question. how to expand plot windows below the xticklabel so i can put X label below the tick label.
thanks

1 comentario

Grzegorz Knor
Grzegorz Knor el 25 de Oct. de 2011
Try:
s = xlabel('my xlabel');
set(s,'Units','normalized','Position',[0.5 -0.1])

Iniciar sesión para comentar.

Categorías

Community Treasure Hunt

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

Start Hunting!

Translated by