我如何添加2 Y轴到我的MATLAB绘图? [英] How do I add 2 Y axis to my MATLAB Plot?

查看:111
本文介绍了我如何添加2 Y轴到我的MATLAB绘图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题之前已经被问过 - 但是他们都没有处理2 Y轴的3D情节。我的问题是延续 - 我如何在MATLAB中添加一个2D曲线以及曲面或网格图?或者



我现在已经成功设法将2D图与曲面图一起添加。见下图 -
现在我的问题是2D情节的范围是如此之高以至于三维绘图缩小,看起来不过是天花板上的一架飞机。它应该有像上面列出的问题一样的变化。



如何为2D图形提供不同的Y轴,以便3D图是而不是缩小到这里。

解决方案

可能您可以使用DataAspectRatio属性来完成此操作。从上一篇文章的例子中获得灵感,如果我们有:

  z = peaks(100); 
x1 = linspace(0,100);
plot3(x1,0 * ones(1,numel(x1)),40 * sin(x1))
surface(z + 40,'edgecolor','none');

然后您可以使用

<$ p $ ($ 1.25 $ .7))
view([-37.5 18])

可以在某些情况下工作,以帮助重新获得曲面图上的一些范围。但是,这种方法在极端情况下不起作用。


I know this question has been asked before - but none of them deal with a 3D plot with 2 Y axis. My question is a continuation of - How do I add a 2D Plot along with a surface or mesh plot in MATLAB? or this.

I have now successfully managed to add a 2D plot along with a surface plot. See image below - Now my problem is that the range of the 2D plot is so high that the 3D plot is shrunk to look like nothing more than a plane on the ceiling. It is supposed to have variations like the figure in the question I have lined above.

How do I provide a different Y axis for the 2D plot so that the 3D plot is not shrunk like it is here.

解决方案

It's possible that you can use the DataAspectRatio property to accomplish this. Taking inspiration from the example from the previous post, if we have:

 z=peaks(100);
 x1=linspace(0,100);
 plot3(x1,0*ones(1,numel(x1)),40*sin(x1))
 surface(z+40, 'edgecolor', 'none');

and then you can use

set( gca, 'dataaspectratio', [1.25 1.25 .7] )
view( [-37.5 18] )

can work in some cases to help regain some of the range on the surface plot. This method won't work, however, in very extreme cases.

这篇关于我如何添加2 Y轴到我的MATLAB绘图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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