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

Method format_coord

lib/matplotlib/axes/_base.py:4256–4271  ·  view source on GitHub ↗

Return a format string formatting the *x*, *y* coordinates.

(self, x, y)

Source from the content-addressed store, hash-verified

4254 else self.yaxis.get_major_formatter().format_data_short)(y)
4255
4256 def format_coord(self, x, y):
4257 """Return a format string formatting the *x*, *y* coordinates."""
4258 twins = self._twinned_axes.get_siblings(self)
4259 if len(twins) == 1:
4260 return "(x, y) = ({}, {})".format(
4261 "???" if x is None else self.format_xdata(x),
4262 "???" if y is None else self.format_ydata(y))
4263 screen_xy = self.transData.transform((x, y))
4264 xy_strs = []
4265 # Retrieve twins in the order of self.figure.axes to sort tied zorders (which is
4266 # the common case) by the order in which they are added to the figure.
4267 for ax in sorted(twins, key=attrgetter("zorder")):
4268 data_x, data_y = ax.transData.inverted().transform(screen_xy)
4269 xy_strs.append(
4270 "({}, {})".format(ax.format_xdata(data_x), ax.format_ydata(data_y)))
4271 return "(x, y) = {}".format(" | ".join(xy_strs))
4272
4273 def minorticks_on(self):
4274 """

Callers 5

test_cursor_precisionFunction · 0.45
test_custom_fmt_dataFunction · 0.45

Calls 6

format_xdataMethod · 0.95
format_ydataMethod · 0.95
joinMethod · 0.80
get_siblingsMethod · 0.45
transformMethod · 0.45
invertedMethod · 0.45

Tested by 4

test_cursor_precisionFunction · 0.36
test_custom_fmt_dataFunction · 0.36