R/scale_color_phecode.R

Defines functions scale_color_phecode

Documented in scale_color_phecode

#' Phecode color scale for ggplot2
#'
#' @return ggplot2 color scale using `category_colors()` colors for each category.
#' @export
#'
#' @examples
#'
#' library(dplyr)
#' library(ggplot2)
#'
#' sample_n(phecode_descriptions, 300) %>%
#'   left_join(category_colors(return_df = TRUE) %>%
#'               mutate(bias = rnorm(n(), sd = 3)),
#'             by = 'category') %>%
#'   mutate(val = rnorm(n(), mean = bias)) %>%
#'   ggplot(aes(x = phecode, y = val, color = category)) +
#'   geom_point() +
#'   scale_color_phecode() +
#'   theme_phewas()
#'
scale_color_phecode <- function(){

  ggplot2::scale_color_manual(values = category_colors())

}
nstrayer/phewasHelper documentation built on April 2, 2020, 5:06 a.m.