MATLAB: Which plot do I need

pcolorplotting

Hello,
I'm trying to plot in 2D some points and I want to color them depending on a logic (1 or 0) classification.
I'll explain myself better. I have a matrix with different xy-coordinates and a logic values assigned to each coordinate that tells me if the point is suitable as an initial points for the deployment of a satellite. I've tried using scatter but I just get colored points and I'm looking for a "painted map" so I can easily see groups of good points and groups of bad points.
EDIT: I want to see a colored, continuum surface indicating "good" zones and "bad" zones depending of if there are many suitable points or not. Something like this image.
Thank you guys.

Best Answer

If you already know the ‘good’ and ‘bad’ points, and they are defined by logical indexing, use the logical index values to separate them into the appropriate vectors, use the hold function, and plot them:
x = 1:100;
y = randi(99, 1, 100);
select = y > 75; % logical Selection Vector
good_pts = y(select);
bad_pts = y(~select);
figure(1)
scatter(x(select), good_pts, 'bp')
hold on
scatter(x(~select), bad_pts, 'rp')
hold off
grid
legend('Good Points', 'Bad Points')
Related Question