Problems doing subplot command while using mmpolar function

12 ビュー (過去 30 日間)
Stanislav Stefanovski
Stanislav Stefanovski 2014 年 6 月 6 日
Hi,
I have a problem. I want to do a serie of subplots using mmpolar function. It seems that what I get is only one mmpolar plot in the center, even though I see the subplot divisions.
This is what I get :
What I want is 3 mmpolar plots in each of the axes shown in the background. Thank you for your help.
Here is the part of my code where I initialize my plots and stuff :
[Xeve,Yeve]=meshgrid((yDeb:res:yFin),(xDeb:res:xFin));
%On converti les axes en polaire [r,th]=meshgrid(linspace(0,100,200),linspace(0,2*pi,360)); xp=r.*cos(th); yp=r.*sin(th); zp1=interp2(Xeve,Yeve,PerrE1,xp,yp);
[thptB,rptB]=cart2pol(yB,xB); [thptA,rptA]=cart2pol(yA,xA); [thptC,rptC]=cart2pol(yC,xC);
%on plot en polaire
subplot(3,1,1)
ax1=axes('visible','off'); pcolor(xp,yp,zp1); shading flat; colorbar; axis equal ax2 = axes('position', get(ax1, 'position'));
%Traçons les coordonnees dans le plan polaire
hp=mmpolar(thptB,rptB,thptA,rptA,thptC,rptC,'Rlimit',[0,100],'backgroundcolor','none'); set(ax1, 'visible', 'off'); set(hp,'linestyle','none'); set(hp,'markersize',10); set(hp,{'color'},{'c';'y';'g'}) set(hp, {'markeredgecolor', 'marker'}, {'c' 'o'; 'y' '^';'g' 's'}); set(hp,{'markerfacecolor'},{'c';'y'; 'g'}) legend('Bob','Alice','Charlie') title('Distribution polaire')
subplot(3,1,2)
zp2=interp2(Xeve,Yeve,PerrE2,xp,yp);
ax1=axes('visible','off'); pcolor(xp,yp,zp2); shading flat; colorbar; axis equal ax2 = axes('position', get(ax1, 'position'));
hp=mmpolar(thptB,rptB,thptA,rptA,thptC,rptC,'Rlimit',[0,100],'backgroundcolor','none'); set(ax1, 'visible', 'off'); set(hp,'linestyle','none'); set(hp,'markersize',10); set(hp,{'color'},{'c';'y';'g'}) set(hp, {'markeredgecolor', 'marker'}, {'c' 'o'; 'y' '^';'g' 's'}); set(hp,{'markerfacecolor'},{'c';'y'; 'g'}) legend('Bob','Alice','Charlie') title('Distribution polaire')
subplot(3,1,3)
zp3=interp2(Xeve,Yeve,PerrE3,xp,yp);
ax1=axes('visible','off'); pcolor(xp,yp,zp3); shading flat; colorbar; axis equal ax2 = axes('position', get(ax1, 'position'));
hp=mmpolar(thptB,rptB,thptA,rptA,thptC,rptC,'Rlimit',[0,100],'backgroundcolor','none'); set(ax1, 'visible', 'off'); set(hp,'linestyle','none'); set(hp,'markersize',10); set(hp,{'color'},{'c';'y';'g'}) set(hp, {'markeredgecolor', 'marker'}, {'c' 'o'; 'y' '^';'g' 's'}); set(hp,{'markerfacecolor'},{'c';'y'; 'g'}) legend('Bob','Alice','Charlie') title('Distribution polaire')

採用された回答

Kelly Kearney
Kelly Kearney 2014 年 6 月 6 日
The axes command creates a new axis, and if you don't specify a position, it assumes the default position in the center of the figure. So each time you issue these commands:
subplot(3,1,1)
ax1=axes('visible','off'); pcolor(xp,yp,zp1); % etc ...
you create a subplot, then create a new (invisible) full-figure, centered axis. The centered axis, being the most recently created, is set as the current axis for all subsequent plotting commands.
What you want instead is:
ax1 = subplot(3,1,1)
set(ax1, 'visible','off'); pcolor(xp,yp,zp1); % etc ...
  1 件のコメント
Stanislav Stefanovski
Stanislav Stefanovski 2014 年 6 月 6 日
Thank you very much! It seems that coffee dosen't work this morning because when I read your answer, I remembered that you gave me the same method few weeks ago. Anyway, now it pops me what I want.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by