matlab 多个 x 轴一个在另一个下面 [英] matlab multiple x axis one below another

查看:23
本文介绍了matlab 多个 x 轴一个在另一个下面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个带有多个 x 轴和一个 y 轴的 matlab 图.

I am trying to create a matlab plot with multiple x-axis one below another and just one y-axis.

我查看了 Mathworks 文件交换,并且只有多个 y 轴的建议/脚本.我想实现类似这个问题的R.

I have looked through the Mathworks file exchange and there are only suggestions/scripts for multiple y-axis. I would like to achieve something like this question for R.

推荐答案

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

Here is an example solution if you only need a second axis for showing a different scale (Jeff_K's solution but more worked out):

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 轴一个在另一个下面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆