Shifting a plot in the horizontal direction

Hello,
I would like to shift my plot horizontaly but here my problems :
First my code :
if true
% %plot of 3 different channels (in the same figure)
figure(3)
%subplot(121)
plot(ERP.bindata(7,:,1),'k');
hold on;
plot(ERP.bindata(10,:,1),'r');
hold on;
plot(ERP.bindata(17,:,1),'b');
title('Fz Cz Pz channel waveforms')
set(gca,'YDir','Reverse') %reversing the Y axis in order to have the negatives values above and the positives values below
axis ([-200,800,-12,12]) %setting of plot's boundary
xlabel('time (ms)')
ylabel('voltage (µV)')
end
I've glanced this subject below, but it didn't help because it gives tipes for plot(x,y) and my isn't configured like this. shift a plot in the vertical direction?
I've tried this :
if true
% plot(ERP.bindata(7,:,1) -200,'k');
plot(-200,ERP.bindata(7,:,1),'k');
end
But when I do this, my I have no plot on the appearing figure. I think it's because the data I've extracted are only ordinate like data but I have approximatively 1000 points for the abscissa.

 채택된 답변

Jos (10584)
Jos (10584) 2016년 2월 8일

1 개 추천

The command plot(Y) plots the values of Y against their indices as x values. In general, however, it is a good idea to specify the x values directly. In doing so, you are much more in control. As an example:
Y = cumsum(rand(10,2)) % arbitrary data
x = 1:size(Y,1) ; % specify x values
plot(x, Y(:,1), 'bo-') ; hold on
plot(x+2, Y(:,2), 'rs-') ; hold off
xlim([0 15]) % set plot limits

댓글 수: 1

Omer Yenil
Omer Yenil 2016년 2월 8일
After writting your codes, I had another issue about matrix (I didn't define my X size very well) but now it's okay, I have my curve begining at -200 instead of 0 like I wanted.
Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2016년 2월 8일

댓글:

2016년 2월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by