MATLAB Answers

How do I have multiple color maps two different data-sets portrayed on single axes?

1 view (last 30 days)
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


Sign in to comment.

Accepted Answer

Subhadeep Koley
Subhadeep Koley on 6 Sep 2019
The following code might help.
for k = 1:2
ax(k) = subplot(1,2,k);axis square;
% Subplot 1
% Pseudocolor plot
title('First Subplot');
% Subplot 2
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
sz = 25;
c = linspace(1,10,length(x));
% Scatter plot
title('Second Subplot');
Or to plot 2 different graphs on the same axis with different colormap you can refer here.


Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by