subplot log-scale set range

10 次查看(过去 30 天)
RuiQi
RuiQi 2017-8-10
编辑: John BG 2017-8-10
I have a plot that looks compressed because one or some of the plots are too far away.
I want to compress it so it look nicer. I use set(gca, 'YScale', 'log'); on all the subplot initialization but the result still look ugly.
How do I
1. Do a proper log plot ?
2. Smartly compress the axis range (first figure) so the plot take up the entire graph ?
  2 个评论
Akira Agata
Akira Agata 2017-8-10
What do you mean by 'proper log plot' ? Anyway, I think the solution for this would be to adjust YLim for each plot.
José-Luis
José-Luis 2017-8-10
编辑:José-Luis 2017-8-10
I don't get it. What are you trying to achieve? Your plots look fine to me.
There are limits to how much you can massage your data to make them look how you want.
If your plots are related, it might be misleading to have different transforms applied to all of them.

请先登录,再进行评论。

回答(2 个)

dpb
dpb 2017-8-10
You can still use non-decade values for ylim even on log axes, by default the logic for data that spans a couple of decades will be as you see to use even decade values. ylim([0.05 1]) or in that neighborhood might help on the left one but the linear axes look "better" to me than the log for all three, personally.
What would help more than either log or y-axes scaling on these in my opinion would be to expand the x-axes scale some -- start with xlim([0 700]) or xlim([100 700]) and adjust from there...

John BG
John BG 2017-8-10
编辑:John BG 2017-8-10
Hi RuiQi
compress the data on Y axis by increasing the Y span of axis handle
Let's say you have the following points, just test points randomly generated earlier on
x =[7 9 -8 9 3 -8 -5 1 10 10 -7 10]
y =[10 0 6 -8 -2 9 6 10 3 -10 7 9]
plot(x,y);grid on
2.
capture the axis handle
hx=gca
h1 =
Axes with properties:
XLim: [-8 10]
YLim: [-10 10]
XScale: 'linear'
YScale: 'linear'
GridLineStyle: '-'
Position: [0.1300 0.1100 0.7750 0.8150]
Units: 'normalized'
increase Y axis span
h1.YLim=[-30 10]
Increase the lower limit of the Y axis until all the curves are close enough for presentation.
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance
John BG

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by