# log-log plot explained

30 views (last 30 days)
jojo on 23 Feb 2020
Edited: dpb on 23 Feb 2020
How can do we produce a log-log visualization for the following data set?
y=[0.6280 0.6554 0.6760 0.6877];
x=[0.27 0.14 0.07 0.04];
figure(1)
loglog(x,y)
An explanation would be great too. Thanks

dpb on 23 Feb 2020
Edited: dpb on 23 Feb 2020
You have created such...what's the problem?
Probably the issue is that your data don't cover a sufficient range in either x or y that the effect of a logarithmic axis is obvious; there is really not much point in using log axes unless data cover many orders of magnitude; otherwise just linear is clearer.
The only possible reason I can think of for such with data such as you've given would be if there were known to be some reason the two are somehow expected to be related by such...but you've given zero context so that's purely conjecture.
If you change the x-,y-limits from the very narrow range that are the default autoscaling, perhaps the nature of the logarithmic axes will be more apparent--
xlim([0.01 1])
ylim([0.4 1])
results in Oh! One other thing...given that you've given the x data in decreasing order and ML will always plot by default the axes in increasing order, maybe you'd prefer
hAx=gca;
hAx.XDir='reverse';
that will put the larger values to the left instead of right.
Stephen23 on 23 Feb 2020
The data is error (y) vs grid size(x). On my figure, I did not see the log scale populate properly. But that's due to lack of data points as you explained. I was just curious of a better way.