Add mschart object to a worksheet
Usage
wb_add_mschart(
wb,
sheet = current_sheet(),
dims = NULL,
graph,
col_offset = 0,
row_offset = 0,
...
)
See also
wb_data()
wb_add_chart_xml()
wb_add_image wb_add_mschart()
wb_add_plot
Examples
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)
}
#> Loading required namespace: mschart
#> Loading required package: mschart