Adding a label to a data point on a graph that can be toggled to view by clicking on it

31 ビュー (過去 30 日間)
Hi all,
I am wondering if this is possible?
I am plotting using the plot function to make my graph and adding the labels to the points using the text function.
The problem with this is is that I am generating alot of data points and I can't read them individualy easily.
It would be ideal if there is a way to have it so that it plots the points as it's doing now then when I click on the point with the label I want to see this pops up.
Any help is appreciated.
Thanks,
Ollie

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 3 月 2 日
You could use the built in datatip functionality.
  5 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 3 月 4 日
I'll point you to this answer. This has the behavior I'd want. When I first create the plot, no data tips appear. However, when I turn on the data tip tool, it displays the info I want. This way I can use the build in data tip tool to control when and where the data tip is shown.
Some references that may help are
Oliver Horrobin
Oliver Horrobin 2021 年 3 月 5 日
Thanks Cris,
I ended up doing
dt.Visible = 'off';
with my datatip being called dt.
Works perfectly!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by