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

Skip to content

Commit 45ad5c8

Browse files
committed
MNT: tweaks to legend / score box
Pass all properties into legend method.
1 parent 4aca98f commit 45ad5c8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

examples/event_handling/pipong.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import numpy as np
1414
import matplotlib.pyplot as plt
1515
from numpy.random import randn, randint
16+
from matplotlib.font_manager import FontProperties
1617

1718
instructions = """
1819
Player A: Player B:
@@ -216,12 +217,11 @@ def draw(self, evt):
216217
" " + str(self.pads[0].score))
217218
self.pads[1].disp.set_label(
218219
" " + str(self.pads[1].score))
219-
self.ax.legend(loc='center')
220-
self.leg = self.ax.get_legend()
221-
self.leg.get_frame().set_alpha(.2)
222-
plt.setp(self.leg.get_texts(), fontweight='bold',
223-
fontsize='xx-large')
224-
self.leg.get_frame().set_facecolor('0.2')
220+
self.ax.legend(loc='center', framealpha=.2,
221+
facecolor='0.5',
222+
prop=FontProperties(size='xx-large',
223+
weight='bold'))
224+
225225
self.background = None
226226
self.ax.figure.canvas.draw_idle()
227227
return True

0 commit comments

Comments
 (0)