View source: R/class-workbook-wrappers.R
wb_add_mschart | R Documentation |
Add mschart object to a worksheet
wb_add_mschart(
wb,
sheet = current_sheet(),
dims = NULL,
graph,
col_offset = 0,
row_offset = 0,
...
)
wb |
a workbook |
sheet |
the sheet on which the graph will appear |
dims |
the dimensions where the sheet will appear |
graph |
mschart object |
col_offset , row_offset |
offsets for column and row |
... |
additional arguments |
wb_data()
wb_add_chart_xml()
wb_add_image wb_add_mschart()
wb_add_plot
if (requireNamespace("mschart")) {
require(mschart)
## Add mschart to worksheet (adds data and chart)
scatter <- ms_scatterchart(data = iris, x = "Sepal.Length", y = "Sepal.Width", group = "Species")
scatter <- chart_settings(scatter, scatterstyle = "marker")
wb <- wb_workbook() %>%
wb_add_worksheet() %>%
wb_add_mschart(dims = "F4:L20", graph = scatter)
## Add mschart to worksheet and use available data
wb <- wb_workbook() %>%
wb_add_worksheet() %>%
wb_add_data(x = mtcars, dims = "B2")
# create wb_data object
dat <- wb_data(wb, 1, dims = "B2:E6")
# call ms_scatterplot
data_plot <- ms_scatterchart(
data = dat,
x = "mpg",
y = c("disp", "hp"),
labels = c("disp", "hp")
)
# add the scatterplot to the data
wb <- wb %>%
wb_add_mschart(dims = "F4:L20", graph = data_plot)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.