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

Function test_skew_rectangle

lib/matplotlib/tests/test_skew.py:150–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148@image_comparison(['skew_rects.png'], remove_text=True, style='_classic_test',
149 tol=0 if platform.machine() == 'x86_64' else 0.009)
150def test_skew_rectangle():
151
152 fix, axes = plt.subplots(5, 5, sharex=True, sharey=True, figsize=(8, 8))
153 axes = axes.flat
154
155 rotations = list(itertools.product([-3, -1, 0, 1, 3], repeat=2))
156
157 axes[0].set_xlim([-3, 3])
158 axes[0].set_ylim([-3, 3])
159 axes[0].set_aspect('equal', share=True)
160
161 for ax, (xrots, yrots) in zip(axes, rotations):
162 xdeg, ydeg = 45 * xrots, 45 * yrots
163 t = transforms.Affine2D().skew_deg(xdeg, ydeg)
164
165 ax.set_title(f'Skew of {xdeg} in X and {ydeg} in Y')
166 ax.add_patch(mpatch.Rectangle([-1, -1], 2, 2,
167 transform=t + ax.transData,
168 alpha=0.5, facecolor='coral'))
169
170 plt.subplots_adjust(wspace=0, left=0.01, right=0.99, bottom=0.01, top=0.99)

Callers

nothing calls this directly

Calls 8

skew_degMethod · 0.80
add_patchMethod · 0.80
subplots_adjustMethod · 0.80
subplotsMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45
set_aspectMethod · 0.45
set_titleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…