Search code examples
matlabaxis-labels

Alter tick labels to a '10^ - style' appearance


Though there are quite a lot of answered questions to that kind of issue, I wasn’t able to find a proper solution for my exact problem. Anyway.

I try to format my tick lables like shown in the following example:

I already found out that the ‘sprintf’ command is offering a possibility to alter the tick format. The closest I came to what I want is the 'e-notation' triggered by the following command:

set(ax,'YTickLabel',sprintf('%2.0e|',yticks))

However, I’d like my labels to appear just as shown in the example picture. Is there a simple way to do that?

Thank you very much in advance,

Joe


Solution

  • Am I missing something? Why not use semilogy?

    x = -3:0;
    y = 10.^x;
    semilogy(x, y);
    set(gca, 'YMinorGrid', 'on')
    

    Graph