2017-04-03 99 views
1

我在生產MATLAB這個數字是由次要情節的網格,每個都包含一個極座標圖。我想按行和列來標記這個網格。Matlab的:如何標記包含polarplot()次要情節情節?

列標籤很容易,使用title文本爲每個情節。

對於行標籤,與笛卡爾情節我簡單地濫用次要情節的第一列的y軸標籤,但極座標圖有(合理)不ylabel。 如何添加行標籤?

請注意,我正在使用MATLAB 2016a中引入的新功能polarplot(),因此大多數現有答案都指向polar()不適用。

+0

我想每次要情節排一個Y-標籤(即它是一個標籤,該行) – Flyto

回答

2

這是非常哈克,但如果你真的願意,你可以創建一個臨時軸的ylabels,在將它們複製到polarplots,然後擺脫臨時軸。

例子:

% Setup some polarplots 
m=2;n=3;  % Number of plots to make 
padding = 0.5; % Determines space between labels and plots 
atmp=axes; 
figure; 
for j=1:m 
    for k=1:n 
     subplot(m,n,sub2ind([n,m],k,j));  
     polarplot(0); 

     % Add labels 
     if j==1 % Top labels 
      htmp=xlabel(atmp, 'Top Label'); 
      htmp.Units='normalized'; 
      htmp.Position(2)= 1+padding; 
      copyobj(htmp,gca); 
     end 
     if k==1 % Left Labels 
      htmp=ylabel(atmp, 'Left Label'); 
      htmp.Units='normalized'; 
      htmp.Position(1)= -padding; 
      copyobj(htmp,gca); 
     end 
    end 
end 
close(atmp.Parent); % Close the temporary axes 

它創建:

image of subplots with labels

+0

正如你所說,這是hacky,但這是Matlab它可能是現在唯一的方法。非常感謝 :-) – Flyto