| 2667 | |
| 2668 | @_copy_docstring_and_deprecators(Figure.colorbar) |
| 2669 | def colorbar( |
| 2670 | mappable: ScalarMappable | ColorizingArtist | None = None, |
| 2671 | cax: matplotlib.axes.Axes | None = None, |
| 2672 | ax: matplotlib.axes.Axes | Iterable[matplotlib.axes.Axes] | None = None, |
| 2673 | **kwargs |
| 2674 | ) -> Colorbar: |
| 2675 | if mappable is None: |
| 2676 | mappable = gci() |
| 2677 | if mappable is None: |
| 2678 | raise RuntimeError('No mappable was found to use for colorbar ' |
| 2679 | 'creation. First define a mappable such as ' |
| 2680 | 'an image (with imshow) or a contour set (' |
| 2681 | 'with contourf).') |
| 2682 | ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kwargs) |
| 2683 | return ret |
| 2684 | |
| 2685 | |
| 2686 | def clim(vmin: float | None = None, vmax: float | None = None) -> None: |