MATLAB: Making a 2d polar plot with color

3d plotspolar

Hi I was able to create a contour polar plot using:
https://www.mathworks.com/matlabcentral/fileexchange/14826-polar-contour-plot
I have questions about my attachment picture:
How can I add gridlines?

Best Answer

I didn’t see your Question before.
I would run the grid-creating plot calls adding a ‘z’ value of zeros to work with your polar contour plot:
plot3(cc50(1,:), cc50(2,:), zeros(size(cc50(1,:))), 'k') % Plot Full Circumference

plot3(cc30(1,:), cc30(2,:), zeros(size(cc30(1,:))), 'k')
plot3(cc10(1,:), cc10(2,:), zeros(size(cc10(1,:))), 'k')
plot3(rdx, rdy, zeros(size(rdx)), 'k') % Plot Radials

I have tested this, and it works as I want it to. I have not tested it with your code. It should work. For a 3D plot, the grids have to be specified as 3D objects themselves, and setting the ‘z’ values to zero does that. If you want the grids to be at a ‘z’ value other than zero, add the same scalar value to the zeros call.
Example:
kz = 20;
figure(1)
plot3(cc50(1,:), cc50(2,:), zeros(size(cc50(1,:)))+kz, 'k') % Plot Full Circumference
hold on
plot3(cc30(1,:), cc30(2,:), zeros(size(cc30(1,:)))+kz, 'k')
plot3(cc10(1,:), cc10(2,:), zeros(size(cc10(1,:)))+kz, 'k')
plot3(rdx, rdy, zeros(size(rdx))+kz, 'k') % Plot Radials
hold off
axis equal
grid on
axis([-50 50 -50 50 0 25])
I am plotting this in the context of my previous code, using the calculations from it for the ‘cc’ and ‘rd’ variables.