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

Function correct_roundoff

lib/matplotlib/animation.py:56–62  ·  view source on GitHub ↗
(x, dpi, n)

Source from the content-addressed store, hash-verified

54 # this maybe simplified if / when we adopt consistent rounding for
55 # pixel size across the whole library
56 def correct_roundoff(x, dpi, n):
57 if int(x*dpi) % n != 0:
58 if int(np.nextafter(x, np.inf)*dpi) % n == 0:
59 x = np.nextafter(x, np.inf)
60 elif int(np.nextafter(x, -np.inf)*dpi) % n == 0:
61 x = np.nextafter(x, -np.inf)
62 return x
63
64 wnew = int(w * dpi / n) * n / dpi
65 hnew = int(h * dpi / n) * n / dpi

Callers 1

adjusted_figsizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…