You are reading an old version of the documentation (v3.1.1). For the latest version see https://matplotlib.org/stable/
Version 3.1.2
matplotlib
Fork me on GitHub

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.