如何在MATLAB中以相同的色标绘制不同的表面? [英] How do you draw different surfaces with the same color scale in MATLAB?

查看:188
本文介绍了如何在MATLAB中以相同的色标绘制不同的表面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试代表比例不同的几个表面图*.每个表面图都绘制在单独的子图中和/或图中.

I'm trying to represent several surface plots* for which the scale differs a bit. Each surface plot is drawn in a separate subplot and/or figure.

现在,我正在使用默认的颜色映射,它会自动将颜色映射的整个范围缩放到我的图形,即无论大小如何,我的曲面的最大值始终为红色(在喷射"颜色模式下)这个最大值.

Right now, I'm using the default color mapping, which automatically scales the whole range of the color map to my figure, i.e. the maximum of my surface is always red (in 'jet' color mode) regardless of the magnitude of this maximum.

我希望颜色图在图形之间保持一致,而不是在每个单独的图形的最小值和最大值之间分布.这样,读者仅通过查看颜色图即可体会到表面比例的差异.

I'd like the colormap to be consistent between the figures instead of spread between the min and max of each individual graph. That way, readers could appreciate the difference in scale of the surfaces just by looking at the color map.

关于如何执行此操作的任何想法?

Any idea on how to do this?

**实际上,如果有所不同,我将使用plot命令绘制曲面拟合操作的结果,如下所示:*

**Actually, in case it makes a difference, I'm plotting results of a surface fitting operation using the plot command as follows:*

   [myfit, gof] = fit( ... );
   plot(fit)

推荐答案

您应使用

You should use the caxis function. For example, if one surface has a height from 0 to 5 and the other has a height from 0 to 10, doing the following for both plots:

caxis([0 10]);

将强制它们使用与覆盖更大范围的图相同的色标.您还可以使用轴手柄作为第一个参数来调用caxis:

will force them both to use the same color scale as the plot that covers the larger range. You can also call caxis with an axes handle as the first argument:

caxis(hAxes, [0 10]);  % Sets the color scaling for hAxes

如果未指定,caxis会调整当前轴的颜色比例.

If not specified, caxis adjusts the color scaling of the axes that is current.

这篇关于如何在MATLAB中以相同的色标绘制不同的表面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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