Main Content

Add Scroll Panel to Figure

The primary navigation tool of a figure is a scroll panel. When you display an image in a scroll panel, the tool displays only a portion of the image, if it is too big to fit into the figure window. When only a portion of the image is visible, the scroll panel adds horizontal and vertical scroll bars, to enable viewing of the parts of the image that are not currently visible.

Figure window with scroll panels on the right and bottom sides to facilitate scrolling.

When you display an image in a scroll panel, it changes the object hierarchy of your displayed image. This diagram illustrates the typical object hierarchy for an image displayed in an axes object in a figure object.

Object Hierarchy of Image Displayed in a Figure

A figure is the parent of an axes, which is the parent of an image.

When you call the imscrollpanel function to put the target image in a scrollable window, this object hierarchy changes. imscrollpanel inserts a new object into the hierarchy between the figure object and the axes object containing the image. The figure shows the object hierarchy after the call to imscrollpanel.

Object Hierarchy of Image Displayed in Scroll Panel

A figure is the parent of an imscrollpanel panel, which is the parent of an axes, which is the parent of an image.

After you add a scroll panel to a figure, you can change the image data displayed in the scroll bar by using the replaceImage function in the imscrollpanel API.

The scroll panel navigation tool is not compatible with the figure window toolbar and menu bar. When you add a scroll panel to an image displayed in a figure window, suppress the toolbar and menu bar from the figure. This sample code demonstrates one way to do this.

hfig = figure("Toolbar","none","Menubar","none");
himage = imshow("foggysf1.jpg");
hpanel = imscrollpanel(hfig,himage);

See Also

| |

Related Examples

More About