| MATLAB® | ![]() |
| On this page… |
|---|
A number of high-level plotting functions create plot objects. The properties of plot objects provide easy access to the important properties of the core graphics objects that the plot objects contain.
Plot object parents can be axes or group objects (hggroup or hgtransform). See Objects That Can Contain Other Objects for examples.

This table lists the plot objects and the graphing functions that use them. Click object names to see a description of their properties.
Plot Objects
Object | Purpose |
|---|---|
Used to create area graphs | |
Used to create bar graphs | |
Used to create contour graphs | |
Used to create errorbar graphs | |
Used to create stairstep graphs (stairs) | |
For example, the following statements create a contour graph of the peaks function and then set the line style and width of the contour lines.
[x,y,z] = peaks; [c,h] = contour(x,y,z); set(h,'LineWidth',3,'LineStyle',':')

The contour plot object enables you to set the line width and style of the contour graph by setting two properties. Looking at the core objects contained in the contour plot object reveals a number of patch objects whose edges are used to implement the contour line, which you would otherwise need to set individually.
child_handles = get(h,'Children');
get(child_handles,'Type')
ans =
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
'patch'
Plot objects all return hggroup as the value of the Type property. If you want to be able to identify plot objects programmatically but do not have access to the object's handle, set a value for the object's Tag property.
For example, the following statements create a bar graph with five barseries objects and assign a different value for the Tag property on each object.
h = bar(rand(5));
set(h,{'Tag'},{'bar1','bar2','bar3','bar4','bar5'}')
Note that the cell array of property values must be transposed (') to have the proper shape. See the set function for more information on setting properties.
Note that you cannot define default values for plot objects.
Note The v6 option discussed in this section is now obsolete and will be removed in a future version of MATLAB® software. |
Plotting functions that create plot objects can introduce incompatibilities with code written before MATLAB Version 7.x. However, all plotting functions that return handles to plot objects support an optional argument ('v6') that forces the functions to use core objects, as was the case in MATLAB software before Version 7.
See Plot Objects for a list of functions that create plot objects.
See Core Graphics Objects for a list of core graphics objects.
Create backward-compatible FIG-files by following these two steps.
Ensure that any plotting functions used to create the contents of the figure are called with the 'v6' argument, where applicable.
Use the '-v6' option with the hgsave command.
For example,
h = figure;
t = 0:pi/20:2*pi;
plot('v6',t,sin(t).*2)
hgsave(h,'myFigFile','-v6')
You can set a general MATLAB preference to ensure that figures saved by selecting the Save item under the figure File menu are backward compatible. To access MATLAB preferences, select Preferences from the Desktop File menu. Expand the General node and select MAT Files. Click Ensure backward compatibility (-v6). Note that this setting affects all FIG-files and MAT-files that you create.
![]() | Core Graphics Objects | Linking Graphs to Variables — Data Source Properties | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |