Skip to content

Commit 0972b2e

Browse files
Examples: improve clarity of misc. section 'set and get' page text
1 parent 89fa0e4 commit 0972b2e

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

examples/misc/set_and_get.py

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
"""
2-
===========
3-
Set And Get
4-
===========
2+
======================
3+
Set and get properties
4+
======================
55
6-
The pyplot interface allows you to use setp and getp to set and get
7-
object properties, as well as to do introspection on the object
6+
The pyplot interface allows you to use ``setp`` and ``getp`` to
7+
set and get object properties respectively, as well as to do
8+
introspection on the object.
89
9-
set
10-
===
10+
Setting with ``setp``
11+
=====================
1112
12-
To set the linestyle of a line to be dashed, you can do::
13+
To set the linestyle of a line to be dashed, you use ``setp``::
1314
1415
>>> line, = plt.plot([1, 2, 3])
1516
>>> plt.setp(line, linestyle='--')
@@ -25,11 +26,11 @@
2526
2627
>>> plt.setp(line)
2728
28-
set operates on a single instance or a list of instances. If you are
29-
in query mode introspecting the possible values, only the first
29+
``setp`` operates on a single instance or a list of instances. If you
30+
are in query mode introspecting the possible values, only the first
3031
instance in the sequence is used. When actually setting values, all
31-
the instances will be set. e.g., suppose you have a list of two lines,
32-
the following will make both lines thicker and red::
32+
the instances will be set. For example, suppose you have a list of
33+
two lines, the following will make both lines thicker and red::
3334
3435
>>> x = np.arange(0, 1, 0.01)
3536
>>> y1 = np.sin(2*np.pi*x)
@@ -38,10 +39,10 @@
3839
>>> plt.setp(lines, linewidth=2, color='r')
3940
4041
41-
get
42-
===
42+
Getting with ``getp``
43+
=====================
4344
44-
get returns the value of a given attribute. You can use get to query
45+
``getp`` returns the value of a given attribute. You can use it to query
4546
the value of a single attribute::
4647
4748
>>> plt.getp(line, 'linewidth')
@@ -64,7 +65,7 @@
6465
To reduce keystrokes in interactive mode, a number of properties
6566
have short aliases, e.g., 'lw' for 'linewidth' and 'mec' for
6667
'markeredgecolor'. When calling set or get in introspection mode,
67-
these properties will be listed as 'fullname or aliasname'.
68+
these properties will be listed as 'fullname' or 'aliasname'.
6869
"""
6970

7071

0 commit comments

Comments
 (0)