MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / setp

Function setp

lib/matplotlib/artist.py:1831–1912  ·  view source on GitHub ↗

Set one or more properties on an `.Artist`, or list allowed values. Parameters ---------- obj : `~matplotlib.artist.Artist` or list of `.Artist` The artist(s) whose properties are being set or queried. When setting properties, all artists are affected; when queryin

(obj, *args, file=None, **kwargs)

Source from the content-addressed store, hash-verified

1829
1830
1831def setp(obj, *args, file=None, **kwargs):
1832 """
1833 Set one or more properties on an `.Artist`, or list allowed values.
1834
1835 Parameters
1836 ----------
1837 obj : `~matplotlib.artist.Artist` or list of `.Artist`
1838 The artist(s) whose properties are being set or queried. When setting
1839 properties, all artists are affected; when querying the allowed values,
1840 only the first instance in the sequence is queried.
1841
1842 For example, two lines can be made thicker and red with a single call:
1843
1844 >>> x = arange(0, 1, 0.01)
1845 >>> lines = plot(x, sin(2*pi*x), x, sin(4*pi*x))
1846 >>> setp(lines, linewidth=2, color='r')
1847
1848 file : file-like, default: `sys.stdout`
1849 Where `setp` writes its output when asked to list allowed values.
1850
1851 >>> with open('output.log') as file:
1852 ... setp(line, file=file)
1853
1854 The default, ``None``, means `sys.stdout`.
1855
1856 *args, **kwargs
1857 The properties to set. The following combinations are supported:
1858
1859 - Set the linestyle of a line to be dashed:
1860
1861 >>> line, = plot([1, 2, 3])
1862 >>> setp(line, linestyle='--')
1863
1864 - Set multiple properties at once:
1865
1866 >>> setp(line, linewidth=2, color='r')
1867
1868 - List allowed values for a line's linestyle:
1869
1870 >>> setp(line, 'linestyle')
1871 linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
1872
1873 - List all properties that can be set, and their allowed values:
1874
1875 >>> setp(line)
1876 agg_filter: a filter function, ...
1877 [long output listing omitted]
1878
1879 `setp` also supports MATLAB style string/value pairs. For example, the
1880 following are equivalent:
1881
1882 >>> setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style
1883 >>> setp(lines, linewidth=2, color='r') # Python style
1884
1885 See Also
1886 --------
1887 getp
1888 """

Callers

nothing calls this directly

Calls 5

pprint_settersMethod · 0.95
ArtistInspectorClass · 0.85
joinMethod · 0.80
updateMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…