log-log plot explained
6 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
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.
1 Comment
More Answers (0)
See Also
Categories
Find more on Graphics Object Properties 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!