Skip to content

Commit

Permalink
Update README and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
jbengler committed Mar 1, 2024
1 parent 000507e commit f81c7f0
Show file tree
Hide file tree
Showing 12 changed files with 200 additions and 74 deletions.
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,19 @@ export(adjust_x_axis)
export(adjust_y_axis)
export(all_rows)
export(colors_continuous_blue_pink_yellow)
export(colors_continuous_cividis)
export(colors_continuous_inferno)
export(colors_continuous_magma)
export(colors_continuous_mako)
export(colors_continuous_plasma)
export(colors_continuous_rocket)
export(colors_continuous_turbo)
export(colors_continuous_viridis)
export(colors_discrete_candy)
export(colors_discrete_circle)
export(colors_discrete_metro_ui)
export(colors_discrete_metro)
export(colors_discrete_pastel)
export(colors_discrete_seaside)
export(colors_diverging_RdBu)
export(colors_diverging_RdYlBu)
export(colors_diverging_blue2brown)
Expand Down
2 changes: 1 addition & 1 deletion R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ color_palettes <- list(
"#E64B35","#4DBBD5","#00A087","#3C5488","#F39B7F","#8491B4","#91D1C2",
"#DC0000","#7E6148","#B09C85"),

metro_ui = c(
metro = c(
"#4DACD6","#4FAE62","#F6C54D","#E37D46","#C02D45"),

multiqc_align = c(
Expand Down
36 changes: 32 additions & 4 deletions R/colors.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ adjust_colors <- function(gg, new_colors = NULL,

# Default colors
if (is.null(new_colors)) {
new_colors <- colors_discrete_metro_ui
new_colors <- colors_discrete_metro
as_palette <- TRUE
}

Expand Down Expand Up @@ -93,16 +93,28 @@ new_color_scheme <- function(x, name = "Untitled color scheme") {
#' Previews of build-in discrete color schemes
#'
#' ```{r results="asis", echo=FALSE, message=FALSE}
#' print(colors_discrete_metro_ui, return_html = TRUE)
#' print(colors_discrete_metro, return_html = TRUE)
#' print(colors_discrete_circle, return_html = TRUE)
#' print(colors_discrete_candy, return_html = TRUE)
#' print(colors_discrete_pastel, return_html = TRUE)
#' print(colors_discrete_seaside, return_html = TRUE)
#' ```
#' @md
#'
#' @export
colors_discrete_metro_ui <- new_color_scheme(color_palettes$metro_ui, "colors_discrete_metro_ui")
#' @rdname colors_discrete_metro_ui
colors_discrete_metro <- new_color_scheme(color_palettes$metro, "colors_discrete_metro")
#' @rdname colors_discrete_metro
#' @export
colors_discrete_circle <- new_color_scheme(color_palettes$color_circle_vivid, "colors_discrete_circle")
#' @rdname colors_discrete_metro
#' @export
colors_discrete_candy <- new_color_scheme(c("#9b5de5", "#f15bb5", "#fee440", "#00bbf9", "#00f5d4"), "colors_discrete_candy")
#' @rdname colors_discrete_metro
#' @export
colors_discrete_pastel <- new_color_scheme(c("#cdb4db", "#ffc8dd", "#ffafcc", "#bde0fe", "#a2d2ff"), "colors_discrete_pastel")
#' @rdname colors_discrete_metro
#' @export
colors_discrete_seaside <- new_color_scheme(c("#8ecae6", "#219ebc", "#023047", "#ffb703", "#fb8500"), "colors_discrete_seaside")


#' Continuous color schemes
Expand All @@ -114,6 +126,10 @@ colors_discrete_circle <- new_color_scheme(color_palettes$color_circle_vivid, "c
#' print(colors_continuous_viridis, return_html = TRUE)
#' print(colors_continuous_magma, return_html = TRUE)
#' print(colors_continuous_inferno, return_html = TRUE)
#' print(colors_continuous_plasma, return_html = TRUE)
#' print(colors_continuous_cividis, return_html = TRUE)
#' print(colors_continuous_rocket, return_html = TRUE)
#' print(colors_continuous_mako, return_html = TRUE)
#' print(colors_continuous_turbo, return_html = TRUE)
#' print(colors_continuous_blue_pink_yellow, return_html = TRUE)
#' ```
Expand All @@ -129,6 +145,18 @@ colors_continuous_magma <- new_color_scheme(viridisLite::magma(265), "colors_con
colors_continuous_inferno <- new_color_scheme(viridisLite::inferno(265),"colors_continuous_inferno")
#' @rdname colors_continuous_viridis
#' @export
colors_continuous_plasma <- new_color_scheme(viridisLite::plasma(265), "colors_continuous_plasma")
#' @rdname colors_continuous_viridis
#' @export
colors_continuous_cividis <- new_color_scheme(viridisLite::cividis(265), "colors_continuous_cividis")
#' @rdname colors_continuous_viridis
#' @export
colors_continuous_rocket <- new_color_scheme(viridisLite::rocket(265), "colors_continuous_rocket")
#' @rdname colors_continuous_viridis
#' @export
colors_continuous_mako <- new_color_scheme(viridisLite::mako(265), "colors_continuous_mako")
#' @rdname colors_continuous_viridis
#' @export
colors_continuous_turbo <- new_color_scheme(viridisLite::turbo(265), "colors_continuous_turbo")
#' @rdname colors_continuous_viridis
#' @export
Expand Down
12 changes: 6 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

tidyplots streamlines the creation of publication-ready plots for scientific papers, making it incredibly easy to add and refine plot elements. It allows precise control over composition, style, and absolute sizes, while its utilization of the pipe `%>%` simplifies the construction of advanced plotting pipelines.
The goal of `tidyplots` is to streamline the creation of publication-ready plots for scientific papers, making it incredibly easy to add and refine plot elements. It allows precise control over composition, style, and absolute sizes, while its utilization of the pipe `%>%` simplifies the construction of advanced plotting pipelines.

## Installation

Expand Down Expand Up @@ -124,11 +124,11 @@ study %>%
add_mean_bar(alpha = 0.3) %>%
add_error() %>%
add_data_points_beeswarm() %>%
view_plot(title = "Plot version A") %>%
adjust_rotate_plot() %>%
view_plot(title = "Plot version B") %>%
adjust_font(family = "mono", face = "bold") %>%
view_plot(title = "Plot version C")
view_plot(title = "Default color scheme: metro") %>%
adjust_colors(colors_discrete_candy) %>%
view_plot(title = "Alternative color scheme: candy") %>%
adjust_colors(colors_discrete_seaside) %>%
view_plot(title = "Alternative color scheme: seaside")
```

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
[![R-CMD-check](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jbengler/tidyplots/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

tidyplots streamlines the creation of publication-ready plots for
scientific papers, making it incredibly easy to add and refine plot
elements. It allows precise control over composition, style, and
absolute sizes, while its utilization of the pipe `%>%` simplifies the
construction of advanced plotting pipelines.
The goal of `tidyplots` is to streamline the creation of
publication-ready plots for scientific papers, making it incredibly easy
to add and refine plot elements. It allows precise control over
composition, style, and absolute sizes, while its utilization of the
pipe `%>%` simplifies the construction of advanced plotting pipelines.

## Installation

Expand Down Expand Up @@ -122,11 +122,11 @@ study %>%
add_mean_bar(alpha = 0.3) %>%
add_error() %>%
add_data_points_beeswarm() %>%
view_plot(title = "Plot version A") %>%
adjust_rotate_plot() %>%
view_plot(title = "Plot version B") %>%
adjust_font(family = "mono", face = "bold") %>%
view_plot(title = "Plot version C")
view_plot(title = "Default color scheme: metro") %>%
adjust_colors(colors_discrete_candy) %>%
view_plot(title = "Alternative color scheme: candy") %>%
adjust_colors(colors_discrete_seaside) %>%
view_plot(title = "Alternative color scheme: seaside")
```

<img src="man/figures/README-unnamed-chunk-11-1.png" style="display: block; margin: auto;" /><img src="man/figures/README-unnamed-chunk-11-2.png" style="display: block; margin: auto;" /><img src="man/figures/README-unnamed-chunk-11-3.png" style="display: block; margin: auto;" />
Expand Down
Loading

0 comments on commit f81c7f0

Please sign in to comment.