# how to set y-axis as log scale?

7,631 views (last 30 days)

Show older comments

Rohit Bhoi
on 15 Apr 2016

Commented: Weirong Sun
on 9 May 2022

##### 0 Comments

### Accepted Answer

Walter Roberson
on 15 Apr 2016

Edited: MathWorks Support Team
on 28 Nov 2018

The best way to create that type of axes is to use the semilogy function. Alternatively, you can set the ‘YScale’ property on the axes:

set(gca, 'YScale', 'log')

##### 14 Comments

### More Answers (3)

Rohit Sinha
on 27 Apr 2022

The easiest way to do this is simply use the following command instead of plot

semilogy(x,y);

This will plot x axis on a linear scale and y axis on a log scale. Similarly, if you want to plot x axis on log scale and y axis on a linear scale, you can use

semilogx(x,y) ;

##### 1 Comment

### See Also

### Community Treasure Hunt

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

Start Hunting!