Shows the current context figure in the output area. Parameters ---------- key : hashable, optional Any variable that can be used as a key for a dictionary. display_toolbar: bool (default: True) If True, a toolbar for different mouse interaction is displayed with
(key=None, display_toolbar=True)
| 81 | |
| 82 | |
| 83 | def show(key=None, display_toolbar=True): |
| 84 | """Shows the current context figure in the output area. |
| 85 | |
| 86 | Parameters |
| 87 | ---------- |
| 88 | |
| 89 | key : hashable, optional |
| 90 | Any variable that can be used as a key for a dictionary. |
| 91 | display_toolbar: bool (default: True) |
| 92 | If True, a toolbar for different mouse interaction is displayed with |
| 93 | the figure. |
| 94 | |
| 95 | Raises |
| 96 | ------ |
| 97 | |
| 98 | KeyError |
| 99 | When no context figure is associated with the provided key. |
| 100 | |
| 101 | Examples |
| 102 | -------- |
| 103 | |
| 104 | >>> import numpy as np |
| 105 | >>> import pyplot as plt |
| 106 | >>> n = 100 |
| 107 | >>> x = np.arange(n) |
| 108 | >>> y = np.cumsum(np.random.randn(n)) |
| 109 | >>> plt.plot(x,y) |
| 110 | >>> plt.show() |
| 111 | |
| 112 | """ |
| 113 | if key is None: |
| 114 | figure = current_figure() |
| 115 | else: |
| 116 | figure = _context['figure_registry'][key] |
| 117 | figure.display_toolbar = display_toolbar |
| 118 | display(figure) |
| 119 | |
| 120 | |
| 121 | def figure(key=None, fig=None, **kwargs): |
nothing calls this directly
no test coverage detected
searching dependent graphs…