visually time shift individual data trace within a group
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi All,
I have a query regarding time shifting of data. If, for example, I have three time traces within a single matlab plot, I can shift them individually using:
hold on; plot(x(1:end-20),y(21:end,1),'b'); plot(x(:),y(:,2),'g'); plot(x(1:end-25),y(26:end,3),'r');
Is there a faster method of visual inspection/comparison using the 'pan' button in the 'figure properties' options to move ONLY ONE trace and not all three??
I essentially want to get the best correlation you could say between the three traces by visual inspection
Thanks
댓글 수: 0
답변 (2개)
Walter Roberson
2011년 4월 6일
pan applies to everything in the selected axes. You could put your traces in to separate axes and pan the one you want, but it might perhaps be tricky to select the axes to pan unless you put in some kind of button to activate a particular one.
댓글 수: 0
Pascal Galloway
2011년 4월 15일
댓글 수: 2
Walter Roberson
2011년 4월 15일
The button code would be fairly simple:
You would first create the axis handles ahead of time. Don't worry about their positions or properties to start with:
axishandles = [axes;axes;axes]; %three new axes
uicontrol('Style','radio','Position',LOCATIONS(1,:),'Callback',{@axonoff, axishandles(1)});
uicontrol('Style','radio','Position',LOCATIONS(2,:),'Callback',{@axonoff, axishandles(2)});
uicontrol('Style','radio','Position',LOCATIONS(3,:),'Callback',{@axonoff, axishandles(3)});
function axonoff(src, event, axhandle)
onoff = {'off','on'};
if ishandle(axhandle)
newstate = onoff{1 + get(src,'Value')};
set(axhandle, 'Hittest', newstate);
end
Then in your main program when you decide where the trace K should go on the figure, set() the Position property of axishandles(K), and when you plot() that trace, specify axishandles(K) as the parent axis for the relevant plot commands, such as
plot(axishandles(K),x,y)
참고 항목
카테고리
Help Center 및 File Exchange에서 Labels and Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!