matplotlib 3.5.1

ParametersBackRef
setp(obj, *args, **kwargs)

Parameters

obj : `.Artist` 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(2*pi*x), x, sin(4*pi*x))
>>> setp(lines, linewidth=2, color='r')
file : file-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 :None:None:`sys.stdout`.

*args, **kwargs :

The properties to set. The following combinations are supported:

  • Set the linestyle of a line to be dashed:

    >>> line, = plot([1, 2, 3])
    >>> setp(line, linestyle='--')
  • Set multiple properties at once:

    >>> setp(line, linewidth=2, color='r')
  • List allowed values for a line's linestyle:

    >>> setp(line, 'linestyle')
    linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
  • List all properties that can be set, and their allowed values:

    >>> setp(line)
    agg_filter: a filter function, ...
    [long output listing omitted]

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

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

See Also

getp

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.pyplot.setp matplotlib.pyplot.get matplotlib.pyplot.getp matplotlib.pyplot.plotting

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/pyplot.py#583
type: <class 'function'>
Commit: