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

Skip to content

Commit e12a16e

Browse files
committed
revert to OO interface (no pyplot) in OO example
1 parent 5c54d8f commit e12a16e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/api/agg_oo.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
77
from matplotlib.figure import Figure
88

9-
fig, ax = plt.subplots()
9+
fig = Figure()
10+
canvas = FigureCanvas(fig)
11+
ax = fig.add_subplot(111)
1012
ax.plot([1,2,3])
1113
ax.set_title('hi mom')
1214
ax.grid(True)
1315
ax.set_xlabel('time')
1416
ax.set_ylabel('volts')
15-
fig.canvas.print_figure('test')
17+
canvas.print_figure('test')

0 commit comments

Comments
 (0)