View source: R/body_add_chart.R
body_add_chart | R Documentation |
add a ms_chart
into an rdocx object, the graphic will be
inserted in an empty paragraph.
body_add_chart(x, chart, style = NULL, pos = "after", width = 5, height = 3)
x |
an rdocx object |
chart |
an |
style |
paragraph style |
pos |
where to add the new element relative to the cursor, one of "after", "before", "on". |
height, width |
height and width in inches. |
library(officer) my_barchart <- ms_barchart(data = browser_data, x = "browser", y = "value", group = "serie") my_barchart <- chart_settings( my_barchart, grouping = "stacked", gap_width = 50, overlap = 100 ) doc <- read_docx() doc <- body_add_chart(doc, chart = my_barchart, style = "centered") print(doc, target = tempfile(fileext = ".docx"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.