Get the current figure. If there is currently no figure on the pyplot figure stack, a new one is created using `~.pyplot.figure()`. (To test whether there is currently a figure on the pyplot figure stack, check whether `~.pyplot.get_fignums()` is empty.)
()
| 1147 | |
| 1148 | |
| 1149 | def gcf() -> Figure: |
| 1150 | """ |
| 1151 | Get the current figure. |
| 1152 | |
| 1153 | If there is currently no figure on the pyplot figure stack, a new one is |
| 1154 | created using `~.pyplot.figure()`. (To test whether there is currently a |
| 1155 | figure on the pyplot figure stack, check whether `~.pyplot.get_fignums()` |
| 1156 | is empty.) |
| 1157 | """ |
| 1158 | manager = _pylab_helpers.Gcf.get_active() |
| 1159 | if manager is not None: |
| 1160 | return manager.canvas.figure |
| 1161 | else: |
| 1162 | return figure() |
| 1163 | |
| 1164 | |
| 1165 | def fignum_exists(num: int | str) -> bool: |
no test coverage detected