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

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

问题描述

我正在尝试创建一个Matlab图,其中多个x轴一个在另一个下方,而一个y轴.

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天全站免登陆