Data cursor Not working for underlying plots
Show older comments
Data cursor is working for only one plot. Not working for other 2 underlying plots. here is my code:-
fs=50;
time=1:0.1:fs;
x=cos(time);
y=sin(time);
z=x+y;
axesPosition = [250 50 1000 550]; %# Axes position, in pixels
yWidth = 100; %# y axes spacing, in pixels
xLimit = [min(time) max(time)]; %# Range of x values
xOffset = -yWidth*diff(xLimit)/axesPosition(3);
figure('Units','pixels','Position',[300 150 800 450]);
h(1) = axes('Units','pixels','Position',axesPosition,...
'YaxisLocation','right',...
'XaxisLocation','top',...
'Color','w','XColor','r','YColor','r',...
'XLim',xLimit,'NextPlot','add');
h(2) = axes('Units','pixels','Position',axesPosition+yWidth.*[0 0 0 0],...
'Color','none','XColor','k','YColor','m',...
'XLim',xLimit,...
'XTick',[],'XTickLabel',[],'NextPlot','add');
h(3) = axes('Units','pixels','Position',axesPosition+yWidth.*[-1 0 1 0],...
'Color','none','XColor','k','YColor','b',...
'XLim',xLimit+[xOffset 0],...
'NextPlot','add');
xlabel(h(1),'time in sec');
xlabel(h(2),'time in sec');
plot(h(1),time,x,'r');
plot(h(2),time,y,'m');
plot(h(3),time,z,'b');
Data cursor,Zoom and pan are working for only h(3) axis . . . how to fix it . . I need for all the axes
Answers (0)
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!