Help shifting a movmedian plot along the x-axis
조회 수: 1 (최근 30일)
이전 댓글 표시
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);
set(gca,'XTick',tick_locations);
datetick('x','mmm yyyy','keeplimits', 'keepticks');
set(gca,'XTickLabelRotation',45)
set(gca,'XMinorTick','off','YMinorTick','on')
grid minor;
and the plot im trying to align it with is:
plot(movmedian(Don,7))
I tried calling q = to the above plot and managed to move the y axis up and down:
plot(movmedian(Don,7))
>> 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.
댓글 수: 0
답변 (1개)
Sai Sri Pathuri
2020년 5월 6일
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.
plot(x,movmedian(Don,7))
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!