gpt4 book ai didi

matlab多个x轴一个在另一个下面

转载 作者:太空宇宙 更新时间:2023-11-03 19:24:42 25 4
gpt4 key购买 nike

我正在尝试创建一个具有多个 x Axis 的 matlab 图,一个在另一个下方,只有一个 y Axis 。

我查看了 Mathworks 文件交换,只有多个 y Axis 的建议/脚本。我想实现类似 this question for R 的目标.

最佳答案

这是一个示例解决方案,如果您只需要第二个轴来显示不同的比例(Jeff_K 的解决方案,但更有效):

first_axis = gca;
sqz = 0.12; %// distance to squeeze the first plot
set(first_axis, 'Position', get(first_axis, 'Position') + [0 sqz 0 -sqz ]);
ax2 = axes('Position', get(first_axis, 'Position') .* [1 1 1 0.001] - [0 sqz 0 0],'Color','none');
scale_factor = 42; %// change this to your satisfaction
xlim(get(first_axis, 'XLim') * scale_factor);
set(ax2, 'XScale', get(first_axis, 'XScale')); %// make logarithmic if first axis is too

关于matlab多个x轴一个在另一个下面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11531762/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com