Revision: 3757
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3757&view=rev
Author: mdboom
Date: 2007-08-30 08:11:23 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Remove the "markup" kwarg and rcParam everywhere and replace it with
an automatic detection of math markup.
Modified Paths:
--------------
trunk/matplotlib/examples/accented_text.py
trunk/matplotlib/examples/arrow_demo.py
trunk/matplotlib/examples/dannys_example.py
trunk/matplotlib/examples/histogram_demo.py
trunk/matplotlib/examples/histogram_demo_canvasagg.py
trunk/matplotlib/examples/integral_demo.py
trunk/matplotlib/examples/legend_auto.py
trunk/matplotlib/examples/mathtext_demo.py
trunk/matplotlib/examples/mathtext_examples.py
trunk/matplotlib/examples/quiver_demo.py
trunk/matplotlib/examples/scatter_demo2.py
trunk/matplotlib/examples/tex_demo.py
trunk/matplotlib/examples/tex_unicode_demo.py
trunk/matplotlib/examples/unicode_demo.py
trunk/matplotlib/lib/matplotlib/config/mplconfig.py
trunk/matplotlib/lib/matplotlib/config/rcsetup.py
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/mathtext.py
trunk/matplotlib/lib/matplotlib/quiver.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/lib/matplotlib/table.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/examples/accented_text.py
===================================================================
--- trunk/matplotlib/examples/accented_text.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/accented_text.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -13,9 +13,9 @@
plot(range(10))
-title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$',
fontsize=20, markup="tex")
+title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{i}\bar{A}\tilde{n}\vec{q}$',
fontsize=20)
# shorthand is also supported and curly's are optional
-xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20, markup="tex")
+xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20)
show()
Modified: trunk/matplotlib/examples/arrow_demo.py
===================================================================
--- trunk/matplotlib/examples/arrow_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/arrow_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -52,7 +52,7 @@
min_text_size = size
label_text_size = size*2.5
text_params={'ha':'center', 'va':'center', 'family':'sans-serif',\
- 'fontweight':'bold', 'markup': 'tex'}
+ 'fontweight':'bold'}
r2 = sqrt(2)
deltas = {\
@@ -211,7 +211,7 @@
label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
text(x, y, label, size=label_text_size, ha='center', va='center', \
- color=labelcolor or fc, markup='tex')
+ color=labelcolor or fc)
for p in positions.keys():
draw_arrow(p)
Modified: trunk/matplotlib/examples/dannys_example.py
===================================================================
--- trunk/matplotlib/examples/dannys_example.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/dannys_example.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -29,14 +29,14 @@
pylab.plot((-delta / 2, -delta / 2 + offset * 2), (height, height + offset),
'k', linewidth = 2)
pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height - offset),
'k', linewidth = 2)
pylab.plot((delta / 2, delta / 2 - offset * 2), (height, height + offset),
'k', linewidth = 2)
-pylab.text(-0.06, height - 0.06, r'$\delta$', {'color' : 'k', 'fontsize' :
24}, markup = 'tex')
+pylab.text(-0.06, height - 0.06, r'$\delta$', {'color' : 'k', 'fontsize' : 24})
## X-axis label
pylab.xticks((-1, 0, 1), ('-1', '0', '1'), color = 'k', size = 20)
## Left Y-axis labels
pylab.ylabel(r'\bf{phase field} $\phi$', {'color' : 'b',
- 'fontsize' : 20 }, markup='tex')
+ 'fontsize' : 20 })
pylab.yticks((0, 0.5, 1), ('0', '.5', '1'), color = 'k', size = 20)
## Right Y-axis labels
@@ -44,17 +44,16 @@
horizontalalignment = 'left',
verticalalignment = 'center',
rotation = 90,
- clip_on = False,
- markup = 'tex')
+ clip_on = False)
pylab.text(1.01, -0.02, "-1", {'color' : 'k', 'fontsize' : 20})
pylab.text(1.01, 0.98, "1", {'color' : 'k', 'fontsize' : 20})
pylab.text(1.01, 0.48, "0", {'color' : 'k', 'fontsize' : 20})
## level set equations
-pylab.text(0.1, 0.85, r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial
\phi}{\partial t} + U|\nabla \phi| = 0$', {'color' : 'g', 'fontsize' : 20},
markup='tex')
+pylab.text(0.1, 0.85, r'$|\nabla\phi| = 1,$ \newline $ \frac{\partial
\phi}{\partial t} + U|\nabla \phi| = 0$', {'color' : 'g', 'fontsize' : 20})
## phase field equations
-pylab.text(0.2, 0.15, r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$
\newline $ \frac{ \partial \phi } { \partial t } = -M_{ \phi } \frac{ \delta
\mathcal{F} } { \delta \phi }$', {'color' : 'b', 'fontsize' : 20}, markup='tex')
+pylab.text(0.2, 0.15, r'$\mathcal{F} = \int f\left( \phi, c \right) dV,$
\newline $ \frac{ \partial \phi } { \partial t } = -M_{ \phi } \frac{ \delta
\mathcal{F} } { \delta \phi }$', {'color' : 'b', 'fontsize' : 20})
pylab.savefig('pfm-lsm.png')
pylab.show()
Modified: trunk/matplotlib/examples/histogram_demo.py
===================================================================
--- trunk/matplotlib/examples/histogram_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/histogram_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -15,7 +15,7 @@
xlabel('Smarts')
ylabel('Probability')
-title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$', markup='tex')
+title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
axis([40, 160, 0, 0.03])
grid(True)
Modified: trunk/matplotlib/examples/histogram_demo_canvasagg.py
===================================================================
--- trunk/matplotlib/examples/histogram_demo_canvasagg.py 2007-08-30
13:51:10 UTC (rev 3756)
+++ trunk/matplotlib/examples/histogram_demo_canvasagg.py 2007-08-30
15:11:23 UTC (rev 3757)
@@ -33,7 +33,7 @@
ax.set_xlabel('Smarts')
ax.set_ylabel('Probability')
-ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$', markup='tex')
+ax.set_title(r'$\mathrm{Histogram of IQ: }\mu=100, \sigma=15$')
ax.set_xlim( (40, 160))
ax.set_ylim( (0, 0.03))
Modified: trunk/matplotlib/examples/integral_demo.py
===================================================================
--- trunk/matplotlib/examples/integral_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/integral_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -23,7 +23,7 @@
text(0.5 * (a + b), 30,
r"$\int_a^b f(x)\mathrm{d}x$", horizontalalignment='center',
- fontsize=20, markup='tex')
+ fontsize=20)
axis([0,10, 0, 180])
figtext(0.9, 0.05, 'x')
Modified: trunk/matplotlib/examples/legend_auto.py
===================================================================
--- trunk/matplotlib/examples/legend_auto.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/legend_auto.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -51,9 +51,9 @@
def fig_7():
figure(7)
xx = x - (N/2.0)
- plot(xx, (xx*xx)-1225, 'bo', label='$y=x^2$', markup='tex')
- plot(xx, 25*xx, 'go', label='$y=25x$', markup='tex')
- plot(xx, -25*xx, 'mo', label='$y=-25x$', markup='tex')
+ plot(xx, (xx*xx)-1225, 'bo', label='$y=x^2$')
+ plot(xx, 25*xx, 'go', label='$y=25x$')
+ plot(xx, -25*xx, 'mo', label='$y=-25x$')
legend()
def fig_8():
Modified: trunk/matplotlib/examples/mathtext_demo.py
===================================================================
--- trunk/matplotlib/examples/mathtext_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/mathtext_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -13,12 +13,14 @@
x = npy.arange(0.0, 3.0, 0.1)
ax.grid(True)
-ax.set_xlabel(r'$\Delta_i^j$', fontsize=20, markup="tex")
-ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20, markup="tex")
+ax.set_xlabel(r'$\Delta_i^j$', fontsize=20)
+ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$'
-ax.text(1, 1.6, tex, fontsize=20, va='bottom', markup="tex")
+ax.text(1, 1.6, tex, fontsize=20, va='bottom')
+ax.legend(("Foo", "Testing $x^2$"))
+
#title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$',
fontsize=20)
fig.savefig('mathtext_demo')
Modified: trunk/matplotlib/examples/mathtext_examples.py
===================================================================
--- trunk/matplotlib/examples/mathtext_examples.py 2007-08-30 13:51:10 UTC
(rev 3756)
+++ trunk/matplotlib/examples/mathtext_examples.py 2007-08-30 15:11:23 UTC
(rev 3757)
@@ -2,14 +2,18 @@
import os, sys, re
+import gc
+
stests = [
r'Kerning: AVA $AVA$',
+ r'\$100.00 $\alpha$',
+ r'$\frac{\$100.00}{y}$',
r'$x y$',
r'$x+y\ x=y\ x<y\ x:y\ x,y\ [EMAIL PROTECTED]',
r'$100\%y\ x*y\ x/y x\$y$',
r'$x\leftarrow y\ x\forall y\ x-y$',
r'$x \sf x \bf x {\cal X} \rm x$',
- r'$x\ x\,x\;x\quad x\qquad x\!x\hspace{0.5}y$',
+ r'$x\ x\,x\;x\quad x\qquad x\!x\hspace{ 0.5 }y$',
r'$\{ \rm braces \}$',
r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} y\right)\right]$',
r'$\left(x\right)$',
@@ -59,10 +63,10 @@
yticks(arange(len(tests)) * -1)
for i, s in enumerate(tests):
print "%02d: %s" % (i, s)
- text(0.1, -i, s, fontsize=20, markup="tex")
+ text(0.1, -i, s, fontsize=20)
savefig('mathtext_example')
- figure()
+ close('all')
if '--latex' in sys.argv:
fd = open("mathtext_examples.ltx", "w")
Modified: trunk/matplotlib/examples/quiver_demo.py
===================================================================
--- trunk/matplotlib/examples/quiver_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/quiver_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -18,8 +18,7 @@
figure()
Q = quiver( U, V)
qk = quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W',
- fontproperties={'weight': 'bold'},
- markup="tex")
+ fontproperties={'weight': 'bold'})
l,r,b,t = axis()
dx, dy = r-l, t-b
axis([l-0.05*dx, r+0.05*dx, b-0.05*dy, t+0.05*dy])
@@ -32,8 +31,7 @@
qk = quiverkey(Q, 0.9, 0.95, 2, r'$2 \frac{m}{s}$',
labelpos='E',
coordinates='figure',
- fontproperties={'weight': 'bold'},
- markup="tex")
+ fontproperties={'weight': 'bold'})
axis([-1, 7, -1, 7])
title('scales with plot width, not view')
@@ -41,7 +39,7 @@
figure()
Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
pivot='mid', color='r', units='inches' )
-qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight':
'bold'}, markup="tex")
+qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight':
'bold'})
plot( X[::3, ::3], Y[::3, ::3], 'k.')
axis([-1, 7, -1, 7])
title("pivot='mid'; every third arrow; units='inches'")
@@ -52,8 +50,7 @@
Q = quiver( X, Y, U, V, M, units='x', pivot='tip', width=0.022, scale=1/0.15)
qk = quiverkey(Q, 0.9, 1.05, 1, r'$1 \frac{m}{s}$',
labelpos='E',
- fontproperties={'weight': 'bold'},
- markup="tex")
+ fontproperties={'weight': 'bold'})
plot(X, Y, 'k.')
axis([-1, 7, -1, 7])
title("scales with x view; pivot='tip'")
@@ -63,7 +60,7 @@
Q = quiver( X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
color='r', units='x',
linewidths=(2,), edgecolors=('k'), headaxislength=5 )
-qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight':
'bold'}, markup="tex")
+qk = quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$', fontproperties={'weight':
'bold'})
axis([-1, 7, -1, 7])
title("triangular head; scale with x view; black edges")
Modified: trunk/matplotlib/examples/scatter_demo2.py
===================================================================
--- trunk/matplotlib/examples/scatter_demo2.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/scatter_demo2.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -11,8 +11,8 @@
close = 0.003*intc.close[:-2]/0.003*intc.open[:-2]
p = scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.75)
-xlabel(r'$\Delta_i$', size='x-large', markup='tex')
-ylabel(r'$\Delta_{i+1}$', size='x-large', markup='tex')
+xlabel(r'$\Delta_i$', size='x-large')
+ylabel(r'$\Delta_{i+1}$', size='x-large')
title(r'Volume and percent change')
grid(True)
#savefig('scatter_demo2')
Modified: trunk/matplotlib/examples/tex_demo.py
===================================================================
--- trunk/matplotlib/examples/tex_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/tex_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -23,10 +23,10 @@
s = cos(2*2*pi*t)+2
plot(t, s)
-xlabel(r'\textbf{time (s)}', markup='tex')
-ylabel(r'\textit{voltage (mV)}',fontsize=16, markup='tex')
+xlabel(r'\textbf{time (s)}')
+ylabel(r'\textit{voltage (mV)}',fontsize=16)
title(r"\TeX\ is Number
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
- fontsize=16, color='r', markup='tex')
+ fontsize=16, color='r')
grid(True)
savefig('tex_demo')
Modified: trunk/matplotlib/examples/tex_unicode_demo.py
===================================================================
--- trunk/matplotlib/examples/tex_unicode_demo.py 2007-08-30 13:51:10 UTC
(rev 3756)
+++ trunk/matplotlib/examples/tex_unicode_demo.py 2007-08-30 15:11:23 UTC
(rev 3757)
@@ -17,11 +17,11 @@
s = cos(2*2*pi*t)+2
plot(t, s)
-xlabel(r'\textbf{time (s)}', markup='tex')
+xlabel(r'\textbf{time (s)}')
s = unicode(r'\textit{Velocity (\xB0/sec)}','latin-1')
-ylabel(unicode(r'\textit{Velocity (\xB0/sec)}','latin-1'),fontsize=16,
markup='tex')
+ylabel(unicode(r'\textit{Velocity (\xB0/sec)}','latin-1'),fontsize=16)
title(r"\TeX\ is Number
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
- fontsize=16, color='r', markup='tex')
+ fontsize=16, color='r')
grid(True)
savefig('tex_demo')
Modified: trunk/matplotlib/examples/unicode_demo.py
===================================================================
--- trunk/matplotlib/examples/unicode_demo.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/examples/unicode_demo.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -9,5 +9,5 @@
text( 0.5, 2.5, unicode('Institut f\xFCr Festk\xF6rperphysik', 'latin-1'),
rotation=45)
text( 1, 1.5, u'AVA (check kerning)')
-savefig('test.svg')
+savefig('test')
show()
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-08-30 13:51:10 UTC
(rev 3756)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-08-30 15:11:23 UTC
(rev 3757)
@@ -153,7 +153,6 @@
class text(TConfig):
color = T.Trait('black',mplT.ColorHandler())
usetex = T.false
- markup = T.Trait('plain', 'plain', 'tex')
class latex(TConfig):
unicode = T.false
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-08-30 13:51:10 UTC
(rev 3756)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-08-30 15:11:23 UTC
(rev 3757)
@@ -203,11 +203,6 @@
parse_fontconfig_pattern(s)
return s
-validate_markup = ValidateInStrings(
- 'markup',
- ['plain', 'tex'],
- ignorecase=True)
-
validate_verbose = ValidateInStrings('verbose',[
'silent', 'helpful', 'debug', 'debug-annoying',
])
@@ -363,7 +358,6 @@
'text.fontvariant' : ['normal', str],
'text.fontweight' : ['normal', str],
'text.fontsize' : ['medium', validate_fontsize],
- 'text.markup' : ['plain', validate_markup],
'mathtext.cal' : ['cursive', validate_font_properties],
'mathtext.rm' : ['serif', validate_font_properties],
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -123,8 +123,7 @@
handletextsep = None, # the space between the legend line and
legend text
axespad = None, # the border between the axes and
legend edge
- shadow = None,
- markup = None
+ shadow = None
):
"""
parent # the artist that contains the legend
@@ -204,7 +203,7 @@
else:
self._xdata = npy.linspace(left, left + self.handlelen,
self.numpoints)
textleft = left+ self.handlelen+self.handletextsep
- self.texts = self._get_texts(labels, textleft, top, markup)
+ self.texts = self._get_texts(labels, textleft, top)
self.legendHandles = self._get_handles(handles, self.texts)
@@ -405,7 +404,7 @@
'return a list of text.Text instance in the legend'
return silent_list('Text', self.texts)
- def _get_texts(self, labels, left, upper, markup):
+ def _get_texts(self, labels, left, upper):
# height in axes coords
HEIGHT = self._approx_text_height()
@@ -419,8 +418,7 @@
text=l,
fontproperties=self.prop,
verticalalignment='top',
- horizontalalignment='left',
- markup=markup
+ horizontalalignment='left'
)
self._set_artist_props(text)
ret.append(text)
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -1982,7 +1982,7 @@
math_delim =(~bslash
+ Literal('$'))
- non_math = Regex(r"(?:[^$]|(?:\\\$))*"
+ non_math = Regex(r"(?:(?:\\[$])|[^$])*"
).setParseAction(self.non_math).setName("non_math").leaveWhitespace()
self._expression << (
@@ -2056,7 +2056,8 @@
def non_math(self, s, loc, toks):
#~ print "non_math", toks
- symbols = [Char(c, self.get_state()) for c in toks[0]]
+ s = toks[0].replace(r'\$', '$')
+ symbols = [Char(c, self.get_state()) for c in s]
hlist = Hlist(symbols)
# We're going into math now, so set font to 'it'
self.push_state()
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -173,14 +173,12 @@
self.labelpos = kw.pop('labelpos', 'N')
self.labelcolor = kw.pop('labelcolor', None)
self.fontproperties = kw.pop('fontproperties', dict())
- self.markup = kw.pop('markup', None)
self.kw = kw
_fp = self.fontproperties
self.text = text.Text(text=label,
horizontalalignment=self.halign[self.labelpos],
verticalalignment=self.valign[self.labelpos],
- fontproperties=font_manager.FontProperties(**_fp),
- markup=self.markup)
+ fontproperties=font_manager.FontProperties(**_fp))
if self.labelcolor is not None:
self.text.set_color(self.labelcolor)
self._initialized = False
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -203,11 +203,6 @@
parse_fontconfig_pattern(s)
return s
-validate_markup = ValidateInStrings(
- 'markup',
- ['plain', 'tex'],
- ignorecase=True)
-
validate_verbose = ValidateInStrings('verbose',[
'silent', 'helpful', 'debug', 'debug-annoying',
])
@@ -363,7 +358,6 @@
'text.fontvariant' : ['normal', str],
'text.fontweight' : ['normal', str],
'text.fontsize' : ['medium', validate_fontsize],
- 'text.markup' : ['plain', validate_markup],
'mathtext.cal' : ['cursive', validate_font_properties],
'mathtext.rm' : ['serif', validate_font_properties],
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/table.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -47,8 +47,7 @@
fill=True,
text='',
loc=None,
- fontproperties=None,
- markup=None
+ fontproperties=None
):
# Call base
@@ -61,7 +60,7 @@
if loc is None: loc = 'right'
self._loc = loc
self._text = Text(x=xy[0], y=xy[1], text=text,
- fontproperties=fontproperties, markup=markup)
+ fontproperties=fontproperties)
self._text.set_clip_on(False)
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2007-08-30 13:51:10 UTC (rev
3756)
+++ trunk/matplotlib/lib/matplotlib/text.py 2007-08-30 15:11:23 UTC (rev
3757)
@@ -146,7 +146,6 @@
fontproperties=None, # defaults to FontProperties()
rotation=None,
linespacing=None,
- markup=None,
**kwargs
):
"""
@@ -176,7 +175,6 @@
if linespacing is None:
linespacing = 1.2 # Maybe use rcParam later.
self._linespacing = linespacing
- self.set_markup(markup)
self.update(kwargs)
#self.set_bbox(dict(pad=0))
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -225,7 +223,6 @@
self._rotation = other._rotation
self._picker = other._picker
self._linespacing = other._linespacing
- self._markup = other._markup
def _get_layout(self, renderer):
@@ -757,9 +754,14 @@
def is_math_text(self):
if rcParams['text.usetex']: return 'TeX'
- if self._markup.lower() == 'tex':
- if not matplotlib._havemath: return False
+
+ # Did we find an even number of non-escaped dollar signs?
+ # If so, treat is as math text.
+ s = self._text
+ dollar_count = s.count(r'$') - s.count(r'\$')
+ if dollar_count > 0 and dollar_count % 2 == 0:
return True
+
return False
def set_fontproperties(self, fp):
@@ -770,20 +772,6 @@
"""
self._fontproperties = fp
- def set_markup(self, markup):
- """
- Set the type of markup used for this text.
-
- ACCEPTS: 'plain' for plain text, 'tex' for TeX-like markup
- None to use the default text.markup value.
- """
- if markup is None:
- self._markup = rcParams['text.markup']
- elif markup.lower() in ('plain', 'tex'):
- self._markup = markup.lower()
- else:
- raise ValueError("Markup type must be 'plain' or 'tex'")
-
def _get_layout_super(self, renderer, m):
"""
a special case optimization if a log super and angle = 0
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins