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

Skip to content

Commit 565d614

Browse files
committed
fixed some kwarg text processing bug
svn path=/trunk/matplotlib/; revision=812
1 parent 4eb5445 commit 565d614

4 files changed

Lines changed: 28 additions & 28 deletions

File tree

API_CHANGES

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
API CHANGES in matplotlib-0.65.1
2+
3+
removed add_axes and add_subplot from backend_bases. Use
4+
figure.add_axes and add_subplot instead. The figure now manages the
5+
current axes with gca and sca for get and set current axe. If you
6+
have code you are porting which called, eg, figmanager.add_axes, you
7+
can now simply do figmanager.canvas.figure.add_axes.
8+
19
API CHANGES in matplotlib-0.65
210

3-
mpl_connect and mpl_disconnect in the matlab interface renamed to
4-
connect and disconnect
11+
mpl_connect and mpl_disconnect in the matlab interface renamed to
12+
connect and disconnect
513

6-
Did away with the text methods for angle since they were ambiguous.
7-
fontangle could mean fontstyle (obligue, etc) or the rotation of the
8-
text. Use style and rotation instead.
14+
Did away with the text methods for angle since they were ambiguous.
15+
fontangle could mean fontstyle (obligue, etc) or the rotation of the
16+
text. Use style and rotation instead.
917

1018

1119
API CHANGES in matplotlib-0.63

TODO

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
612612

613613
-- DONE add hold option to plot
614614

615-
616615
-- fix linestyle for collections
617616

618617
-- update ticklabels and range for colorbar when clim changes

lib/matplotlib/axes.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,15 +2486,16 @@ def set_title(self, label, fontdict=None, **kwargs):
24862486
24872487
ACCEPTS: str
24882488
"""
2489-
override = {
2489+
default = {
24902490
'fontsize':rcParams['axes.titlesize'],
24912491
'verticalalignment' : 'bottom',
2492-
'horizontalalignment' : 'left'
2492+
'horizontalalignment' : 'center'
24932493
}
24942494

24952495
self.title.set_text(label)
2496-
override = _process_text_args({}, fontdict, **kwargs)
2497-
self.title.update(override)
2496+
self.title.update(default)
2497+
if fontdict is not None: self.title.update(fontdict)
2498+
self.title.update(kwargs)
24982499
return self.title
24992500

25002501

@@ -2510,8 +2511,8 @@ def set_xlabel(self, xlabel, fontdict=None, **kwargs):
25102511

25112512
label = self.xaxis.get_label()
25122513
label.set_text(xlabel)
2513-
override = _process_text_args({}, fontdict, **kwargs)
2514-
label.update(override)
2514+
if fontdict is not None: label.update(fontdict)
2515+
label.update(kwargs)
25152516
return label
25162517

25172518
def _send_xlim_event(self):
@@ -2591,22 +2592,16 @@ def set_ylabel(self, ylabel, fontdict=None, **kwargs):
25912592
25922593
Set the label for the yaxis
25932594
2594-
Defaults override is
2595-
2596-
override = {
2597-
'verticalalignment' : 'center',
2598-
'horizontalalignment' : 'right',
2599-
'rotation'='vertical' : }
2600-
26012595
See the text doctstring for information of how override and
26022596
the optional args work
26032597
26042598
ACCEPTS: str
26052599
"""
26062600
label = self.yaxis.get_label()
26072601
label.set_text(ylabel)
2608-
override = _process_text_args({}, fontdict, **kwargs)
2609-
label.update(override)
2602+
2603+
if fontdict is not None: self.title.update(label)
2604+
label.update(kwargs)
26102605
return label
26112606

26122607
def set_ylim(self, v, emit=True):
@@ -2885,20 +2880,21 @@ def text(self, x, y, s, fontdict=None, **kwargs):
28852880
28862881
28872882
"""
2888-
override = {
2883+
default = {
28892884
'verticalalignment' : 'bottom',
28902885
'horizontalalignment' : 'left',
28912886
#'verticalalignment' : 'top',
28922887
'transform' : self.transData,
28932888
}
28942889

2895-
override = _process_text_args(override, fontdict, **kwargs)
28962890
t = Text(
28972891
x=x, y=y, text=s,
28982892
)
28992893
self._set_artist_props(t)
29002894

2901-
t.update(override)
2895+
t.update(default)
2896+
if fontdict is not None: t.update(fontdict)
2897+
t.update(kwargs)
29022898
self.texts.append(t)
29032899

29042900
if t.get_clip_on(): t.set_clip_box(self.bbox)

lib/matplotlib/axis.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,10 @@ def set_ticklabels(self, ticklabels, *args, **kwargs):
700700
self.set_major_formatter( FixedFormatter(ticklabels) )
701701

702702

703-
override = {}
704-
override = _process_text_args(override, *args, **kwargs)
705-
706703
ret = []
707704
for i, tick in enumerate(self.get_major_ticks()):
708705
if i<len(ticklabels): ret.append(tick.label1)
709-
tick.label1.update(override)
706+
tick.label1.update(kwargs)
710707
return ret
711708

712709
def set_ticks(self, ticks):

0 commit comments

Comments
 (0)