MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _gci

Method _gci

lib/matplotlib/figure.py:1729–1760  ·  view source on GitHub ↗

Get the current colorable artist. Specifically, returns the current `.ScalarMappable` instance (`.Image` created by `imshow` or `figimage`, `.Collection` created by `pcolor` or `scatter`, etc.), or *None* if no such instance has been defined. The current im

(self)

Source from the content-addressed store, hash-verified

1727 return ax if ax is not None else self.add_subplot()
1728
1729 def _gci(self):
1730 # Helper for `~matplotlib.pyplot.gci`. Do not use elsewhere.
1731 """
1732 Get the current colorable artist.
1733
1734 Specifically, returns the current `.ScalarMappable` instance (`.Image`
1735 created by `imshow` or `figimage`, `.Collection` created by `pcolor` or
1736 `scatter`, etc.), or *None* if no such instance has been defined.
1737
1738 The current image is an attribute of the current Axes, or the nearest
1739 earlier Axes in the current figure that contains an image.
1740
1741 Notes
1742 -----
1743 Historically, the only colorable artists were images; hence the name
1744 ``gci`` (get current image).
1745 """
1746 # Look first for an image in the current Axes.
1747 ax = self._axstack.current()
1748 if ax is None:
1749 return None
1750 im = ax._gci()
1751 if im is not None:
1752 return im
1753 # If there is no image in the current Axes, search for
1754 # one in a previously created Axes. Whether this makes
1755 # sense is debatable, but it is the documented behavior.
1756 for ax in reversed(self.axes):
1757 im = ax._gci()
1758 if im is not None:
1759 return im
1760 return None
1761
1762 def _process_projection_requirements(self, *, axes_class=None, polar=False,
1763 projection=None, **kwargs):

Callers 1

gciFunction · 0.45

Calls 1

currentMethod · 0.80

Tested by

no test coverage detected