Force certain data tips to show by default on figure?

11 visualizaciones (últimos 30 días)
David Alston
David Alston el 29 de Mzo. de 2021
Editada: Srijith Kasaragod el 20 de Sept. de 2021
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.

Respuestas (1)

Srijith Kasaragod
Srijith Kasaragod el 20 de Sept. de 2021
Editada: Srijith Kasaragod el 20 de Sept. de 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)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by