Create data tips at multiples points on a figure programatically

23 visualizaciones (últimos 30 días)
aneps
aneps el 27 de Mayo de 2017
Respondida: Walter Roberson el 27 de Mayo de 2017
I have a matrix "MyData" with size 592 by 1. After plotting I want to place datatips at 2 points. How can I create datatips programatically?
My code is
figure (1)
plot(MyData)
X_r1 = ((l +0.15)*8)/0.05 % X_r1 and X_r2 are calculated from 'l' which I input while running the code
X_r2 = (((l +0.15)*8)/0.05) + ((2*l+0.15)/0.05)
I want to crate datatips at X_r1 and X_r2! How can I create? Thank you.

Respuestas (1)

Walter Roberson
Walter Roberson el 27 de Mayo de 2017
h = plot(MyData);
X_r1 = ((l +0.15)*8)/0.05 % X_r1 and X_r2 are calculated from 'l' which I input while running the code
X_r2 = (((l +0.15)*8)/0.05) + ((2*l+0.15)/0.05);
dcm_obj = datacursormode();
createDatatip(dcm_obj, h, [l, X_r1]);
createDatatip(dcm_obj, h, [l, X_r2]);

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by