How to add more information to plot help-box?
5 views (last 30 days)
Show older comments
Sebastian
on 29 Oct 2023
Answered: Walter Roberson
on 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!
0 Comments
Accepted Answer
Walter Roberson
on 29 Oct 2023
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)
0 Comments
More Answers (0)
See Also
Categories
Find more on Annotations 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!