在 ggplot 直方图中使用百分比比例更改 x 限制
change x limits with percent scale in ggplot histogram
我正在尝试绘制直方图。我希望将 x 轴限制设置为 50% 到 60%。
tbl <- tibble(x = runif(n = 100, min = 53, max = 58))
ggplot(tbl,
aes(x = x)) +
geom_histogram(bins = 50) +
theme_bw() +
scale_x_continuous(labels = scales::percent_format(scale = 1,
limits = c(50, 60)))
您的限制不在正确的位置:
scale_x_continuous(labels = scales::percent_format(scale = 1),
limits = c(50, 60))
我正在尝试绘制直方图。我希望将 x 轴限制设置为 50% 到 60%。
tbl <- tibble(x = runif(n = 100, min = 53, max = 58))
ggplot(tbl,
aes(x = x)) +
geom_histogram(bins = 50) +
theme_bw() +
scale_x_continuous(labels = scales::percent_format(scale = 1,
limits = c(50, 60)))
您的限制不在正确的位置:
scale_x_continuous(labels = scales::percent_format(scale = 1),
limits = c(50, 60))