Updating xticklabels after zooming in using datetick in multiple subplots

5 ビュー (過去 30 日間)
Cesar Daniel Castro
Cesar Daniel Castro 2020 年 2 月 27 日
コメント済み: Adam 2020 年 3 月 2 日
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:
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:
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)
Can anyone please help me with this? I will really appreciate it
  3 件のコメント
Adam
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 件)

カテゴリ

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by