MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / draw_shape

Method draw_shape

site-packages/matplotlib/widgets.py:2311–2330  ·  view source on GitHub ↗
(self, extents)

Source from the content-addressed store, hash-verified

2309 self.update()
2310
2311 def draw_shape(self, extents):
2312 x0, x1, y0, y1 = extents
2313 xmin, xmax = sorted([x0, x1])
2314 ymin, ymax = sorted([y0, y1])
2315 xlim = sorted(self.ax.get_xlim())
2316 ylim = sorted(self.ax.get_ylim())
2317
2318 xmin = max(xlim[0], xmin)
2319 ymin = max(ylim[0], ymin)
2320 xmax = min(xmax, xlim[1])
2321 ymax = min(ymax, ylim[1])
2322
2323 if self.drawtype == 'box':
2324 self.to_draw.set_x(xmin)
2325 self.to_draw.set_y(ymin)
2326 self.to_draw.set_width(xmax - xmin)
2327 self.to_draw.set_height(ymax - ymin)
2328
2329 elif self.drawtype == 'line':
2330 self.to_draw.set_data([xmin, xmax], [ymin, ymax])
2331
2332 def _set_active_handle(self, event):
2333 """Set active handle based on the location of the mouse event"""

Callers 1

extentsMethod · 0.95

Calls 9

maxFunction · 0.85
minFunction · 0.85
get_xlimMethod · 0.80
get_ylimMethod · 0.80
set_xMethod · 0.45
set_yMethod · 0.45
set_widthMethod · 0.45
set_heightMethod · 0.45
set_dataMethod · 0.45

Tested by

no test coverage detected