Documentation Center

  • Trial Software
  • Product Updates

Plot Objects


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).

This table lists the plot objects and the graphing functions that use them. Click the object names to see a description of their properties.

Plot Objects




Used to create area graphs.


Used to create bar graphs.


Used to create contour graphs.


Used to create errorbar graphs.


Used by line plotting functions (plot, plot3, etc.).


Used to create quiver and quiver3 graphs.


Used to create scatter and scatter3 graphs.


Used to create stairstep graphs (stairs).


Used to create stem and stem3 graphs.


Used by the surf and mesh group of functions.

Creating a Plot Object

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);

Identifying Plot Objects Programmatically

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));

The cell array of property values must be transposed (') to have the proper shape. See the set function for more information on setting properties.

No User Default Values

You cannot define default values for plot objects.

Plot Objects and Backward Compatibility

    Note:   The v6 option discussed in this section is now obsolete and will be removed in a future version of MATLAB®.

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 before Version 7.

Saving Figures That Are Compatible with Previous Version of MATLAB

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;

You can set a general MATLAB preference to ensure that figures saved by selecting MATLAB Version 5 or later (save -v6). This setting affects all FIG-files and MAT-files that you create.

Was this topic helpful?