copystyle

Creates a copy of the style properties of a plot object.

Syntax

copystyle(handle)

style = copystyle(handle)

Inputs

handle
Handle of an axes, line, surface, hggroup or text object.
Type: double
Dimension: scalar

Outputs

style
A structure that contains the style properties of the object.

Examples

Copy the style of a line object:

clf;
lh = plot(rand(10,1));
set(lh,{'marker','linestyle','linewidth'},{'o',':',3});
style = copystyle(lh);
      
Figure 1. Style properties of a line object


Copy the style of an axes object:

clf;
lh = plot(rand(10,2),'r:o');
set(gca,{'fontweight', 'fontsize','xgrid','ygrid'},{'bold',14,'on','on'});
style = copystyle(gca);
      

Note that the style of the axes object includes the style of its children:

Figure 2. Style properties of an axes object


Comments

The purpose of copystyle command is to copy the style (colors, fonts, etc.) of an axes object or a child element of the axes object. The position of the axes, the data values of line/surfaces or the position of text boxes will not be copied.

If an output argument is not provided then the style will be saved in memory to be used with the pastestyle command.

The copystyle command is not supported for uicontrol objects.