本文介绍了删除xticks,但在MATLAB中保留xticklabels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MATLAB中有一个图,我想从中删除xtick
,但保留xticklabel
.如果我只是这样删除xtick
:
I have a plot in MATLAB from which I would like to remove the xtick
s but keep the xticklabel
s. If I just remove the xtick
like so:
set(gca, 'XTick', []);
...然后标签也消失了.有没有一种方法可以保留标签,而不必使用文本框手动重新创建它们?我曾考虑过尝试将xtick
的长度设置为零,但是此答案表示xtick
属性不能独立控制.
...then the labels also disappear. Is there a way to keep the labels, without having to manually recreate them with text boxes? I thought about trying to make the length of the xtick
s zero, but this answer suggests that xtick
properties cannot be independently controlled.
推荐答案
尝试修改TickLength
属性:
set(gca, 'Ticklength', [0 0])
这篇关于删除xticks,但在MATLAB中保留xticklabels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!