library(officer)
mytheme <- mschart_theme(
axis_title = fp_text(color = "red", font.size = 24, bold = TRUE),
grid_major_line_y = fp_border(width = 1, color = "orange"),
axis_ticks_y = fp_border(width = 0.4, color = "gray")
)
my_bc <- ms_barchart(
data = browser_data, x = "browser",
y = "value", group = "serie"
)
my_bc <- chart_settings(my_bc,
dir = "horizontal", grouping = "stacked",
gap_width = 150, overlap = 100
)
my_bc <- set_theme(my_bc, mytheme)
my_bc_2 <- ms_barchart(
data = browser_data, x = "browser",
y = "value", group = "serie"
)
my_bc_2 <- chart_theme(my_bc_2,
grid_major_line_y = fp_border(width = 0.5, color = "cyan")
)
# Manual legend layout: place the legend in the top-right corner
# using fractions of the chart area (0 to 1).
my_bc_3 <- ms_barchart(
data = browser_data, x = "browser",
y = "value", group = "serie"
)
my_bc_3 <- chart_theme(my_bc_3,
legend_position = "r",
legend_x = 0.80, legend_y = 0.15,
legend_w = 0.18, legend_h = 0.30
)
Run the code above in your browser using DataLab