Create data tips at multiples points on a figure programatically

23 次查看(过去 30 天)
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.

回答(1 个)

Walter Roberson
Walter Roberson 2017-5-27
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]);

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by