I have 2 axes on a GUI. How to show the cursor on both plots at the same X axis value?

Hello,
I have a GUI with two diferent axes with ploted data.
I can activate the cursor but only on one of them. I want to show the cursor on both axes and at the same X value.
Of course if I change the position of the cursor on one of axes, I want the cursor on the other plot to change to the same X position.
Many thanks!

 Accepted Answer

3 Comments

Thanks for your quick answer Sean.
I accept your answer but it only solves half of the problem. Anyway now I also can get the cursor position and plot the data tip over it.
But I have another problem: how to delete this cursor tip?
I know than plotting again it will be erased, but there is other way to do it without plotting? Because I also use the arrows to move the cursor data tip, but if I hold the key it hangs.
Thanks!
This hide all the data cursors:
a = findall(gcf, 'Type', 'hggroup');
set(a, 'Visible', 'off');
Now only left how to handle the axes to use the makedatatip without plotting.
This is how I'm doing it now, but when the plotting function finishes, I can't use again the handles.hPlot without plotting:
hPlot = plot(data);
makedatatip(hPlot, [1 3]);
Any idea?
Use the datatip's delete method:
hDatatip = makedatatip(hobj,pos);
To remove it:
delete(hDatatip)

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!