@@ -197,16 +197,24 @@ as your heart desires::
197197
198198 import matplotlib.pyplot as plt
199199 plt.figure(1) # the first figure
200+ plt.subplot(211) # the first subplot in the first figure
200201 plt.plot([1,2,3])
202+ plt.subplot(212) # the second subplot in the first figure
203+ plt.plot([4,5,6])
204+
201205
202206 plt.figure(2) # a second figure
203- plt.plot([4,5,6])
207+ plt.plot([4,5,6]) # creates a subplot(111) by default
204208
205- plt.figure(1) # figure 1 current
206- plt.title('Easy as 1,2,3') # figure 1 title
209+ plt.figure(1) # figure 1 current; subplot(212) still current
210+ plt.subplot(211) # make subplot(211) in figure1 current
211+ plt.title('Easy as 1,2,3') # subplot 211 title
207212
208213You can clear the current figure with :func: `~matplotlib.pyplot.clf `
209- and the current axes with :func: `~matplotlib.pyplot.cla `.
214+ and the current axes with :func: `~matplotlib.pyplot.cla `. If you find
215+ this statefulness, annoying, don't despair, this is just a thin
216+ stateful wrapper around an object oriented API, which you can use
217+ instead (see :ref: `artist-tutorial `)
210218
211219.. _working-with-text :
212220
@@ -216,19 +224,19 @@ Working with text
216224The :func: `~matplotlib.pyplot.text ` command can be used to add text in
217225an arbitrary location, and the :func: `~matplotlib.pyplot.xlabel `,
218226:func: `~matplotlib.pyplot.ylabel ` and :func: `~matplotlib.pyplot.title `
219- are used to add text in the indicated locations.
227+ are used tox add text in the indicated locations (see :ref: `text-intro `
228+ for a more detailed example)
220229
221230.. literalinclude :: figures/pyplot_text.py
222231
223232.. image :: figures/pyplot_text.png
224233 :scale: 50
225234
226235
227- All of the text commands The :func: `~matplotlib.pyplot.text ` commands
228- return an :class: `matplotlib.text.Text ` instance. Just as with with
229- lines above, you can customize the properties by passing keyword
230- arguments into the text functions or using
231- :func: `~matplotlib.pyplot.setp `::
236+ All of the :func: `~matplotlib.pyplot.text ` commands return an
237+ :class: `matplotlib.text.Text ` instance. Just as with with lines
238+ above, you can customize the properties by passing keyword arguments
239+ into the text functions or using :func: `~matplotlib.pyplot.setp `::
232240
233241 t = plt.xlabel('my data', fontsize=14, color='red')
234242
0 commit comments