Force certain data tips to show by default on figure?

11 views (last 30 days)
I have some code that adds points to an existing figure one point at a time with custom data tips for each point:
s = scatter(postXY(1), postXY(2), markerSize, markerColor, markerType, 'LineWidth', markerLWidth);
s.DataTipTemplate.DataTipRows(end+1).Label = strcat('POST-', currFldr.connectorNames{N});
s.DataTipTemplate.DataTipRows(end+1).Label = strcat('BranchID-', num2str(currFldr.connectorIDs{N, 7}));
This works great for putting interactive custom data tips at these locations. However, I would really like the default functionality to be the opposite of what it is now. Right now the data tips are hidden by default and only show up when you hover/left click to pin them. Is there a way to show all these data tips by default, then have left clicking hide the data tip you clicked on?
There are some other data tips on this figure that I would like to keep hidden by default, so a method that just shows all data tips in the figure would not work.

Answers (1)

Srijith Kasaragod
Srijith Kasaragod on 20 Sep 2021
Edited: Srijith Kasaragod on 20 Sep 2021
As per my understanding, you have a scatter plot and wish to have certain data tips visible in the plot by default. You could use 'datatip' function to implement the same. The following code shows an example:
x=0:10;
y=x;
s= scatter(x,y);
datatip(s,5,5); %function places a datatip at the point (5,5)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!