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

Function test_rgba_clean_edges

lib/matplotlib/tests/test_image.py:2003–2029  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2001
2002@image_comparison(['rgba_clean_edges.png'], style='_classic_test', tol=0.003)
2003def test_rgba_clean_edges():
2004 np.random.seed(19680801+9) # same as in test_upsampling()
2005 data = np.random.rand(8, 8)
2006 data = np.stack([data, data])
2007 data[1, 2:4, 2:4] = np.nan
2008
2009 rotation = Affine2D().rotate_around(3.5, 3.5, 1)
2010
2011 fig, axs = plt.subplots(1, 2)
2012
2013 for i in range(2):
2014 # Add background patches to check the fading to non-white colors
2015 black = Rectangle((3.75, 2), 5, 5, color='black', zorder=0)
2016 gray = Rectangle((0, -2), 3.75, 4, color='gray', zorder=0)
2017 partly_black = Rectangle((3.75, -2), 5, 4, fc='black', ec='none',
2018 alpha=0.5, zorder=0)
2019 axs[i].add_patch(black)
2020 axs[i].add_patch(gray)
2021 axs[i].add_patch(partly_black)
2022
2023 axs[i].imshow(data[i, ...],
2024 interpolation='bilinear', interpolation_stage='rgba',
2025 transform=rotation + axs[i].transData)
2026
2027 axs[i].set_axis_off()
2028 axs[i].set_xlim(-2.5, 9.5)
2029 axs[i].set_ylim(-2.5, 9.5)
2030
2031
2032@image_comparison(['affine_fill_to_edges.png'], style='_classic_test')

Callers

nothing calls this directly

Calls 9

Affine2DClass · 0.90
RectangleClass · 0.90
rotate_aroundMethod · 0.80
add_patchMethod · 0.80
imshowMethod · 0.80
subplotsMethod · 0.45
set_axis_offMethod · 0.45
set_xlimMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…