Create data tips at multiples points on a figure programatically
23 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Walter Roberson
on 27 May 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]);
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!