(50分)matlab极坐标角度设定

用polar或rose的时候出图默认角度0,30,60,90……330等,如何自定义这些角度。谢谢大家
那怎么样才能把显示的度数换成字母。比如说不显示0度而显示N。

  这两个命令的角度是定死的,没有提供任何接口去修改。
  你一定要改,就只能改这两个命令的源代码了

  打开polar.m后可以找到下面这段语句
  % plot spokes
  th = (1:6)*2*pi/12;
  cst = cos(th); snt = sin(th);
  cs = [-cst; cst];
  sn = [-snt; snt];
  line(rmax*cs,rmax*sn,'linestyle',ls,'color',tc,'linewidth',1,...
  'handlevisibility','off','parent',cax)
  把th改成别的值就可以绘制不同的角度了,比如改成th = (1:4)*2*pi/8;就是45度的分割线了。

  当然下面还要继续改显示的度数
  % annotate spokes in degrees
  rt = 1.1*rmax;
  for i = 1:length(th)
  text(rt*cst(i),rt*snt(i),int2str(i*30),...
  'horizontalalignment','center',...
  'handlevisibility','off','parent',cax);
  if i == length(th)
  loc = int2str(0);
  else
  loc = int2str(180+i*30);
  end
  text(-rt*cst(i),-rt*snt(i),loc,'horizontalalignment','center',...
  'handlevisibility','off','parent',cax)
  end
  把两个30全部改为45即可。

  ——————————————————————————————
  反正就是在这两段里改就是了。

  % plot spokes
  th = (1:6)*2*pi/12;
  cst = cos(th); snt = sin(th);
  cs = [-cst; cst];
  sn = [-snt; snt];
  line(rmax*cs,rmax*sn,'linestyle',ls,'color',tc,'linewidth',1,...
  'handlevisibility','off','parent',cax)

  % annotate spokes in degrees
  rt = 1.1*rmax;
  for i = 1:length(th)
  text(rt*cst(i),rt*snt(i),[int2str(i),'N'],...
  'horizontalalignment','center',...
  'handlevisibility','off','parent',cax);
  if i == length(th)
  loc = [int2str(0),'N'];
  else
  %loc = int2str(180+i*30);
  loc=[int2str(i+6),'N'];
  end
  text(-rt*cst(i),-rt*snt(i),loc,'horizontalalignment','center',...
  'handlevisibility','off','parent',cax)
  end
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-01-18
也可以通过简单的属性操作实现,在figure->edit->figure properties选中后,出现属性编辑栏,然后选中圆坐标上的数字,即可手动编辑显示。
相似回答