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

Skip to content

Commit d074f64

Browse files
committed
added custom figure class hook
svn path=/trunk/matplotlib/; revision=2503
1 parent d346f28 commit d074f64

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

examples/custom_figure_class.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class MyFigure(Figure):
88
def __init__(self, *args, **kwargs):
99
"""
10-
custom kwarg figtitle is passed on to
10+
custom kwarg figtitle is a figure title
1111
"""
12+
figtitle = kwargs.pop('figtitle', 'hi mom')
1213
Figure.__init__(self, *args, **kwargs)
13-
figtitle = kwargs.get('figtitle', 'hi mom')
1414
self.text(0.5, 0.95, figtitle, ha='center')
1515

16-
fig = figure(FigureClass=MyFigure)
16+
fig = figure(FigureClass=MyFigure, figtitle='my title')
1717
ax = fig.add_subplot(111)
1818
ax.plot([1,2,3])
1919
fig.savefig('test.png')

0 commit comments

Comments
 (0)