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.
p = plot(1:10,1:10); p.LineWidth = 3;
plot(1:10,1:10,'LineWidth',3)
. Most plotting functions support name-value
pair arguments.
get | Query graphics object properties |
set | Set graphics object properties |
reset | Reset graphics object properties to their defaults |
Property Inspector | Open property inspector |
This example shows how to create, display, and modify graphics objects in MATLAB®.
Graphics objects are the visual components used by MATLAB® to display data graphically.
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.
Nearly all graphics object properties have predefined values, but you can define default property 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.
Learn about DPI-aware behavior that improves the appearance of graphical elements on high-resolution systems.