删除xticks,但在MATLAB中保留xticklabels [英] Remove xticks but keep xticklabels in MATLAB

查看:122
本文介绍了删除xticks,但在MATLAB中保留xticklabels的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MATLAB中有一个图,我想从中删除xtick,但保留xticklabel.如果我只是这样删除xtick:

I have a plot in MATLAB from which I would like to remove the xticks but keep the xticklabels. 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 xticks zero, but this answer suggests that xtick properties cannot be independently controlled.

推荐答案

尝试修改TickLength属性:

set(gca, 'Ticklength', [0 0])

这篇关于删除xticks,但在MATLAB中保留xticklabels的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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