仅删除轴线而不会影响刻度线和刻度线标签 [英] Remove only axis lines without affecting ticks and tick labels

查看:124
本文介绍了仅删除轴线而不会影响刻度线和刻度线标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以只删除Matlab图形中的轴线,而不会影响刻度线和刻度线标签.

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

我知道box可以切换上轴和右轴的线条和刻度,并且对我来说效果很好.
但是我的问题是我想消除底部和左侧线条(仅线条!),但保留刻度线和刻度线标签.

I know that box toggles the upper and right axes lines and ticks and that works perfectly for me.
But my problem is that I want eliminate the bottom and left lines (only lines!) but keeping the ticks and tick labels.

有什么花招吗?

推荐答案

另一种未公开的记录方式(适用于MATLAB R2014b和更高版本),通过将标尺的'LineStyle'更改为'none'来删除行.

There is another undocumented way (applicable to MATLAB R2014b and later versions) of removing the lines by changing the 'LineStyle' of rulers to 'none'.

示例:

figure;
plot(1:4,'o-');  %Plotting some data
pause(0.1);      %Just to make sure that the plot is made before the next step
hAxes = gca;     %Axis handle
%Changing 'LineStyle' to 'none'
hAxes.XRuler.Axle.LineStyle = 'none';  
hAxes.YRuler.Axle.LineStyle = 'none';
%Default 'LineStyle': 'solid', Other possibilities: 'dashed', 'dotted', 'dashdot'

这与 Dan的答案不同,后者使用了'visible'属性尺子.

This is different from Dan's answer which uses the 'visible' property of rulers.

这篇关于仅删除轴线而不会影响刻度线和刻度线标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆