plot::modify

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

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

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

Description

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

plot::modify copies a plot object the same way as plot::copy does, but it also lets you set new values of attributes in the same call. For example, you can use o2 := plot::modify(o1, Visible = FALSE).

Note that plot::modify does not modify its argument, but returns a modified copy instead.

Examples

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 becomes obvious when you try to modify one of the points:

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

To copy and modify a point in one call, use plot::modify :

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

Parameters

obj

Plot objects

attr

Attributes acceptable by the object obj, in the form Attribute = Value

Return Values

Object of the same type as obj

See Also

MuPAD Functions