フィルターのクリア

Is there a documented/supported way to place figure data tips programmatically?

8 ビュー (過去 30 日間)
Matt J
Matt J 2022 年 5 月 3 日
コメント済み: Matt J 2023 年 9 月 21 日
I find it useful to be able to programmatically place data tips. I discovered the createDatatip function, which let's you do this (see example below), but it is undocumented, so I am uneasy about relying on it. Is there a documented/supported alternative?
h=plot(1:5);
dcm=datacursormode(ancestor(h,'figure'));
for i=1:numel(h.XData)
dTip = createDatatip(dcm,h);
dTip.Position=[h.XData(i), h.YData(i)];
end

採用された回答

Poorna
Poorna 2023 年 9 月 20 日
Hi Matt,
I understand that you are looking for functions to create datatips in MATLAB.
Starting from MATLAB R2019b, the “datatip” function was introduced, which allows you to create custom data tips in plots. This function provides a way to display additional information or annotations at specific data points on a plot.
To learn more about the “datatip” function and its usage, refer to the following documentation. https://www.mathworks.com/help/matlab/ref/matlab.graphics.datatip.datatip.html
Hope this Helps!
  1 件のコメント
Matt J
Matt J 2023 年 9 月 21 日
Thanks, @Poorna, but the newer datatip functionality seems much narrower than the previous one. Formerly, you could define an arbitrary callback function to populate the datatip display. Now, you can only supply numeric arrays.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by