formatting axes for a plot
Mostrar comentarios más antiguos
Hello,
Why whenever I do this to format the x-axis to be between 0-6 and then type (x10^4) it does not show the x-ticks on the x-axis:
xVals = 0:.6:6;
set(gca,'xtick',xVals);
expVal = 4; %exponent you want
set(gca,'XTickLabel',sprintf('%2.1f|',xVals));%10^expVal));
pos = get(gca,'Position');
offset = 0.00; %how far to the right you want the exponent
annotation('textbox',[pos(1)+ pos(3)+offset, pos(2), 0.2, 0.2],...
'String',['$\times 10^' num2str(expVal) '$'],...
'Interpreter','latex',...
'VerticalAlignment','bottom',...
'EdgeColor','none')
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 1 de En. de 2013
Add to your code
set(gca,'xlim',[0 6])
4 comentarios
Sam Alex
el 1 de En. de 2013
Azzi Abdelmalek
el 1 de En. de 2013
Editada: Azzi Abdelmalek
el 1 de En. de 2013
There is a difference, in this case, x-ticks are visibles
close
xVals = 0:.6:6;
set(gca,'xtick',xVals);
expVal = 4; %exponent you want
set(gca,'XTickLabel',sprintf('%2.1f|',xVals));%10^expVal));
pos = get(gca,'Position');
offset = 0.00; %how far to the right you want the exponent
annotation('textbox',[pos(1)+ pos(3)+offset, pos(2), 0.2, 0.2],...
'String',['$\times 10^' num2str(expVal) '$'],...
'Interpreter','latex',...
'VerticalAlignment','bottom',...
'EdgeColor','none')
set(gca,'xlim',[0 6])
Sam Alex
el 1 de En. de 2013
Azzi Abdelmalek
el 1 de En. de 2013
Post the code which is making a problem
Categorías
Más información sobre Title en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!