-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
I often use labels = percent in ggplot axes to make percentages explicit, which has been very helpful.
In scales v0.5.0, the default led to rounding the axes labels to whole number percentages (0%, 25%, 50%, ) but in v1.0.0 those get rounded as 0.0%, 25.0%, 50.0%, which is inefficient. Is this intended behavior, and if so what's the best way to set percent_format(accuracy = 1) as default without typing each time?
scales v0.5.0 seemed to be able to differentiate rounding in axes vs. rounding in values. In the example below, v0.5.0 had rounded the axes to whole numbers, but retained accuracy = 0.1 in the text labels, which seemed like the right defaults.
library(tidyverse)
library(scales)
#>
#> Attaching package: 'scales'
#> The following object is masked from 'package:purrr':
#>
#> discard
#> The following object is masked from 'package:readr':
#>
#> col_factor
vals <- rbeta(10, 1, 1)
df <- tibble(x = sample(vals), y = sample(vals))
ggplot(df, aes(x, y)) +
geom_point() +
geom_text(aes(label = percent(y)), nudge_y = 0.02) +
scale_x_continuous(labels = percent) +
scale_y_continuous(labels = percent)Created on 2018-12-08 by the reprex package (v0.2.1)
Metadata
Metadata
Assignees
Labels
No labels
