MCPcopy
hub / github.com/matplotlib/matplotlib / _set_pixel

Method _set_pixel

lib/matplotlib/markers.py:525–537  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

523 self._set_circle(size=0.5)
524
525 def _set_pixel(self):
526 self._path = Path.unit_rectangle()
527 # Ideally, you'd want -0.5, -0.5 here, but then the snapping
528 # algorithm in the Agg backend will round this to a 2x2
529 # rectangle from (-1, -1) to (1, 1). By offsetting it
530 # slightly, we can force it to be (0, 0) to (1, 1), which both
531 # makes it only be a single pixel and places it correctly
532 # aligned to 1-width stroking (i.e. the ticks). This hack is
533 # the best of a number of bad alternatives, mainly because the
534 # backends are not aware of what marker is actually being used
535 # beyond just its path data.
536 self._transform = Affine2D().translate(-0.49999, -0.49999)
537 self._snap_threshold = None
538
539 _triangle_path = Path._create_closed([[0, 1], [-1, -1], [1, -1]])
540 # Going down halfway looks to small. Golden ratio is too far.

Callers

nothing calls this directly

Calls 3

Affine2DClass · 0.85
unit_rectangleMethod · 0.80
translateMethod · 0.80

Tested by

no test coverage detected