![]() Note that it is ok to move the annotation outside the figure bounds later on (via panning/zooming) – it is only the initial annotation creation that must be within the figure bounds (i.e., between 0.0-1.0 in normalized X and Y units): Otherwise, the annotation function will shout. The first step is to ensure that the initial annotation position is within the figure bounds. The solution Positioning the annotation in axes data units So I’ll spare you the gruesome details and skip right to the chase. This in turn enabled me to take the essence of the pinning code and implement it in my stand-alone application code.īelieve me when I say that the scribe code is complex (anyone say convoluted?). This showed me the code path (beneath %matlabroot%/toolbox/matlab/scribe/), and placing breakpoints in key code lines enabled me to debug the process step-by-step. A context-menu is only assigned to the annotation after the Edit Plot toolbar button and then the annotation object are clicked.īeing too lazy in nature to debug this all the way through, I opted for an easier route: I started the Profiler just prior to clicking the context-menu’s “Pin to Axes”, and stopped it immediately afterwards. Unfortunately, this does not work well, because the context-menu is empty when the annotation is first created. We could then use the hgfeval function to execute this callback programmatically. The obvious first place to start debugging this issue is to go to the annotation handle’s context-menu (accessible via the UIContextMenu property), drill down to the “Pin” menu item and take a look at its callback. But still, it would be nice if we could specify the annotation in graph (plot axes) data units, and have it pinned automatically without requiring manual user interaction. Oh well, it’s better than nothing, I guess. But whereas the Java glass-pane is a true transparent layer, on top of all other window components ( examples), Matlab’s implementation only works for axes. Matlab’s implementation of annotation is an attempt to replicate Java’s standard glass-pane mechanism. Since plot axes are always obscured by uicontrols, so too is the annotation layer. For this reason, annotation requires figure position – in fact, the annotation has no information about the axes beneath it. In fact, they are located in a separate axes layer. The annotations may appear to be connected to the plot axes, but this is merely a visual illusion. This is based on a transparent hidden axes that spans the entire figure’s content area, on which the annotations are being drawn (also called the scribe layer).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |