Creating Plot, Saving as .fig, maintaining Callbacks

2 views (last 30 days)
I am generating plots of many patches or rectangles over a set of axes, and I want a tooltip on them. I cannot use the underlying Java to set them using Undocumented features and apparently Matlab doesn't let me do this directly. The primary driver is that I could provide much more information about said rectangles if I could add a tooltip. However, I can't make this a full featured GUI. It needs to stay as a nominal figure with a single axes (i.e, no labels or other UI controls).
Since it doesn't appear that I can do this the obvious ways, I looked into window motion functions to get the cursor position. However, creating a new function for the callback means that the saved .fig generated from my plot will continue looking for this defined function and this fig should be able to be used without my code (i.e, all logic directly embedded in the .fig). I understand lambda and anonymous functions, but this is a rather complicated function where I need to get the current cursor position and then find which patch the cursor is over, then lookup some information to display as a text box. Is there a better approach to this problem?

Answers (0)

Community Treasure Hunt

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

Start Hunting!