Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58610f4

Browse files
committed
DOC : more edits to docs
1 parent a56ea63 commit 58610f4

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

doc/users/cycler.rst

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
.. _cycler_guide:
2+
.. currentmodule:: matplotlib.cycler
23

34
==========================
45
Style/kwarg cycler Guide
56
==========================
67

7-
.. currentmodule:: matplotlib.cycler
8+
`~matplotlib.cycler.Cycler` API
9+
===============================
10+
11+
.. autosummary::
12+
:toctree: generated/
13+
14+
cycler
15+
Cycler
16+
17+
18+
The public API of `Cycler` consists of a class
19+
`~matplotlib.cycler.Cycler` and a factory function
20+
`~matplotlib.cycler.cycler`. The class takes care of the composition
21+
and iteration logic while the function provides a simple interface for
22+
creating 'base' `Cycler` objects.
23+
24+
25+
Motivation
26+
==========
27+
828

929
When plotting more than one line it is common to want to be able to cycle over one
1030
or more artist styles. For simple cases than can be done with out too much trouble:
@@ -58,23 +78,11 @@ the plotting logic can quickly become very involved. To address this and allow
5878
cycling over arbitrary ``kwargs`` the `~matplotlib.cycler.Cycler` class, a composable
5979
kwarg iterator, was developed.
6080

81+
`Cycler` Usage
82+
==============
6183

62-
`~matplotlib.cycler.Cycler`
63-
===========================
64-
65-
The public API of `Cycler` consists of a class
66-
`~matplotlib.cycler.Cycler` and a factory function
67-
`~matplotlib.cycler.cycler`. The class takes care of the composition and iteration logic while
68-
the function provides a simple interface for creating 'base' `Cycler` objects.
69-
70-
.. autosummary::
71-
:toctree: generated/
72-
73-
Cycler
74-
cycler
75-
76-
77-
A 'base' `Cycler` object is some what useful
84+
A 'base' `Cycler` object is some what useful and can be used to easily
85+
cycle over a single style
7886

7987
.. plot::
8088
:include-source:
@@ -85,13 +93,13 @@ A 'base' `Cycler` object is some what useful
8593
fig, (ax1, ax2) = plt.subplots(1, 2, tight_layout=True, figsize=(8, 4))
8694
x = np.arange(10)
8795

88-
single_cycle = cycler('c', ['r', 'g', 'b'])
96+
color_cycle = cycler('c', ['r', 'g', 'b'])
8997

90-
for i, sty in enumerate(single_cycle):
98+
for i, sty in enumerate(color_cycle):
9199
ax1.plot(x, x*(i+1), **sty)
92100
93101

94-
for i, sty in zip(range(1, 10), cycle(single_cycle)):
102+
for i, sty in zip(range(1, 10), cycle(color_cycle)):
95103
ax2.plot(x, x*i, **sty)
96104
97105

@@ -111,6 +119,16 @@ A 'base' `Cycler` object is some what useful
111119
len(color_cycle)
112120
113121
122+
fig, (ax1, ax2) = plt.subplots(1, 2, tight_layout=True, figsize=(8, 4))
123+
x = np.arange(10)
124+
125+
126+
for i, sty in enumerate(color_cycle):
127+
ax1.plot(x, x*(i+1), **sty)
128+
129+
130+
131+
114132
115133
However they are most useful when composed. They can be added
116134

@@ -157,11 +175,11 @@ complicated cycles to be defined very succinctly
157175
fig, (ax1, ax2) = plt.subplots(1, 2, tight_layout=True, figsize=(8, 4))
158176
x = np.arange(10)
159177

160-
single_cycle = cycler('c', ['r', 'g', 'b'])
178+
color_cycle = cycler('c', ['r', 'g', 'b'])
161179

162-
for i, sty in enumerate(single_cycle):
180+
for i, sty in enumerate(color_cycle):
163181
ax1.plot(x, x*(i+1), **sty)
164182
165183

166-
for i, sty in zip(range(1, 10), cycle(single_cycle)):
184+
for i, sty in zip(range(1, 10), cycle(color_cycle)):
167185
ax2.plot(x, x*i, **sty)

0 commit comments

Comments
 (0)