report_deck

report_deck

Turn a dict of charts and tables into a titled deck or Word document in one call. Each item lands on its own slide, sized to the template’s content placeholder.

Functions

Name Description
report_deck Build a slide deck from a dict of plots and tables in one call.
title_slide The opening title slide on the template’s title layout, or a heading in Word.

report_deck

report_deck.report_deck(
    items,
    path=None,
    format='pptx',
    title=None,
    template=None,
    style='elevated',
)

Build a slide deck from a dict of plots and tables in one call.

Turns a dict of charts / data frames into a titled-slide deck (or Word document) and saves it. Keys become slide titles; each item lands on its own slide, sized to the template’s content placeholder. Every chart is rendered at the exact size of that placeholder, and plot_bars() draws bars to a constant thickness whatever the category count, so the deck reads consistently as you flick through it. For a deck built a slide at a time, with section dividers and per-slide control over the layout, use report_new() and the report_add_*() family instead.

Parameters

Name Type Description Default
items dict Keys become slide titles. Each value is a chart (added as a plot) or a data frame (added as a table). required
path str Output file path. None (default) writes report.pptx / report.docx. A bare file name lands in ezrsurvey-outputs/ (created on demand); a path naming a directory (“./x.pptx”, “charts/x.pptx”, anything absolute) is used exactly as given. See the output_dir option. None
format str “pptx” (default) or “docx”. 'pptx'
title str Title-slide / document-title text. None
template str Reference document; None (default) uses the brand template registered by use_brand(), see report_new(). None
style str Built-in template to fall back on: “elevated” (default, the styled deck) or “plain” (undecorated white). 'elevated'

Returns

Name Type Description
str The path written.

See Also

report_new, use_brand

Examples

>>> import tempfile, os
>>> path = os.path.join(tempfile.mkdtemp(), "deck.pptx")
>>> report_deck({
...     "Gender": plot_bars(calc_percentage(podracing_survey, "demo_gender")),
...     "NPS": calc_nps(podracing_survey, "nps_value"),
... }, path=path)

title_slide

report_deck.title_slide(doc, title, format)

The opening title slide on the template’s title layout, or a heading in Word.