how to set y-axis as log scale?

5,906 views (last 30 days)
Rohit Bhoi
Rohit Bhoi on 15 Apr 2016
Commented: Samuel Pulpan on 15 Jan 2022 at 9:58
I am plotting x-y plot using plot function. I want to set only y-axis as log scale and x-axis as linear? How to do that? I used loglog function but it scales both axis but I want only Y.

Accepted Answer

Walter Roberson
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')
Walter Roberson
Walter Roberson on 1 Jul 2021
You are correct, it should have been division not multiplication.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!