本文介绍了删除 xticks 但在 MATLAB 中保留 xticklabels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 MATLAB 中有一个图,我想从中删除 xtick
s 但保留 xticklabel
s.如果我像这样删除 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
的长度为零,但是 this answer 表明 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!