how to always display “labels” on axis X

前端 未结 2 935
长情又很酷
长情又很酷 2021-01-22 15:15

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.

2条回答
  •  余生分开走
    2021-01-22 15:50

    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). After zooming-in ML displays only three XTick labels on the x-axis even though there is sufficient space for 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 After rotating the X Tick labels MATLAB plots more labels as you zoom-in.

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

提交回复
热议问题