imshow

Displays an image file in a figure.

Syntax

h = imshow(input)

h = imshow(input, property, value, ...)

h = imshow(parent, ...)

h = imshow(input)

Inputs

input
Path of the file that is displayed in a figure or matrix.
Type: string | mat
property, value
'position'
Position and size of h. Value is specified as a vector of the form: [left top width height].
If 'units' has a value of 'normalized', values must be between 0 to 1.
Type: vector
'units'
Specifies units of measurement. Valid values are 'pixels'(default) and 'normalized'.
Value 'pixel' indicates that h has a fixed size and position specified by 'position'.
Value 'normalized' indicates that h will be resized if parent is resized.
Type: string
parent
Handle of a container object, which could be an axis, figure, uipanel, or uitab.
Type: double | integer

Outputs

h
Handle of the image shown.
Type: double | integer

Examples

Display an image from a file:
close all;
h = imshow('img1.PNG');
Display an image on an axis. Using hold 'on', data values can be drawn over the image:
close all;
axes;
h = imshow(gca, 'img1.PNG');
hold('on');
plot(1:100,cos(1:100));

Comments

If the parent is an axis element then the image will be drawn in the grid area, the Y axis will be reversed and the axes method will be set to 'equal' by default.