【问题标题】:How do I remove the theta grid and radius grid on a polar plot?如何删除极坐标图上的 theta 网格和半径网格?
【发布时间】:2020-05-18 13:41:05
【问题描述】:

我试图绘制阿基米德的螺旋线:

t = linspace(0,5*pi,1000);
a =1;
r = a.*t;
polar(t,r);
grid off;
Ax = gca; 
Ax.ThetaGrid = 'off';
Ax.RGrid = 'off';
Ax.RTickLabel = []; 
Ax.ThetaTickLabel = [];

但是,显示以下错误:

Unrecognized property 'ThetaGrid' for class 'matlab.graphics.axis.Axes'.

如何删除此图像上的网格和标签?

【问题讨论】:

    标签: matlab plot matlab-figure


    【解决方案1】:
    t = linspace(0,5*pi,1000);
    a =1;
    r = a.*t;
    line_handle = polarplot(t,r); % Get line handle
    Ax = line_handle.Parent; % Get its parent, i.e. polar axes
    grid off;
    Ax.ThetaGrid = 'off';
    Ax.RGrid = 'off';
    Ax.RTickLabel = [];
    Ax.ThetaTickLabel = [];
    

    生成

    问题是首先执行grid off 会以某种方式改变当前坐标轴,将它们设置回笛卡尔坐标轴。由于笛卡尔坐标轴对象没有定义极坐标,您会收到错误消息。
    相反,抓住线上的手柄,然后抓住它的Parent,您的极轴对象。它包含您想要更改的所有属性。

    PS,MATLAB 警告我使用 polarplot 而不是 polar,所以我这样做了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多