call to library(scales)

This commit is contained in:
pvictor 2019-11-26 10:34:01 +01:00
parent 326f455def
commit 53a8cfa957
3 changed files with 5 additions and 2 deletions

View File

@ -280,11 +280,12 @@ ax_plotOptions <- function(ax,
#' ax_colors("#F7D358") #' ax_colors("#F7D358")
#' #'
#' #'
#' library(scales)
#' apex( #' apex(
#' data = count(diamonds, cut, color), #' data = count(diamonds, cut, color),
#' mapping = aes(x = cut, y = n, fill = color) #' mapping = aes(x = cut, y = n, fill = color)
#' ) %>% #' ) %>%
#' ax_colors(scales::brewer_pal(palette = "Set2")(7)) #' ax_colors(brewer_pal(palette = "Set2")(7))
ax_colors <- function(ax, ...) { ax_colors <- function(ax, ...) {
args <- list(...) args <- list(...)
if (length(args) == 1) { if (length(args) == 1) {

View File

@ -33,9 +33,10 @@ apex(
ax_colors("#F7D358") ax_colors("#F7D358")
library(scales)
apex( apex(
data = count(diamonds, cut, color), data = count(diamonds, cut, color),
mapping = aes(x = cut, y = n, fill = color) mapping = aes(x = cut, y = n, fill = color)
) \%>\% ) \%>\%
ax_colors(scales::brewer_pal(palette = "Set2")(7)) ax_colors(brewer_pal(palette = "Set2")(7))
} }

View File

@ -23,6 +23,7 @@ Data used are from `ggplot2` package, data manipulation will be done with the `d
```{r message=FALSE, warning=FALSE} ```{r message=FALSE, warning=FALSE}
library(ggplot2) library(ggplot2)
library(scales)
library(dplyr) library(dplyr)
library(apexcharter) library(apexcharter)
``` ```