如何将 pcolor 图与使用不同颜色图的等高线图重叠?
未实现此目的的最小示例:
[X,Y,Z] = peaks;
figure;
pcolor(X,Y,Z);
shading flat;
hold all;
axes;
contour(X,Y,Z);
colormap gray; % this should only apply to the contour plot axes...
axis off; % ... but it doesn't
这显示了灰度颜色图中的等高线图和伪彩色图。然而,我想要实现的只是将轮廓变成灰色。
这只是一个简单的示例,实际上等高线图是具有不同范围的不同数据,因此还需要两个独立的 caxis 设置。
Minimum example that does not achieve it:
[X,Y,Z] = peaks;
figure;
pcolor(X,Y,Z);
shading flat;
hold all;
axes;
contour(X,Y,Z);
colormap gray; % this should only apply to the contour plot axes...
axis off; % ... but it doesn't
This shows both the contour plot and the pseudo colour plot in the grayscale colourmap. However, what I want to achieve is only turning the contours gray.
This is just a minimalistic example, in reality the contour plot is of different data that has a different range, so two independent caxis
settings are required as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过连接两个颜色图来解决该问题,并确保函数的值能够访问颜色图的正确部分:
要获得更方便的解决方案,您可能还需要查看 本周文件交换精选
You can fix the problem by catenating two colormaps, and making sure that the values of the functions are such that they access the right part of the colormap:
For a more convenient solution, you may also want to have a look at this file exchange pick of the week