Commit 380c531
committed
Attach a FigureCanvasBase by default to Figures.
This is particularly useful for headless cases, where one just wants to
take advantage of `print_figure`, which is defined on the base class.
For example, one can now do
for <loop>:
figure = Figure()
# do some plotting
figure.savefig(...)
and let `figure` get gc'd at the next loop iteration; a pyplot-based
solution would instead have to explicitly close() the figure or reuse it
after clf()'ing it.
Also simplifies various places in the codebase where we had to handle
the case of `.canvas = None` previously.1 parent 166d638 commit 380c531
4 files changed
Lines changed: 17 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | | - | |
453 | | - | |
454 | | - | |
| 452 | + | |
455 | 453 | | |
456 | 454 | | |
457 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3241 | 3241 | | |
3242 | 3242 | | |
3243 | 3243 | | |
3244 | | - | |
3245 | | - | |
| 3244 | + | |
3246 | 3245 | | |
3247 | 3246 | | |
3248 | 3247 | | |
| |||
3630 | 3629 | | |
3631 | 3630 | | |
3632 | 3631 | | |
3633 | | - | |
3634 | | - | |
| 3632 | + | |
3635 | 3633 | | |
3636 | 3634 | | |
3637 | 3635 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
367 | | - | |
| 368 | + | |
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| |||
398 | 399 | | |
399 | 400 | | |
400 | 401 | | |
401 | | - | |
402 | | - | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
656 | | - | |
| 655 | + | |
657 | 656 | | |
658 | 657 | | |
659 | 658 | | |
| |||
711 | 710 | | |
712 | 711 | | |
713 | 712 | | |
714 | | - | |
715 | | - | |
| 713 | + | |
716 | 714 | | |
717 | 715 | | |
718 | 716 | | |
| |||
770 | 768 | | |
771 | 769 | | |
772 | 770 | | |
773 | | - | |
774 | | - | |
| 771 | + | |
775 | 772 | | |
776 | 773 | | |
777 | 774 | | |
| |||
1070 | 1067 | | |
1071 | 1068 | | |
1072 | 1069 | | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1084 | 1078 | | |
1085 | 1079 | | |
1086 | 1080 | | |
| |||
0 commit comments