I'm trying to change labels on x axis to be from 24/2/2020 to today (actually, at least 1 day after today, otherwise the curve will touch the y axis on the right). I have to use subplot since I have other plots, and I have to use OuterPosition (or similar?) since the figure contains also annotations.
The following code
subplot(3,2,1)past = datenum('02-24-2020');present = datenum(datetime('today')+1); % +1 so that curve won't touch y axis on rightplot(linspace(past,present,65), 1:65)set(gca, 'OuterPosition',[.1 .1 .4 .3], 'XLim',[past present])datetick('x','dd/mm','keepticks')
produces this
which is not correct, since it cuts data on both on left and on right. The result doesn't change by removing the subplot command.
Even if I remove the OuterPosition option from set, the result doesn't change.
If i remove both subplot and OuterPosition, the result improves a bit, but it is still wrong
How to properly set the x labels?
This is my matlab version
Best Answer