Remove only axis lines without affecting ticks and tick labels

前端 未结 4 953
渐次进展
渐次进展 2020-12-09 00:07

Is there a way to remove only the axis lines in the Matlab figure, without affecting ticks and tick labels.

I know that box toggles the upper and righ

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 00:51

    Yair Altman's Undocumented Matlab demonstrates a cleaner way to do this using the undocumented axes rulers:

    plot(x,y);
    ax1 = gca;
    yruler = ax1.YRuler;
    yruler.Axle.Visible = 'off';
    xruler = ax1.XRuler;
    xruler.Axle.Visible = 'off'; %// note you can do different formatting too such as xruler.Axle.LineWidth = 1.5;
    

    A nice feature of this approach is that you can separately format the x and y axis lines.

提交回复
热议问题