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

Function test_composite_image

lib/matplotlib/tests/test_backend_pdf.py:81–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79
80
81def test_composite_image():
82 # Test that figures can be saved with and without combining multiple images
83 # (on a single set of axes) into a single composite image.
84 X, Y = np.meshgrid(np.arange(-5, 5, 1), np.arange(-5, 5, 1))
85 Z = np.sin(Y ** 2)
86 fig, ax = plt.subplots()
87 ax.set_xlim(0, 3)
88 ax.imshow(Z, extent=[0, 1, 0, 1])
89 ax.imshow(Z[::-1], extent=[2, 3, 0, 1])
90 plt.rcParams['image.composite_image'] = True
91 with PdfPages(io.BytesIO()) as pdf:
92 fig.savefig(pdf, format="pdf")
93 assert len(pdf._file._images) == 1
94 plt.rcParams['image.composite_image'] = False
95 with PdfPages(io.BytesIO()) as pdf:
96 fig.savefig(pdf, format="pdf")
97 assert len(pdf._file._images) == 2
98
99
100def test_indexed_image():

Callers

nothing calls this directly

Calls 5

PdfPagesClass · 0.90
imshowMethod · 0.80
subplotsMethod · 0.45
set_xlimMethod · 0.45
savefigMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…