Replicating Microsoft Office PowerPoint graphs in knitted R Markdown report

Hello! Do you have any tips on replicating PowerPoint graphs through R Markdown? I’m trying to automate a disease surveillance report, which is currently designed using PowerPoint. I’ve tried using ggplot but the graphs are not how I want them to be.

Maybe there’s a package I can use for this?

Hey @jeuyang ,

I havent tried this on my own, but there is a couple of alternatives to ggplot plots that have the Power Point native style.

You could try {officer} + {mschart} (and optionally {officedown} for Rmd integration).
{mschart} builds native Office charts (bar/line/area/etc.) that inherit the PPT theme, fonts, and colors from your slide master/template. Plus, they are editable after knitting.

{mschart}: Chart Generation for Microsoft Word and Microsoft PowerPoint Documents • mschart

Here is a example implementation:

# toy data
df <- tibble(week = paste0("W", 1:10),
             cases = c(5,7,8,6,9,12,10,11,14,13))

# mschart (inherits theme from template.pptx)
ch <- ms_barchart(data = df, x = "week", y = "cases") |>
  chart_settings(
    grouping = "clustered",
    gap_width = 150
  ) |>
  value_axis(num_fmt = "0") |>
  category_axis(tick_lbl_pos = "nextTo")

# Add to current slide (officedown handles the doc object)
officer::ph_with(value = ch, location = officer::ph_location_fullsize())

Pros: matches PPT look exactly (theme, fonts, colors), and is fully editable in PowerPoint.

Cons: limited to chart types that Office supports and styling is done with chart_*() functions (less flexible than ggplot).

Let me know if this helps,

Luis