Skip to content

Commit

Permalink
Merge pull request #182 from spsanderson/development
Browse files Browse the repository at this point in the history
Fixes #181
  • Loading branch information
spsanderson committed May 10, 2022
2 parents b7d94f0 + 6327885 commit ec1af66
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 5 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ export(":=")
export(.data)
export(as_label)
export(as_name)
export(color_blind)
export(enquo)
export(enquos)
export(td_scale_color_colorblind)
export(td_scale_fill_colorblind)
export(tidy_autoplot)
export(tidy_beta)
export(tidy_binomial)
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
None

## New Features
None
1. Fix #181 - Add functions `color_blind()` `td_scale_fill_colorblind()` and
`td_scale_color_colorblind()`

## Minor Fixes and Improvements
1. Fix #176 - Update `_autoplot` functions to include cumulative mean MCMC chart
Expand Down
2 changes: 1 addition & 1 deletion R/autoplot-combined-dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ tidy_combined_autoplot <- function(.data, .plot_type = "density", .line_size = .
linetype = "dashed"
) +
ggplot2::ylim(0, max_dy)
} else {
} else if (.geom_smooth & plot_type == "mcmc") {
plt <- plt +
ggplot2::geom_smooth(
ggplot2::aes(
Expand Down
4 changes: 3 additions & 1 deletion R/autoplot-density.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#' - `quantile`
#' - `probability`
#' - `qq`
#' - `mcmc`
#'
#' @description This is an auto plotting function that will take in a `tidy_`
#' distribution function and a few arguments, one being the plot type, which is
Expand All @@ -17,6 +18,7 @@
#' - `quantile`
#' - `probablity`
#' - `qq`
#' - `mcmc`
#'
#' If the number of simulations exceeds 9 then the legend will not print. The plot
#' subtitle is put together by the attributes of the table passed to the function.
Expand Down Expand Up @@ -325,7 +327,7 @@ tidy_autoplot <- function(.data, .plot_type = "density", .line_size = .5,
linetype = "dashed"
) +
ggplot2::ylim(0, max_dy)
} else {
} else if (.geom_smooth & plot_type == "mcmc") {
plt <- plt +
ggplot2::geom_smooth(
ggplot2::aes(
Expand Down
2 changes: 1 addition & 1 deletion R/autoplot-multi-dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ tidy_multi_dist_autoplot <- function(.data, .plot_type = "density", .line_size =
linetype = "dashed"
) +
ggplot2::ylim(0, max_dy)
} else {
} else if (.geom_smooth & plot_type == "mcmc") {
plt <- plt +
ggplot2::geom_smooth(
ggplot2::aes(
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions R/palette-color-blind.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#' Provide Colorblind Compliant Colors
#'
#' 8 Hex RGB color definitions suitable for charts for colorblind people.
#'
#' @export
color_blind <- function(){
c("#000000", "#E69F00", "#56B4E9",
"#009E73", "#F0E442", "#0072B2",
"#D55E00", "#CC79A7")
}

#' Provide Colorblind Compliant Colors
#' @export
td_scale_fill_colorblind <- function(..., theme = "td") {

pal <- switch(theme,
"td" = unname(color_blind()) %>% rep(100)
)

ggplot2::scale_fill_manual(values = pal)
}

#' Provide Colorblind Compliant Colors
#' @export
td_scale_color_colorblind = function(..., theme = "td") {

pal <- switch(theme,
"td" = unname(color_blind()) %>% rep(100)
)

ggplot2::scale_color_manual(values = pal)
}
11 changes: 11 additions & 0 deletions man/color_blind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/td_scale_color_colorblind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/td_scale_fill_colorblind.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/tidy_autoplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/util_lognormal_param_estimate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ec1af66

Please sign in to comment.