Make a physical copy of a plot object setting new values of attributes in the same call

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


plot::modify(obj, <attr, …>)


Plot objects usually have a reference effect. plot::modify creates copies which are independent of the original.

Objects created from inside the plot library have a reference effect: If you make another reference to some object, say by calling o2 := o1; and then change an attribute of o2, e.g., setting o2::Visible := FALSE, this change will also effect the object referred to by o1, since they actually refer to the same object. To create an actual copy of an object instead, use o2 := plot::copy(o1);.

The function plot::modify is a variant of plot::copy. It allows setting new values of attributes in the same call, as in o2 := plot::modify(o1, Visible = FALSE);.


Example 1

The following call does not create two points, but rather one which we can access by two names:

A := plot::Point2d(0, 0):
B := A:

This surfaces as soon as we try to modify `one of the points':

B::Position := [1, 1]:

Instead, we can use plot::modify to achieve the desired effect:

B := plot::modify(A, Position = [2, 2]):
A, B

    Note:   Note that plot::modify does not modify its argument, but returns a modified copy instead, whatever the name may suggest.



Plot objects


Attributes admissible for the object obj, in the form Attribute = Value

Return Values

Object of the same type as obj

See Also

MuPAD Functions

Was this topic helpful?