2017-04-03 100 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