diff --git a/NAMESPACE b/NAMESPACE index 22620b6..83eae65 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -58,6 +58,7 @@ importFrom(officer,ph_with) importFrom(officer,read_pptx) importFrom(officer,styles_info) importFrom(officer,to_pml) +importFrom(scales,hue_pal) importFrom(stats,as.formula) importFrom(stats,setNames) importFrom(stats,update) diff --git a/NEWS.md b/NEWS.md index c4b985a..3e67cb7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,14 @@ * fix issue with dcast by making sure all data are preserved. +## New features + +* Add support to set chart and plot area color and border by Stefan Moog ; +added four new theme arguments chart/plot_background and chart/plot_border, +new theme `theme_ggplot2()`. + + + # mschart 0.4.0 ## New features diff --git a/R/themes.R b/R/themes.R index 2551a55..a11e2f0 100644 --- a/R/themes.R +++ b/R/themes.R @@ -63,14 +63,15 @@ theme_ggplot2 <- function(x, base_size = 11, base_family = "Arial") { #' #' p <- theme_ggplot2(p) #' p <- chart_fill_ggplot2(p) +#' @importFrom scales hue_pal chart_fill_ggplot2 <- function(x, stroke = TRUE) { if (!is.null(x$group)) { groups <- unique(x$data[[x$group]]) ngroups <- length(groups) - pal <- scales::hue_pal()(ngroups) + pal <- hue_pal()(ngroups) names(pal) <- groups } else { - pal <- scales::hue_pal()(1) + pal <- hue_pal()(1) } x <- chart_data_fill(x, values = pal) diff --git a/man/mschart.Rd b/man/mschart.Rd index 342635d..2bb0b64 100644 --- a/man/mschart.Rd +++ b/man/mschart.Rd @@ -60,6 +60,8 @@ Other contributors: \item ArData [copyright holder] \item YouGov [funder] \item Jan Marvin Garbuszus (support for openxls2) [contributor] + \item Stefan Moog \email{moogs@gmx.de} (support to set chart and plot area color and border) [contributor] + \item Eli Daniels \email{eli.daniels@ardata.fr} [contributor] \item Marlon Molina (added table feature) [contributor] \item Rokas Klydzia (custom labels) [contributor] \item David Camposeco \email{david.camposeco.paulsen@gmail.com} (chart_data_smooth function) [contributor]