Skip to content

Commit

Permalink
avoid scales 1.3.0 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jbengler committed Jan 12, 2024
1 parent 387a26b commit 32196f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 3 additions & 5 deletions R/adjust.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ adjust_x_axis <- function(gg, title = ggplot2::waiver(), breaks = ggplot2::waive
}
if (is_continuous(gg, "x")) {
if (is_waiver(labels) && cut_short_scale)
# labels <- scales::label_number(scale_cut = scales::cut_short_scale())
labels = ggplot2::waiver()
labels <- scales::label_number(scale_cut = scales::cut_short_scale())
cli::cli_alert_success("adjust_x_axis: {.pkg continuous}")
suppressMessages(
if (is_continuous(gg, "y"))
Expand Down Expand Up @@ -102,7 +101,7 @@ adjust_x_axis <- function(gg, title = ggplot2::waiver(), breaks = ggplot2::waive
adjust_y_axis <- function(gg, title = ggplot2::waiver(), breaks = ggplot2::waiver(),
labels = ggplot2::waiver(), limits = NULL, padding_bottom = NULL,
padding_top = NULL, transformation = "identity", position = "left",
cut_short_scale = TRUE, force_y_continuous = FALSE, ...) {
cut_short_scale = FALSE, force_y_continuous = FALSE, ...) {

# parse title
if (!is_waiver(title)) title <- tidyplot_parser(as.character(title))
Expand Down Expand Up @@ -143,8 +142,7 @@ adjust_y_axis <- function(gg, title = ggplot2::waiver(), breaks = ggplot2::waive
}
if (is_continuous(gg, "y") || force_y_continuous) {
if (is_waiver(labels) && cut_short_scale)
# labels <- scales::label_number(scale_cut = scales::cut_short_scale())
labels = ggplot2::waiver()
labels <- scales::label_number(scale_cut = scales::cut_short_scale())
cli::cli_alert_success("adjust_y_axis: {.pkg continuous}")
suppressMessages(
if (is_continuous(gg, "x"))
Expand Down
8 changes: 2 additions & 6 deletions R/todo.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@

# with fixed scales 1.3.1: re-activate cut_short_scale()
# When bug in cut_short_scale() is fixed (expected in scales 1.3.1), change default: adjust_y_axis(cut_short_scale = TRUE)

# work on check_pipeline()
# enforce "sequence of funs", with warnings and errors

# what happens when tidyplot functinos are applied to a ggplot that is was generated with tidyplot()

# data set "dinosaurs"

# data set "EU or world countiries"
# what happens when tidyplot functions are applied to a ggplot that is was NOT generated with tidyplot()

# make color schemes accessible

Expand Down

0 comments on commit 32196f7

Please sign in to comment.