Closes and unregister the context figure corresponding to the key. Parameters ---------- key: hashable Any variable that can be used as a key for a dictionary
(key)
| 173 | |
| 174 | |
| 175 | def close(key): |
| 176 | """Closes and unregister the context figure corresponding to the key. |
| 177 | |
| 178 | Parameters |
| 179 | ---------- |
| 180 | |
| 181 | key: hashable |
| 182 | Any variable that can be used as a key for a dictionary |
| 183 | |
| 184 | """ |
| 185 | figure_registry = _context['figure_registry'] |
| 186 | if key not in figure_registry: |
| 187 | return |
| 188 | if _context['figure'] == figure_registry[key]: |
| 189 | figure() |
| 190 | fig = figure_registry[key] |
| 191 | if hasattr(fig, 'pyplot'): |
| 192 | fig.pyplot.close() |
| 193 | fig.pyplot_vbox.close() |
| 194 | fig.close() |
| 195 | del figure_registry[key] |
| 196 | del _context['scale_registry'][key] |
| 197 | |
| 198 | |
| 199 | def _process_data(*kwarg_names): |