On-figure magnifier
Editor's Note: This file was selected as MATLAB Central Pick of the Week
This utility provides a powerful zooming tool specially designed for the documentation of original and zoomed 2D graphics of images on the same plot.
It is composed of two blocks (the secondary axes and the magnifier). The secondary axes, which can be arbitrarily allocated within the limits of the figure, displays the area marked by the magnifier.
The highly versatile interface of the 'on-figure magnifier' offers a world of possibilities in a broad range of applications and fields. The Keyboard/mouse or programmatic configuration of this tool allows the user to set her or his own graphic style, to suit the requirements of any publication's editor. More details on interfacing and properties can be found in the .m file.
EXAMPLE: (for usage examples, run 'magnifyOnFigure_examples.m')
PROPERTIES:
'secondaryAxesFaceColor': ColorSpec
'edgeWidth' Color of the box surrounding the secondary
axes, magnifier and link. Default 1
'edgeColor': Color of the box surrounding the secondary
axes, magnifier and link. Default 'black'
'displayLinkStyle': Style of the link. 'none', 'straight' or
'edges', with 'straight' as default.
'mode': 'manual' or 'interactive' (allowing
adjustments through mouse/keyboard). Default
'interactive'.
'units' Units in which the position vectors are
given. Only 'pixels' currently supported
'initialPositionSecondaryAxes': Initial position vector ([left bottom width height])
of secondary axes, in pixels
'initialPositionMagnifier': Initial position vector ([left bottom width height])
of magnifier, in pixels
'secondaryAxesXLim': Initial XLim value of the secondary axes
'secondaryAxesYLim': Initial YLim value of the secondary axes
HOT KEYS (active if 'mode' set to 'interactive')
-In a figure with multiple magnigier instances
'Tab': Switch the focus from one magnifier instance
to the next one on the current figure.
'Mouse pointer on secondary axes or magnifier of a tool+double left click'
Regain focus
-On the focused magnifier instance
'up arrow': Moves magnifier 1 pixel upwards
'down arrow': Moves magnifier 1 pixel downwards
'left arrow': Moves magnifier 1 pixel to the left
'right arrow': Moves magnifier 1 pixel to the right
'Shift+up arrow': Expands magnifier 10% on the Y-axis
'Shift+down arrow': Compress magnifier 10% on the -axis
'Shift+left arrow': Compress magnifier 10% on the X-axis
'Shift+right arrow': Expands magnifier 10% on the X-axis
'Control+up arrow': Moves secondary axes 1 pixel upwards
'Control+down arrow': Moves secondary axes 1 pixel downwards
'Control+left arrow': Moves secondary axes 1 pixel to the left
'Control+right arrow': Moves secondary axes 1 pixel to the right
'Alt+up arrow': Expands secondary axes 10% on the Y-axis
'Alt+down arrow': Compress secondary axes 10% on the Y-axis
'Alt+left arrow': Compress secondary axes 10% on the X-axis
'Alt+right arrow': Expands secondary axes 10% on the X-axis
'PageUp': Increase additional zooming factor on X-axis
'PageDown': Decrease additional zooming factor on X-axis
'Shift+PageUp': Increase additional zooming factor on Y-axis
'Shift+PageDown': Decrease additional zooming factor on Y-axis
'Control+Q': Resets the additional zooming factors to 0
'Control+A': Displays position of secondary axes and
magnifier in the command window
'Control+D': Deletes the focused tool
'Mouse pointer on magnifier+left click' Drag magnifier to any
direction
'Mouse pointer on secondary axes+left click' Drag secondary axes in any
direction
Cite As
David Fernandez-Prim (2024). On-figure magnifier (https://www.mathworks.com/matlabcentral/fileexchange/26007-on-figure-magnifier), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: ZoomBox, magnify, magnifyrecttofig, Jeweler's Loupe
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.11.0.0 | Tool identification feature added. Now, 'Control+I' shows/hides the tool identifier (red background color when the tool has the focus, black otherwise) |
||
1.10.0.0 | Improved help documentation |
||
1.9.0.0 | Solved bug when resizing the host figure |
||
1.7.0.0 | Added 'delete' functionality.
|
||
1.6.0.0 | Solved bug when the contents of the target axes are other than 'line' or 'image' |
||
1.5.0.0 | Solved bug when axis mode is set to other than 'normal'.
|
||
1.4.0.0 | Cosmetic changes |
||
1.3.0.0 | Solved bug appearing when any of the axes are reversed. It also works on images now. |
||
1.2.0.0 | Added possibility to select target axes in a multiaxes figure |
||
1.1.0.0 | Solved bug when 'displayLinkStyle' is set to 'edges' |
||
1.0.0.0 |