mschart (version 0.2.4)

ph_with_chart: add chart into a PowerPoint slide

Description

add a chart as a new shape in the current slide. These functions will be deprecated in the next release and function ph_with.ms_chart should be used instead.#' @param x an rpptx object

Usage

ph_with_chart(x, chart, type = "body", index = 1)

ph_with_chart_at(x, chart, left, top, width, height)

Arguments

x

a pptx device

chart

ms_chart object

type

placeholder type

index

placeholder index (integer). This is to be used when a placeholder type is not unique in the current slide, e.g. two placeholders with type 'body'.

left, top

location of chart on the slide

height, width

Height and width in inches.

Examples

Run this code
# NOT RUN {
my_barchart <- ms_barchart(data = browser_data,
  x = "browser", y = "value", group = "serie")
my_barchart <- chart_settings( x = my_barchart,
  dir="vertical", grouping="clustered", gap_width = 50 )
my_barchart <- chart_ax_x( x= my_barchart,
  cross_between = 'between', major_tick_mark="out")
my_barchart <- chart_ax_y( x= my_barchart,
  cross_between = "midCat", major_tick_mark="in")

# }
# NOT RUN {
library(officer)
doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with_chart(doc, chart = my_barchart)

fileout <- tempfile(fileext = ".pptx")
print(doc, target = fileout)
# }

Run the code above in your browser using DataLab