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

Skip to content

Commit f5fff32

Browse files
committed
added missing symbols to mathtext
svn path=/trunk/matplotlib/; revision=887
1 parent c9cbc00 commit f5fff32

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

CHANGELOG

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
New entries should be added at the top
22

3+
2005-01-27 Added Lee's patch for missing symbols \leq and \LEFTbracket
4+
to _mathtext_data - JDH
5+
6+
2005-01-26 Added Baptiste's two scales patch -- see help(twin) in the
7+
pylab interface for more info. See also
8+
examples/two_scales.py
9+
10+
2005-01-24 Fixed a mathtext parser bug that prevented font changes in
11+
sub/superscripts - JDH
312

413
2005-01-24 Fixed contour wto work w/ interactive changes in colormaps,
514
clim, etc - JDH

lib/matplotlib/_mathtext_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
r'\Rightparen' : ('cmex10', 81),
5050
r'\LEFTparen' : ('cmex10', 119),
5151
r'\RIGHTparen' : ('cmex10', 87),
52+
r'\LEFTbracket' : ('cmex10', 125),
5253
r'\RIGHTbracket' : ('cmex10', 93),
5354
r'\LEFTbrace' : ('cmex10', 70),
5455
r'\RIGHTbrace' : ('cmex10', 107),
@@ -236,6 +237,7 @@
236237
r'\equiv' : ('cmsy10', 35),
237238
r'\subseteq' : ('cmsy10', 103),
238239
r'\supseteq' : ('cmsy10', 42),
240+
r'\leq' : ('cmsy10', 14),
239241
r'\geq' : ('cmsy10', 29),
240242
r'\preceq' : ('cmsy10', 79),
241243
r'\succeq' : ('cmsy10', 131),

lib/matplotlib/mathtext.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -956,25 +956,30 @@ def subsuperscript(self, s, loc, toks):
956956
superscript = Forward().setParseAction(handler.superscript).setName("superscript")
957957
subsuperscript = Forward().setParseAction(handler.subsuperscript).setName("subsuperscript")
958958

959+
font = Forward().setParseAction(handler.font).setName("font")
959960

960-
group = Group( lbrace + OneOrMore(symbol^subscript^superscript^subsuperscript^space) + rbrace).setParseAction(handler.group).setName("group")
961+
962+
group = Group( lbrace + OneOrMore(symbol^subscript^superscript^subsuperscript^space^font) + rbrace).setParseAction(handler.group).setName("group")
961963
#~ group = Group( lbrace + OneOrMore(subsuperscript | subscript | superscript | symbol | space ) + rbrace).setParseAction(handler.group).setName("group")
962964

963965
#composite = Group( Combine(bslash + composite) + lbrace + symbol + rbrace + lbrace + symbol + rbrace).setParseAction(handler.composite).setName("composite")
964966
#~ composite = Group( Combine(bslash + composite) + group + group).setParseAction(handler.composite).setName("composite")
965967
composite = Group( Combine(bslash + overUnder) + group + group).setParseAction(handler.composite).setName("composite")
966968

969+
970+
967971
accent = Group( Combine(bslash + accent) + Optional(lbrace) + symbol + Optional(rbrace)).setParseAction(handler.accent).setName("accent")
968972

969-
#~ symgroup = symbol ^ group
970-
symgroup = symbol | group
973+
974+
symgroup = font ^ group ^ symbol
971975

972976
subscript << Group( Optional(symgroup) + Literal('_') + symgroup )
973977
superscript << Group( Optional(symgroup) + Literal('^') + symgroup )
974978
subsuperscript << Group( symgroup + Literal('_') + symgroup + Literal('^') + symgroup )
975979

980+
font << Group( Combine(bslash + fontname) + group)
981+
976982

977-
font = Group( Combine(bslash + fontname) + group).setParseAction(handler.font).setName("font")
978983

979984
expression = OneOrMore(
980985
space ^ font ^ accent ^ symbol ^ subscript ^ superscript ^ subsuperscript ^ group ^ composite ).setParseAction(handler.expression).setName("expression")

lib/matplotlib/pylab.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ def imread(*args, **kwargs):
892892
imread.__doc__ = _imread.__doc__
893893

894894

895-
def load(fname):
895+
def load(fname,comments='%'):
896896
"""
897897
Load ASCII data from fname into an array and return the array.
898898
@@ -911,6 +911,9 @@ def load(fname):
911911
912912
x = load('test.dat') # a single column of data
913913
914+
comments is the character used to indicate the start of a comment
915+
in the file
916+
914917
"""
915918

916919
if is_string_like(fname):
@@ -919,16 +922,16 @@ def load(fname):
919922
fh = fname
920923
else:
921924
raise ValueError('fname must be a string or file handle')
922-
923-
X = []
925+
X = []
924926
numCols = None
925927
for line in fh:
926-
line = line[:line.find('%')].strip()
928+
line = line[:line.find(comments)].strip()
927929
if not len(line): continue
928930
row = [float(val) for val in line.split()]
929931
thisLen = len(row)
930932
if numCols is not None and thisLen != numCols:
931-
raise ValueError('All rows must have the same number of columns')
933+
raise ValueError('All rows must have the same number of
934+
columns')
932935
X.append(row)
933936

934937
X = array(X)

0 commit comments

Comments
 (0)