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

Skip to content

Commit 983bc71

Browse files
committed
replaced ipython run magic with code.InteractiveConsole.runsource
svn path=/trunk/matplotlib/; revision=6089
1 parent a882195 commit 983bc71

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

doc/sphinxext/plot_directive.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
source will be included inline, as well as a link to the source.
1414
"""
1515

16-
import sys, os, glob, shutil
16+
import sys, os, glob, shutil, code
1717
from docutils.parsers.rst import directives
1818

1919
try:
@@ -26,11 +26,16 @@
2626

2727

2828
import matplotlib
29-
import IPython.Shell
29+
3030
matplotlib.use('Agg')
3131
import matplotlib.pyplot as plt
3232

33-
mplshell = IPython.Shell.MatplotlibShell('mpl')
33+
#import IPython.Shell
34+
#mplshell = IPython.Shell.MatplotlibShell('mpl')
35+
console = code.InteractiveConsole()
36+
def runfile(fname):
37+
source = file(fname).read()
38+
return console.runsource(source)
3439

3540
options = {'alt': directives.unchanged,
3641
'height': directives.length_or_unitless,
@@ -58,7 +63,7 @@
5863

5964
def makefig(fullpath, outdir):
6065
"""
61-
run a pyplot script and save the low and high res PNGs and a PDF in _static
66+
run a pyplot script<t and save the low and high res PNGs and a PDF in _static
6267
"""
6368

6469
fullpath = str(fullpath) # todo, why is unicode breaking this
@@ -88,7 +93,8 @@ def makefig(fullpath, outdir):
8893
plt.close('all') # we need to clear between runs
8994
matplotlib.rcdefaults()
9095

91-
mplshell.magic_run(fullpath)
96+
runfile(fullpath)
97+
9298
for format, dpi in formats:
9399
outname = os.path.join(outdir, '%s.%s' % (basename, format))
94100
if os.path.exists(outname): continue

lib/matplotlib/text.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ def get_rotation(rotation):
4141
# these are not available for the object inspector until after the
4242
# class is build so we define an initial set here for the init
4343
# function and they will be overridden after object defn
44-
artist.kwdocd['Text'] = """\
44+
artist.kwdocd['Text'] = """
4545
========================== =========================================================================
46-
alpha float
46+
Property Value
4747
========================== =========================================================================
48+
alpha float
4849
animated [True | False]
4950
backgroundcolor any matplotlib color
5051
bbox rectangle prop dict plus key 'pad' which is a pad in points
@@ -1003,7 +1004,7 @@ def __init__(self, s, xy,
10031004
annotation to the point. Valid keys are
10041005
10051006
========= ===========================================================
1006-
Key Description
1007+
Key Description
10071008
========= ===========================================================
10081009
width the width of the arrow in points
10091010
frac the fraction of the arrow length occupied by the head
@@ -1021,7 +1022,7 @@ def __init__(self, s, xy,
10211022
coordinates of *xy* and *xytext*.
10221023
10231024
================= ===================================================
1024-
Property Description
1025+
Property Description
10251026
================= ===================================================
10261027
'figure points' points from the lower left corner of the figure
10271028
'figure pixels' pixels from the lower left corner of the figure

0 commit comments

Comments
 (0)