matplotlib.pyplot.setp — Matplotlib 3.10.3 documentation (original) (raw)

matplotlib.pyplot.setp(obj, *args, **kwargs)[source]#

Set one or more properties on an Artist, or list allowed values.

Parameters:

objArtist or list of Artist

The artist(s) whose properties are being set or queried. When setting properties, all artists are affected; when querying the allowed values, only the first instance in the sequence is queried.

For example, two lines can be made thicker and red with a single call:

x = arange(0, 1, 0.01) lines = plot(x, sin(2pix), x, sin(4pix)) setp(lines, linewidth=2, color='r')

filefile-like, default: sys.stdout

Where setp writes its output when asked to list allowed values.

with open('output.log') as file: ... setp(line, file=file)

The default, None, means sys.stdout.

*args, **kwargs

The properties to set. The following combinations are supported:

setp also supports MATLAB style string/value pairs. For example, the following are equivalent:

setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style setp(lines, linewidth=2, color='r') # Python style

Notes

Examples using matplotlib.pyplot.setp#