MATLAB: Circle plan using plot and pcolor

pcolorplotpolarsuperposition

Hi to all
I am trying to do something special.
I want to superpose a polar with a plot and a pcolor plan but what I want to do is to display it in a big circle (no square at all). It's probably really simple but I can't find a way how.
Because of confidentiality I can't send the entire code but I will show you my "graphic code" so you can all see what I am trying to do.
Here is the code :
h=polar([0 2*pi], [0 50]); delete(h) hold on g=plot(yB,xB,yA,xA,yC,xC,'LineStyle','none') %axis([-50 50 -50 50]) legend('Bob','Alice','Charlie') title('Distribution polaire') xlabel('Distance (m)') ylabel('Distance (m)') hold on [Xeve,Yeve]=meshgrid((yDeb:res:yFin),(xDeb:res:xFin)); pcolor(Xeve,Yeve,(PerrE)); shading interp colorbar axis equal square set(g, 'markersize', 10); set(g,{'color'},{'c';'y';'g'}) set(g, {'markeredgecolor', 'marker'}, {'c' 'o'; 'y' '^'; 'g' 's'}); set(g,{'markerfacecolor'},{'c';'y';'g'}) uistack(g, 'top'); hold off
And here is a picture of the result:
So what I want is essentially no square at all and fit all my "pcolor" inside the circle drawn by polar.
Thank you !!!

Best Answer

My first thought would be to layer two axes on top of each other: one for the polar plot and any line objects that can be plotted on it, and one for the pcolor plot, since the latter isn't supported by any polar plot functions that I know of (though you may want to browse the File Exchange).
Creating the circular pcolor plot is simply a matter of interpolating your data onto a grid that's defined in terms of r/theta rather than x/y.
Also, out of habit I always use mmpolar from the File Exchange instead of polar, because it's much more flexible.
An example:
[x,y] = meshgrid(linspace(-50,50,200));
z = peaks(200);
[r,th] = meshgrid(linspace(0,50,100), linspace(0, 2*pi, 360));
xp = r.*cos(th);
yp = r.*sin(th);
zp = interp2(x,y,z,xp,yp);
ax1 = axes('visible', 'off');
pcolor(xp,yp,zp);
shading flat;
axis equal;
ax2 = axes('position', get(ax1, 'position'));
hp = mmpolar(NaN, NaN, 'RLimit', [0 50], 'backgroundcolor', 'none');
set(ax1, 'visible', 'off');