Help shifting a movmedian plot along the x-axis

2 views (last 30 days)
Jack Radcliffe
Jack Radcliffe on 3 May 2020
Answered: Sai Sri Pathuri on 6 May 2020
Hi, I am having an issue in moving a movmedian plot to align with a line graph, which are very far apart on the x-axis. I have tried a few methods and have been able to move the y axis, but not the x yet for the movmedian. Here is my code:
t = 1:4656;
x = datenum(2006, 01, 01) + t;
str = datestr(x, 'mmm yyyy');
plot(x, Don)
hold on
tick_locations = datenum(2006,01:6:153,1);
datetick('x','mmm yyyy','keeplimits', 'keepticks');
grid minor;
and the plot im trying to align it with is:
I tried calling q = to the above plot and managed to move the y axis up and down:
>> hold on
>> plot(t+5,q)
although im unsure how to change this to apply to the x-axis. I've also tried applying the tick_locations for the movmedian plot from my initial plot but this doesnt work.
Any help is greatly appreciated.

Answers (1)

Sai Sri Pathuri
Sai Sri Pathuri on 6 May 2020
The difference in the x locations might be because you are not plotting movmedian(Don,7) against x. You may try the following to overlap both the plots.




Community Treasure Hunt

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

Start Hunting!