matlab 轴的两个颜色条

Two colorbars for a matlab axes

对于以下matlab代码:

figure;imshow( imread('cameraman.tif') ,[])
hold on;scatter(1:200,1:200,[],1:200);colorbar

我们可以看到,散点的颜色是灰色的,因为'cameraman.tif'的colorbar是灰色的。如果我想要散点图的颜色条是 jethsv 怎么办?从网络上查了一些资料,发现一个axes只有一个colorbar。

所以,我的问题是,如何将 scatter 的颜色栏设置为 jet 并保持 'cameraman.tif' 的颜色栏为灰色?

ZhQ

问题出现在您的 scatter. Take a look at here 中,以查看如何为 scatter 定义颜色。我将您的代码修改为:

figure;
imshow(imread('cameraman.tif'),[])
hold on
scatter(1:200,1:200,[],jet(200)) % this is what I changed
colorbar

现在看起来不错:

我已经找到了解决这个问题的另一种方法: enter link description here