Want to change the range of a single axis of a plotyy figure
3 次查看(过去 30 天)
显示 更早的评论
Hi
I want my x-axis to be tight to the data on a plotyy graph. I can't seem to do it without messing up the axes.
My data ranges from 1e-5 to 1e3 and it's a semilogx plotting function. Is there a way I can use axis([...]) to specify all three ranges (x, y1, y2) at once?
Thanks for any help Mike
0 个评论
采纳的回答
Walter Roberson
2012-12-11
There is no way to specify the limits all at once.
[ax h1 h2] = plotyy(x,y1,x,y2);
xlim(ax(1), ...);
xlim(ax(2), ...);
ylim(ax(1), ...);
ylim(ax(2), ...);
1 个评论
Bijay Guha
2018-4-26
but using this command disrupts the alignment of two plots in vertical axis (on ranges from -10 to 50 other 0 to 0.003). If I want the same alignment as it done automatically by plotyy, it would be great. So how to do that??
更多回答(1 个)
Muruganandham Subramanian
2012-12-11
编辑:Muruganandham Subramanian
2012-12-11
figure;
ylim([1e-5 1e3]);
or
goto Edit -> Axes Properties -> then select X axis and change range as your need
3 个评论
Muruganandham Subramanian
2012-12-11
编辑:Muruganandham Subramanian
2012-12-11
If you need to change x axis range is b/w 1e-5 to 1e3, you can use
xlim([1e-5 1e3])
or if it's not, can you explain precisely?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Two y-axis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!