Search code examples
matlabpolar-coordinates

Colorizing polar plot by clusters


I have a polar plot (see below). I want to colorize the plot by cluster of points (about 0 deg, 60 deg, 90 deg 180 deg, 270 deg and 330 deg). I have tried to find some sort of function but could not. Is there a way in which this can be accomplished?

polar plot of mean of residuals vs azimuth angle

Edit: polar plot produced using command

polar(azi*pi/180,mean_res,'.');


Solution

  • You can use hold on with polar to plot in different colours:

    How to split your data into the four parts depends on your (not posted) data.

    % Example data (MathWorks)
    theta1 = 0:0.01:pi;
    theta2 = pi:0.01:2*pi;
    rho1 = sin(2*theta1).*cos(2*theta1);
    rho2 = sin(2*theta2).*cos(2*theta2);
    
    % Plot
    figure
    polar(theta1,rho1,'r*');
    hold on;
    polar(theta2,rho2,'b*');
    

    enter image description here