how to plot both axis (X and Y axis) as log scale using code ?
Show older comments
I have use loglog(X, Y) but I getting an error.
2 Comments
Rik
on 19 Jul 2018
That function is indeed the one you're looking for. Please post the complete error message (so all red text) and/or a piece of standalone code that we can run to reproduce the error.
Adam
on 19 Jul 2018
Show the code and the error otherwise what help are you expecting to get?!
Answers (1)
Constantino Carlos Reyes-Aldasoro
on 19 Jul 2018
There are two easy ways to do this. First you can pass the values, but instead of directly the values pass their log, i.e.
plot(log(x), log(y))
The other way is through the handles
hPlot = plot(x,y);
and then modify the properties of the axes:
hPlot.xscale = 'log';
hPlot.yscale = 'log';
you can always change back to 'linear' if needed.
2 Comments
Rik
on 19 Jul 2018
The loglog function will do that second automatically.
Vishnu Dhakad
on 19 Jul 2018
Edited: Vishnu Dhakad
on 19 Jul 2018
Categories
Find more on Log Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!