Graphics Object Properties

View and set graphics object properties, define default values

You can control the behavior and appearance of a particular graphics object by setting its properties. To set properties, return the object as an output argument from the function that creates it. For example, the plot function returns a chart line object. Then, use dot notation to view and set properties. Dot notation works in R2014b and later. If you are using an earlier release, use the get and set functions instead. For more information, see Access Property Values.

p = plot(1:10,1:10);
p.LineWidth = 3; 
Alternatively, you can set properties using name-value pair arguments when creating the object, such as plot(1:10,1:10,'LineWidth',3). Most plotting functions support name-value pair arguments.

Properties

expand all

Root PropertiesGraphics environment and state information
Figure PropertiesControl appearance and behavior of figure window
Axes Properties Axes appearance and behavior
PolarAxes PropertiesPolar axes appearance and behavior
GeographicAxes PropertiesControl geographic axes appearance and behavior
Area PropertiesArea chart appearance and behavior
Bar PropertiesBar chart appearance and behavior
Contour PropertiesContour chart appearance and behavior
ErrorBar PropertiesError bar chart appearance and behavior
GeographicBubbleChart PropertiesControl geographic bubble chart appearance and behavior
HeatmapChart PropertiesHeatmap chart appearance and behavior
Line PropertiesChart line appearance and behavior
Quiver PropertiesQuiver chart appearance and behavior
Scatter PropertiesScatter chart appearance and behavior
ScatterHistogramChart PropertiesControl scatter histogram chart appearance and behavior
StackedAxesProperties PropertiesAppearance and behavior of individual axes in stacked plot
StackedLineChart PropertiesStacked plot appearance and behavior
StackedLineProperties PropertiesAppearance and behavior of individual lines in stacked plot
Stair PropertiesStair chart appearance and behavior
Stem PropertiesStem chart appearance and behavior
Surface PropertiesChart surface appearance and behavior
WordCloudChart PropertiesControl word cloud chart appearance and behavior
ParallelCoordinatesPlot PropertiesControl parallel coordinates plot appearance and behavior
AnimatedLine PropertiesLine animation appearance and behavior
Image PropertiesImage appearance and behavior
Light PropertiesLight appearance and behavior
Line PropertiesPrimitive line appearance and behavior
Patch PropertiesPatch appearance and behavior
Polygon PropertiesPolygon appearance and behavior
Rectangle PropertiesRectangle appearance and behavior
Surface PropertiesPrimitive surface appearance and behavior
Text PropertiesText appearance and behavior
FunctionLine PropertiesLine chart appearance and behavior
ImplicitFunctionLine PropertiesImplicit line chart appearance and behavior
ParameterizedFunctionLine PropertiesParameterized line chart appearance and behavior
FunctionContour PropertiesContour chart appearance and behavior
FunctionSurface PropertiesSurface chart appearance and behavior
ImplicitFunctionSurface PropertiesImplicit surface chart appearance and behavior
ParameterizedFunctionSurface PropertiesParameterized surface chart appearance and behavior
Group PropertiesGroup object appearance and behavior
Transform PropertiesTransform object appearance and behavior
ColorBar PropertiesColorbar appearance and behavior
Legend PropertiesLegend appearance and behavior
CategoricalRuler PropertiesControl axis with categorical values
DatetimeRuler PropertiesControl axis with datetime values
DurationRuler PropertiesControl axis with duration values
NumericRuler PropertiesControl axis with numeric values
Arrow PropertiesArrow appearance and behavior
DoubleEndArrow PropertiesDouble end arrow appearance and behavior
Ellipse PropertiesEllipse appearance and behavior
Line PropertiesAnnotation line appearance and behavior
Rectangle PropertiesAnnotation rectangle appearance and behavior
TextArrow PropertiesText arrow appearance and behavior
TextBox PropertiesText box appearance and behavior

Functions

getQuery graphics object properties
setSet graphics object properties
resetReset graphics object properties to their defaults
Property InspectorOpen property inspector

Topics

Modify Graphics Objects

This example shows how to create, display, and modify graphics objects in MATLAB®.

Graphics Object Hierarchy

Graphics objects are the visual components used by MATLAB® to display data graphically.

Access Property Values

You can set and query property values or return them to their original (factory default) values.

Features Controlled by Graphics Objects

Graphics objects represent data in intuitive and meaningful ways, such as line graphs, images, text, and combinations of these objects.

Default Property Values

Nearly all graphics object properties have predefined values, but you can define default property values.

Define Default Line Styles

This example shows how to set default line styles.

Multilevel Default Values

This example sets default values on more than one level in the hierarchy.

Default Values for Automatically Calculated Properties

When you create a graph, MATLAB sets certain property values appropriately for the particular graph.

How MATLAB Finds Default Values

All graphics object properties have values built into MATLAB. You can also define your own default values.

Factory-Defined Property Values

Plotting functions use factory-defined property values if you do not specify values as arguments or as defaults.

DPI-Aware Behavior in MATLAB

Learn about DPI-aware behavior that improves the appearance of graphical elements on high-resolution systems.