如何始终显示“标签"在X轴上 [英] how to always display "labels" on axis X

查看:86
本文介绍了如何始终显示“标签"在X轴上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我缩放几个时间图,则X轴上的所有标签都会消失(消失),并且没有可见的X轴标签,因此无法了解图所在的部分.

如何强制matlab始终在X轴上显示标签并在缩放时自动更新标签并显示足够的数字,以便邻居"标签必须不同.

解决方案

即使在新版本的MATLAB(r2014)上,我也遇到了相同的问题.放大时,MATLAB没有显示足够的x轴刻度标签.经过几次实验,我发现以下解决方法.以下是实施解决方案之前的图表.即使有足够的空间可以容纳更多的空间,MATLAB在x轴上也仅显示三个XTick标签(当放大时,标签的数量通常更少).

怀疑MATLAB认为它没有足够的空间来显示更多标签,一种解决方法是旋转标签.为此,请在发出绘图命令后,例如

plot(tsX);
hold on;
plot(tsY);
plot(tsZ);

添加以下命令

set(gca,'XTickLabelRotation',90);

现在MATLAB图形带有更多标签

我将向MATLAB人员报告此错误.

If I zoom several time graph all labels from axis X disapear (go away) and there are no visible axis X labels so it is not possible to understand the part of graph where am I.

How can I force matlab to always display labels on axis X and to update them automatically while zooming and to display enough digits so "neighboor" labels must be different.

解决方案

I run into the same problem even on the new version of MATLAB (r2014). MATLAB does not display sufficient x-axis tick labels as you zoom-in. After several experiments I found the following workaround. Following is a plot before implementing the solution. MATLAB displays only three XTick labels on the x-axis even though there is sufficient space for more (there are often even less labels as you zoom in more).

Suspecting that MATLAB thinks that it does not have sufficient space to display more labels, a workaround can be to rotate the labels. To do that, after you issue the plot commands, e.g.

plot(tsX);
hold on;
plot(tsY);
plot(tsZ);

add the following command

set(gca,'XTickLabelRotation',90);

Now MATLAB plots with more labels

I am going to report this as a bug to the MATLAB guys.

这篇关于如何始终显示“标签"在X轴上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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