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

Function test_pdf_pages

lib/matplotlib/tests/test_backend_pgf.py:220–252  ·  view source on GitHub ↗
(system)

Source from the content-addressed store, hash-verified

218 pytest.param('xelatex', marks=[needs_pgf_xelatex]),
219])
220def test_pdf_pages(system):
221 rc_pdflatex = {
222 'font.family': 'serif',
223 'pgf.rcfonts': False,
224 'pgf.texsystem': system,
225 }
226 mpl.rcParams.update(rc_pdflatex)
227
228 fig1, ax1 = plt.subplots()
229 ax1.plot(range(5))
230 fig1.tight_layout()
231
232 fig2, ax2 = plt.subplots(figsize=(3, 2))
233 ax2.plot(range(5))
234 fig2.tight_layout()
235
236 path = os.path.join(result_dir, f'pdfpages_{system}.pdf')
237 md = {
238 'Author': 'me',
239 'Title': 'Multipage PDF with pgf',
240 'Subject': 'Test page',
241 'Keywords': 'test,pdf,multipage',
242 'ModDate': datetime.datetime(
243 1968, 8, 1, tzinfo=datetime.timezone(datetime.timedelta(0))),
244 'Trapped': 'Unknown'
245 }
246
247 with PdfPages(path, metadata=md) as pdf:
248 pdf.savefig(fig1)
249 pdf.savefig(fig2)
250 pdf.savefig(fig1)
251
252 assert pdf.get_pagecount() == 3
253
254
255@mpl.style.context('default')

Callers

nothing calls this directly

Calls 8

PdfPagesClass · 0.90
joinMethod · 0.80
updateMethod · 0.45
subplotsMethod · 0.45
plotMethod · 0.45
tight_layoutMethod · 0.45
savefigMethod · 0.45
get_pagecountMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…