Problems doing subplot command while using mmpolar function
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Stanislav Stefanovski
le 6 Juin 2014
Commenté : Stanislav Stefanovski
le 6 Juin 2014
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')
0 commentaires
Réponse acceptée
Kelly Kearney
le 6 Juin 2014
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 ...
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!