From bbda86de93662877f26b6834e55017d2cd8c53ca Mon Sep 17 00:00:00 2001 From: pvictor Date: Wed, 23 Aug 2023 10:42:59 +0200 Subject: [PATCH] fix heatmap xaxis (force character) --- NAMESPACE | 1 + R/apex.R | 5 ++++- vignettes/apexcharter.Rmd | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 3f316be..2280d15 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -107,6 +107,7 @@ importFrom(rlang,is_function) importFrom(rlang,is_list) importFrom(rlang,is_named) importFrom(rlang,is_null) +importFrom(rlang,quo) importFrom(rlang,quos) importFrom(rlang,sym) importFrom(rlang,syms) diff --git a/R/apex.R b/R/apex.R index ad31fcb..8d14a96 100644 --- a/R/apex.R +++ b/R/apex.R @@ -212,8 +212,11 @@ is_sized <- function(x) { any(c("size", "z") %in% names(x)) } - +#' @importFrom rlang quo rename_aes_heatmap <- function(mapping) { + if (is.null(mapping["x"])) + stop("apex(..., type = 'heatmap') must have an 'x' aesthetic", call. = FALSE) + mapping[["x"]] <- quo(as.character(!!mapping[["x"]])) n_mapping <- names(mapping) n_mapping[n_mapping == "y"] <- "group" if ("fill" %in% n_mapping) { diff --git a/vignettes/apexcharter.Rmd b/vignettes/apexcharter.Rmd index 9161184..21bb052 100644 --- a/vignettes/apexcharter.Rmd +++ b/vignettes/apexcharter.Rmd @@ -306,10 +306,15 @@ apex(mpg, aes(hwy, class), "boxplot") %>% ax_plotOptions( boxPlot = boxplot_opts(color.upper = "#8BB0A6", color.lower = "#8BB0A6" ) ) %>% - ax_stroke(colors = list("#2A5769")) + ax_stroke(colors = list("#2A5769")) %>% + ax_grid( + xaxis = list(lines = list(show = TRUE)), + yaxis = list(lines = list(show = FALSE)) + ) ``` + ## Dumbbell charts Create Dumbbell chart with: