Updating xticklabels after zooming in using datetick in multiple subplots

4 views (last 30 days)
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 Comments
Cesar Daniel Castro
Cesar Daniel Castro on 2 Mar 2020
Thank you so much for your suggestion. I haven't tried it before but of course I will give a chance ;)
Adam
Adam on 2 Mar 2020
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.

Sign in to comment.

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!