2

I have the following code that produces the following image.Polar Contour

How can I add polar gridlines? I would like to add 100, 200, 300, and 400. Note that the radius is 400. It might not look the best but I'd like to add them. Perhaps if this is possible, someone could suggest another colormap that might look better.

The function polarcont in FileExchange

close all

data1 = xlsread('C:\carbon.xlsx','Sheet4');
data2 = xlsread('C:\carbon.xlsx','Sheet2');
data3 = xlsread('C:\carbon.xlsx','Sheet3');

t = data1(1,:);
r = data2(:,1);
z = data3(:,:);

figure(1)
polarcont(r,t,z)
myColorMap = colormap;
myColorMap(1,:) = [1 1 1];
colormap(myColorMap);
colorbar;
beta = 0.9;
brighten(beta)
axis off
EBH
  • 10,350
  • 3
  • 34
  • 59
Jack
  • 307
  • 2
  • 13

1 Answers1

1

You can use polaraxes to add another axes to your figure and place the grid on them, like in the example below:

[X,Y,Z] = peaks;
[~,h] = contour(X,Y,Z,20);
axis off
axis equal % this is important for the polar axes to fit the catresian axes
           % when resizing the figure
colorbar;
% get the contour position after adding the colorbar:
cont_pos = h.Parent.Position;
% place a transparent polar axes on top of the contour:
polaraxes(gcf,'Position',cont_pos,'Color','none','Rlim',[0 400]);

polar contour

So you just need to add this at the end of your code:

axis equal
% get the contour position after adding the colorbar:
cont_pos = get(gca,'Position');
% place a transparent polar axes on top of the contour:
polaraxes(gcf,'Position',cont_pos,'Color','none','Rlim',[0 400]);

You can see here a list of the available colormaps, and choose what you like.

EBH
  • 10,350
  • 3
  • 34
  • 59