davidhodge931 / ggblanket

Simplify ggplot2 visualisation
https://davidhodge931.github.io/ggblanket/
Other
156 stars 8 forks source link

Make default x/y/col titles work in a functional way #309

Closed davidhodge931 closed 1 year ago

davidhodge931 commented 1 year ago
if (rlang::is_null(x_title)) {
  if (!rlang::is_null(pb$plot$labels$x)) {
    x_title <- snakecase::to_sentence_case(pb$plot$labels$x[1])
  } 
}
if (rlang::is_null(y_title)) {
  if (!rlang::is_null(pb$plot$labels$y)) {
    y_title <- snakecase::to_sentence_case(pb$plot$labels$y[1])
  } 
}
if (rlang::is_null(col_title)) {
  if (!rlang::is_null(pb$plot$labels$colour)) {
    col_title <- snakecase::to_sentence_case(pb$plot$labels$colour[1])
  } 
  else if (!rlang::is_null(pb$plot$labels$fill)) {
    col_title <- snakecase::to_sentence_case(pb$plot$labels$fill[1])
  } 
}
davidhodge931 commented 1 year ago

Remove titles argument

davidhodge931 commented 1 year ago

Done :)