Skip to content

set

builtin · libnexusinterp/corefcn/graphics-proprietary.cc

: set (h, property, value, …)
: set (h, {properties}, {values})
: set (h, pv)
: value_list = set (h, property)
: all_value_list = set (h)

Assign property values on the graphics handle h, or on each handle when h is a vector of handles.

The property names and values can be supplied in any of three ways:

  • as a comma-separated list of property, value pairs

    Each property is a string naming a property and each value is a value of the type that property expects. When h holds several handles, every one of them receives the same value. For example:

    h = plot ([0, 1]);
    set (h, 'color', 'green');
    
  • as a cell array of property names properties together with a cell array of property values values

    Here the number of columns in values must equal the number of entries in properties, each column holding the values for the corresponding name. values must have either a single row or as many rows as h has handles. A single row applies the same values to every handle; otherwise row k of values is applied to the k-th handle of h. For example:

    h = plot ([0, 1; 1, 0]);
    set (h, {'color'}, {'green'; 'red'});
    
  • as a structure pv

    This behaves like the first form: the field names of pv are the property names and the field values are the property values. As there, each property takes a single value that is applied to every handle in h. For example:

    h = plot ([0, 1]);
    props.color = 'green';
    set (h, props);
    

These three forms may be freely mixed within a single call.

set also reports which values a property can take. Calling clist = set (h, "property") returns, in the cell array clist, the values permitted for "property"; with no output variable the list is formatted and printed instead.

Calling slist = set (h) with no property name returns a structure slist whose field names are the object’s properties and whose field values list the permitted values for each. Again, with no output variable the information is printed rather than returned.

Such queries accept only a single handle to a single graphics object.

Example Query

hf = figure ();
set (hf, "paperorientation")
⇒   [ landscape | {portrait} ]

shows that the paperorientation property accepts two values, with "portrait" being the default, as indicated by the surrounding braces.