set
Sets property values for graphics handles.
Syntax
set(handle, p, v)
set(h-vector, str-cell, v-cell)
Inputs
- handle
- Graphics handle.
- p
- Property to be modified.
- v
- Value of property to be modified.
- h-vector
- Vector of the graphics handles.
- str-cell
- A cell array containing the properties to be set.
- v-cell
- A cell array containing the values to be set. The cell array's dimensions can either be MxN, where M is the number of handles and N is the number of properties, or, 1xN, where N is the number of properties. If the cell array's dimensions are 1xN, then the same properties/values are applied to all graphics object handles included in h-vector.
Examples
clf;
titleHandle = get(gca, 'title')
set(titleHandle, 'string', 'New title')
set(titleHandle, 'color', [255 0 0])
clf;
titleHandle = get(gca, 'title')
set(titleHandle, {'string', 'color', 'fontSize', 'fontweight'}, {'New title', [136 0 21], 18 'bold'})
clf;
ph = plot(rand(10,5));
set(ph, {'color','linewidth'}, {'r', 1;'b', 2;'g', 3;'c', 4;'y', 5})
clf;
ph = plot(rand(10,5));
set(ph, {'color','linestyle'}, {'r', '--'})
Comments
set can be used to set properties of differrent graphics objects, including root, figure, axes, line, text, and surface, for example. For a complete list of the available properties for each graphics object, please see Properties for Graphics Object.