Main Content


Set color used to draw ROI object

setColor is not recommended. With the new ROIs, set the value of the Color property instead. For more information, see Compatibility Considerations.



setColor(h,color) sets the color used to draw the ROI object h.


collapse all

Display an image. Draw a polygon on the image, specifying the location of five vertices.

h = impoly(gca,[188,30; 189,142; 93,141; 13,41; 14,29]);

Set the color of the polygon to yellow.


Input Arguments

collapse all

ROI object, specified as an imellipse, imfreehand, imline, impoint, impoly, or imrect object.

RGB color value, specified as a 3-element numeric vector, or the long or short name of a predefined color, such as 'white' or 'w'. See ColorSpec for a list of predefined colors.

Compatibility Considerations

expand all

Not recommended starting in R2018b

Introduced in R2008a