W3cubDocs

/Matplotlib 3.1

matplotlib.axis.YAxis.set_snap

YAxis.set_snap(self, snap)

Set the snapping behavior.

Snapping aligns positions with the pixel grid, which results in clearer images. For example, if a black line of 1px width was defined at a position in between two pixels, the resulting image would contain the interpolated value of that line in the pixel grid, which would be a grey value on both adjacent pixel positions. In contrast, snapping will move the line to the nearest integer pixel value, so that the resulting image will really contain a 1px wide black line.

Snapping is currently only supported by the Agg and MacOSX backends.

Parameters:
snap : bool or None

Possible values:

  • True: Snap vertices to the nearest pixel center.
  • False: Do not modify vertex positions.
  • None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center.

© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.axis.YAxis.set_snap.html