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

Skip to content

Commit d1f837e

Browse files
committed
PR review.
- Updating "ReST" acronym / initialism to "reST" - Dropping mention of `pylab` for "modern" `matplotlib`
1 parent 70f7888 commit d1f837e

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

ipython_directive.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ will be rendered as
3333
for this document (see :ref:`ipython_literal`) because otherwise
3434
you will see only the rendered output and not the code that
3535
generated it. Excepting the example above, we will not in general
36-
be showing the literal ReST in this document that generates the
36+
be showing the literal reST in this document that generates the
3737
rendered output.
3838

3939

@@ -128,27 +128,24 @@ Another demonstration of multi-line input and output
128128
...:
129129

130130
Most of the "pseudo-decorators" can be used as options to IPython
131-
mode. For example, to setup ``matplotlib`` / ``pylab`` but suppress the output,
132-
you can do. When using the matplotlib ``use`` directive, it should
133-
occur before any import of ``pylab``. This will not show up in the
134-
rendered docs, but the commands will be executed in the embedded
135-
interpreter and subsequent line numbers will be incremented to reflect
136-
the inputs::
137-
131+
mode. For example, to setup ``matplotlib`` but suppress the output,
132+
you can do. This will not show up in the rendered docs, but the commands
133+
will be executed in the embedded interpreter and subsequent line numbers
134+
will be incremented to reflect the inputs::
138135

139136
.. ipython::
140137
:suppress:
141138

142-
In [1]: from pylab import *
139+
In [1]: import matplotlib.pyplot as plt
143140

144-
In [2]: ion()
141+
In [2]: plt.ion()
145142

146143
.. ipython::
147144
:suppress:
148145

149-
In [1]: from pylab import *
146+
In [1]: import matplotlib.pyplot as plt
150147

151-
In [2]: ion()
148+
In [2]: plt.ion()
152149

153150
Likewise, you can set the ``:doctest:`` or ``:verbatim:`` Sphinx options to
154151
apply these settings to the entire block. For example,
@@ -190,23 +187,23 @@ You can create one or more plots and insert them with the
190187
.. ipython::
191188

192189
@savefig plot_simple.png width=4in
193-
In [1]: plot([1,2,3]);
190+
In [1]: plt.plot([1,2,3]);
194191

195192
# use a semicolon to suppress the output
196193
@savefig hist_simple.png width=4in
197-
In [2]: hist(np.random.randn(10000), 100);
194+
In [2]: plt.hist(np.random.randn(10000), 100);
198195

199196
In a subsequent session, we can update the current figure with some
200197
text, and then resave
201198

202199
.. ipython::
203200

204-
In [1]: ylabel('number')
201+
In [1]: plt.ylabel('number')
205202

206-
In [2]: title('normal distribution')
203+
In [2]: plt.title('normal distribution')
207204

208205
@savefig hist_with_text.png width=4in align=center
209-
In [3]: grid(True)
206+
In [3]: plt.grid(True)
210207

211208
Pseudo-Decorators
212209
=================

0 commit comments

Comments
 (0)