matlab的多个x轴一个下方的另一(matlab multiple x axis one belo

2019-06-26 08:26发布

我试图创建具有多个x轴下方一个彼此,只是一个y轴的MATLAB情节。

我已经通过Mathworks公司的文件交换望去,有多个y轴只是建议/脚本。 我想实现像这个问题对R 。

Answer 1:

下面是一个例子的解决方案,如果你只需要一个第二轴线呈现出不同的规模(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


Answer 2:

如果你实际上并不需要绘制在副轴线的数据,只是用它们来显示比例(如链接到您的例子),你可以简单地通过添加第二个(或第三等)轴在做合适的位置,并设置高度非常小:

ax2 = axes('Position',[0.1 0.1 0.8 0.001],'Color','none')

然后设置适当的刻度标记。



Answer 3:

你需要使用一个补丁功能这一点。 在这里寻找更多详情: http://www.mathworks.com/matlabcentral/fileexchange/26550-myplotyy



文章来源: matlab multiple x axis one below another
标签: matlab axis