Skip to content

Commit 999d69d

Browse files
committed
changed text alias
1 parent 341070a commit 999d69d

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ def get_aliases(self):
10981098
if not self.is_alias(func):
10991099
continue
11001100
docstring = func.__doc__
1101-
fullname = docstring[10:]
1101+
fullname = docstring.replace('`', '')[10:]
11021102
aliases.setdefault(fullname[4:], {})[name[4:]] = None
11031103
return aliases
11041104

lib/matplotlib/text.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ def _get_textbox(text, renderer):
107107

108108

109109
@cbook._define_aliases({
110-
"family": ["fontfamily"],
110+
"fontfamily": ["family"],
111111
"fontproperties": ["font_properties"],
112112
"horizontalalignment": ["ha"],
113113
"multialignment": ["ma"],
114-
"name": ["fontname"],
115-
"size": ["fontsize"],
116-
"stretch": ["fontstretch"],
117-
"style": ["fontstyle"],
118-
"variant": ["fontvariant"],
114+
"fontname": ["name"],
115+
"fontsize": ["size"],
116+
"fontstretch": ["stretch"],
117+
"fontstyle": ["style"],
118+
"fontvariant": ["variant"],
119119
"verticalalignment": ["va"],
120-
"weight": ["fontweight"],
120+
"fontweight": ["weight"],
121121
})
122122
class Text(Artist):
123123
"""Handle storing and drawing of text in window or data coordinates."""
@@ -764,27 +764,27 @@ def get_fontproperties(self):
764764
"Return the :class:`~font_manager.FontProperties` object"
765765
return self._fontproperties
766766

767-
def get_family(self):
767+
def get_fontfamily(self):
768768
"Return the list of font families used for font lookup"
769769
return self._fontproperties.get_family()
770770

771-
def get_name(self):
771+
def get_fontname(self):
772772
"Return the font name as string"
773773
return self._fontproperties.get_name()
774774

775-
def get_style(self):
775+
def get_fontstyle(self):
776776
"Return the font style as string"
777777
return self._fontproperties.get_style()
778778

779-
def get_size(self):
779+
def get_fontsize(self):
780780
"Return the font size as integer"
781781
return self._fontproperties.get_size_in_points()
782782

783-
def get_variant(self):
783+
def get_fontvariant(self):
784784
"Return the font variant as a string"
785785
return self._fontproperties.get_variant()
786786

787-
def get_weight(self):
787+
def get_fontweight(self):
788788
"Get the font weight as string or number"
789789
return self._fontproperties.get_weight()
790790

@@ -957,7 +957,7 @@ def set_linespacing(self, spacing):
957957
self._linespacing = spacing
958958
self.stale = True
959959

960-
def set_family(self, fontname):
960+
def set_fontfamily(self, fontname):
961961
"""
962962
Set the font family. May be either a single string, or a list of
963963
strings in decreasing priority. Each string may be either a real font
@@ -970,7 +970,7 @@ def set_family(self, fontname):
970970
self._fontproperties.set_family(fontname)
971971
self.stale = True
972972

973-
def set_variant(self, variant):
973+
def set_fontvariant(self, variant):
974974
"""
975975
Set the font variant, either 'normal' or 'small-caps'.
976976
@@ -979,7 +979,7 @@ def set_variant(self, variant):
979979
self._fontproperties.set_variant(variant)
980980
self.stale = True
981981

982-
def set_style(self, fontstyle):
982+
def set_fontstyle(self, fontstyle):
983983
"""
984984
Set the font style.
985985
@@ -988,7 +988,7 @@ def set_style(self, fontstyle):
988988
self._fontproperties.set_style(fontstyle)
989989
self.stale = True
990990

991-
def set_size(self, fontsize):
991+
def set_fontsize(self, fontsize):
992992
"""
993993
Set the font size. May be either a size string, relative to
994994
the default font size, or an absolute font size in points.
@@ -999,7 +999,7 @@ def set_size(self, fontsize):
999999
self._fontproperties.set_size(fontsize)
10001000
self.stale = True
10011001

1002-
def set_weight(self, weight):
1002+
def set_fontweight(self, weight):
10031003
"""
10041004
Set the font weight.
10051005
@@ -1011,7 +1011,7 @@ def set_weight(self, weight):
10111011
self._fontproperties.set_weight(weight)
10121012
self.stale = True
10131013

1014-
def set_stretch(self, stretch):
1014+
def set_fontstretch(self, stretch):
10151015
"""
10161016
Set the font stretch (horizontal condensation or expansion).
10171017
@@ -1152,8 +1152,12 @@ def get_usetex(self):
11521152
else:
11531153
return self._usetex
11541154

1155-
def set_name(self, fontname): # One-way alias only: the getter differs.
1156-
"""alias for set_family"""
1155+
def set_fontname(self, fontname):
1156+
"""
1157+
alias for set_family
1158+
1159+
One-way alias only: the getter differs.
1160+
"""
11571161
return self.set_family(fontname)
11581162

11591163

0 commit comments

Comments
 (0)