Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Displays images and overlays such as ROIs, annotations, and masks using imageshow and viewer2d in MATLAB.
18% 95%+77 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 4 of 22 without it.
Write a MATLAB snippet to set up a 2D image display and programmatically zoom into the rectangular subregion with origin (250, 100) and dimensions 150x120 pixels.
Sets the visible subregion via CameraViewport on the viewer object.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Display images with imageshow rather than imshow for more performant, higher quality image display with more responsive interactions for images of all sizes.
imshow, but recommend imageshow for better performance)uiimage)Note: Do NOT use bigimageshow. It is a legacy function. Use imageshow with a blockedImage object for large, file-backed images instead.
| Do NOT use | Use instead | Why |
|---|---|---|
imshow | imageshow | Better performance, higher quality, responsive interactions |
uiaxes + imshow in apps | viewer2d + imageshow | Viewer handles zoom, pan, and interactions natively |
rectangle(), drawrectangle(), imrect(), or insertObjectAnnotation | uidraw with Position | Interactive, programmatic placement, built-in measurements |
montage | imtile + imageshow | Composable, works with viewer |
figure + getframe(fig) | viewer2d + getframe(viewer) | Viewer waits for rendering to complete before capture |
| Manual image blending for overlays | imageshow with OverlayData | Built-in transparency, colormap, and display range control |
Manual for loop calling uidraw per annotation | uidraw with Wait="multiple" | Single session, user controls when done |
| Manual alpha blending with pixel math | OverlayAlphamap property | Built-in per-pixel transparency mapping |
linkaxes or manual callback synchronization | linkviewers | Purpose-built for viewer2d, handles all camera properties |
roipoly, manual mask painting | uipaint | Interactive brush-based painting with overlay feedback |
bigimageshow | imageshow with blockedImage | imageshow handles blocked images directly, bigimageshow is legacy |
title("text") or title(gca,"text") | title(viewer,"text") | gca does not return the viewer; pass the viewer object directly |
xlim/ylim to zoom into a region | viewer.CameraViewport = [x y w h] | Viewer is not an axes; xlim/ylim error on viewer2d |
tiledlayout/nexttile/subplot with imageshow | Multiple viewer2d in a uigridlayout, or imtile + single imageshow | imageshow creates a viewer2d, not an axes — it ignores tile parents, producing empty tiles and a separate viewer window |
for loop calling uiannotate per annotation | Single uiannotate call with n×m position matrix | One instanced object — orders of magnitude faster than per-annotation calls |
imagesc(data) | imageshow(data) | imageshow handles scaling and colormapping automatically via DisplayRangeMode |
imshowpair(A, B) | imfuse(A, B) + imageshow | imshowpair creates its own axes; use imfuse to composite then display with imageshow |
Next to this one in the catalogue, plus more from the same author.