Effacer les filtres
Effacer les filtres

How to add more information to plot help-box?

2 vues (au cours des 30 derniers jours)
Sebastian
Sebastian le 29 Oct 2023
You know that little help-box which shows up when you mouse over a data point in a plot and tells you its coodinates? I noticed that with scatter plots the box also displays the size of the point, so I was wondering if there's a way to make it show other data. I have a plot with several lines, each with a corresponding number, and I want to be able to tell which line has which number. I'd rather not use colors and a legend since I'm already using color as a distinguishing feature. I also thought of giving each line a z-value corresponding to the number I care about, but that seems both annoying to implement and has the issue of forcing a single stacking order, when I need to be able to choose which line is on top. Hence my question about if it's possible to manipulate what shows up in the help-box.
Thanks in advance!

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Oct 2023
See datacursormode for the more general function.
In the particular case of what MATLAB refers to as "chart objects" (which it does not define to users), there is a completely different mechanism available which is introduced at https://www.mathworks.com/help/matlab/creating_plots/create-custom-data-tips.html "Examples of objects with a DataTipTemplate property include Line, Histogram, Surface, and FunctionLine objects."
(An example of something that does not have DataTipTemplate is a patch() object)

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by