![subplot_colormap.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237195/subplot_colormap.png)
How do I have multiple color maps two different data-sets portrayed on single axes?
2 ビュー (過去 30 日間)
古いコメントを表示
I have two types of datasets and I want to plot them on a subplot
One is of continuous form for which I use pcolor
The other is point data for which I use scatterplot
I am plotting the scatter point data over the continuous one on a single axes using subplot. How can I have separate colormap for each data?
Right now, what I'm getting is that the colormap for the scatter data is automatically assinged to the continous data as well like below
![Test13123.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/236774/Test13123.jpeg)
0 件のコメント
採用された回答
Subhadeep Koley
2019 年 9 月 6 日
The following code might help.
for k = 1:2
ax(k) = subplot(1,2,k);axis square;
end
% Subplot 1
subplot(ax(1));
% Pseudocolor plot
pcolor(ax(1),rand(50));colormap(ax(1),winter);colorbar;
title('First Subplot');
% Subplot 2
subplot(ax(2));
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
sz = 25;
c = linspace(1,10,length(x));
% Scatter plot
scatter(x,y,sz,c,'filled');colormap(ax(2),jet);colorbar;
title('Second Subplot');
![subplot_colormap.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237195/subplot_colormap.png)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!