Updating xticklabels after zooming in using datetick in multiple subplots
조회 수: 2 (최근 30일)
이전 댓글 표시
Dear community, I am asking for your help. I am making a GUI, with a panel with 3 tabs and in the second tab I am ploting 5 subplots in a column, in order to display 5 signals. In the x axis I have the time vector and displayed as a date/time using datetick function. Beforehand I need to mention that the x axes of subplots are linked between them so if I zoom in into one image, I will have the same new xlimits. Speaking with images:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274103/image.png)
It is known that the function datetick does not "regenerate" the ticks after zooming in. By default (at least in my computers) 7 ticks are displayed. So if I want to zoom in e.g. the first 1/4 of the signal I get this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274104/image.png)
In 2013 was published a solution of this https://www.mathworks.com/matlabcentral/answers/95034-why-does-datetick-not-regenerate-tick-marks-on-the-axes-when-using-the-zoom-function-in-matlab. So I followed their steps and my problem was partially solved, because after zooming in one subplot, I have again 7 new ticklabels. The problem is that I just have the update of the xticklabels in the subplot where I am zooming in and after searching and trying for the whole day I can't find the solution to make the changes in all the subplots at the same time. An example is shown in the next picture, zooming on the subplot(5,1,2)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274105/image.png)
Can anyone please help me with this? I will really appreciate it
댓글 수: 3
Adam
2020년 3월 2일
I assume you are using linkaxes?
doc linkprop
will give you access to a whole load more properties to link, including XTick, XTickLabel, etc so this should work as a general idea, though if stackedplot solves the problem here then that is obviously neater. But linkprop is still useful to know about.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!