@@ -61,7 +61,9 @@ fig.add_subplot call above (remember Subplot is just a subclass of
6161Axes) and when you call ax.plot, it creates a Line2D instance and adds
6262it the the Axes.lines list. In the interactive ipython session below,
6363you can see that Axes.lines list is length one and contains the same
64- line that was returned by the "line, ax.plot(x, y, 'o')" call::
64+ line that was returned by the "line, ax.plot(x, y, 'o')" call:
65+
66+ .. sourcecode:: ipython
6567
6668 In [101]: ax.lines[0]
6769 Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
@@ -159,8 +161,9 @@ If you are working interactively at the python shell, a handy way to
159161inspect the artist properties is to use the matplotlib.artist.getp
160162method, which lists the properties and their values (simply "getp") in
161163pylab. This works for classes derived from Artist as well, eg Figure
162- and Rectangle. Here are the Figure rectangle properties mentioned above::
164+ and Rectangle. Here are the Figure rectangle properties mentioned above:
163165
166+ .. sourcecode:: ipython
164167
165168 In [149]: matplotlib.artist.getp(fig.figurePatch)
166169 alpha = 1.0
@@ -218,7 +221,9 @@ contains everything in the figure. The background of the figure is a
218221Rectangle which is stored in fig.figurePatch (where fig is your Figure
219222instance). As you add subplots (fig.add_subplot) and axes
220223(ax.add_axes)to the figure these will be appended to the fig.axes
221- list. These are also returned by the methods that create them::
224+ list. These are also returned by the methods that create them:
225+
226+ .. sourcecode:: ipython
222227
223228 In [156]: fig = plt.figure()
224229
@@ -232,7 +237,6 @@ list. These are also returned by the methods that create them::
232237 In [160]: print fig.axes
233238 [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
234239
235-
236240Because the figure maintains the concept of the "current axes" (see
237241Figure.gca and Figure.sca) to support the pylab/pyplot state machine,
238242you should not insert or remove axes directly from the axes list, but
@@ -253,7 +257,9 @@ want) but you can control this by setting the transform property of
253257the Artist you are adding to the figure. More useful is "figure
254258coordinates" where 0,0 is the bottom, left of the figure and 1,1 is
255259the top, right of the figure which you can obtain by setting the
256- Artist transform to fig.transFigure::
260+ Artist transform to fig.transFigure:
261+
262+ .. sourcecode:: ipython
257263
258264 In [191]: fig = plt.figure()
259265
@@ -303,7 +309,9 @@ When you call a plotting method, eg the canonical "ax.plot" and pass
303309in arrays or list of values, the method will a matplotlib.lines.Line2D
304310instance, update the line with all the Line2D properties passed as
305311keyword arguments, add the line to the Axes.lines container, and
306- returns it to you::
312+ returns it to you:
313+
314+ .. sourcecode:: ipython
307315
308316 In [213]: x, y = np.random.rand(2, 100)
309317
@@ -312,14 +320,17 @@ returns it to you::
312320ax.plot returns a list of lines because you can pass in multiple x, y
313321pairs to plot, and we are unpacking the first element of the length
314322one list into the line variable. The line has been added to the
315- ax.lines list::
323+ ax.lines list:
316324
325+ .. sourcecode:: ipython
317326
318327 In [229]: print ax.lines
319328 [<matplotlib.lines.Line2D instance at 0xd378b0c>]
320329
321330Similarly, methods that create patches, like ax.bar creates a list of
322- rectangles, will add the patches to the ax.patches list::
331+ rectangles, will add the patches to the ax.patches list:
332+
333+ .. sourcecode:: ipython
323334
324335 In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
325336
@@ -338,7 +349,9 @@ auto-scaling, so that the view limits can be adjusted to contain the
338349plotted data. You can, nonetheless, create objects yourself and add
339350them directly to the Axes using helper methods like ax.add_line and
340351ax.add_patch. Here is an annotated interactive session illustrating
341- what is going on::
352+ what is going on:
353+
354+ .. sourcecode:: ipython
342355
343356 In [261]: fig = plt.figure()
344357
@@ -460,7 +473,9 @@ and zooming), you should access the lists of major and minor ticks
460473through their accessor methods axis.get_major_ticks() and
461474axis.get_minor_ticks(). Although the ticks contain all the primitives
462475and will be covered below, the Axis methods contain accessor methods
463- to return the tick lines, tick labels, tick locations etc....::
476+ to return the tick lines, tick labels, tick locations etc....:
477+
478+ .. sourcecode:: ipython
464479
465480 In [285]: axis = ax.xaxis
466481
0 commit comments