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.
现在,我正在使用默认的颜色映射,它自动将颜色映射的整个范围缩放到我的图形,即我的表面的最大值始终为红色(在'jet'颜色模式下),无论此最大值的大小如何。
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?
有关如何做到这一点的任何想法?
**Actually, in case it makes a difference, I'm plotting results of a surface fitting operation using the plot command as follows:*
**实际上,如果它有所不同,我正在使用plot命令绘制曲面拟合操作的结果,如下所示:*
[myfit, gof] = fit( ... );
plot(fit)
2 个解决方案
#1
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到5,另一个曲面的高度为0到10,则对两个曲线执行以下操作:
caxis([0 10]);
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:
caxis(hAxes, [0 10]); % Sets the color scaling for hAxes
If not specified, caxis
adjusts the color scaling of the axes that is current.
如果未指定,caxis会调整当前轴的颜色缩放比例。
#2
I recently answered this question in video form on my blog:
我最近在博客上以视频形式回答了这个问题:
http://blogs.mathworks.com/videos/2009/03/27/setting-the-colormap-to-be-consistent-across-axes/
#1
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到5,另一个曲面的高度为0到10,则对两个曲线执行以下操作:
caxis([0 10]);
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:
caxis(hAxes, [0 10]); % Sets the color scaling for hAxes
If not specified, caxis
adjusts the color scaling of the axes that is current.
如果未指定,caxis会调整当前轴的颜色缩放比例。
#2
I recently answered this question in video form on my blog:
我最近在博客上以视频形式回答了这个问题:
http://blogs.mathworks.com/videos/2009/03/27/setting-the-colormap-to-be-consistent-across-axes/