相关疑难解决方法(0)

避免 ggplot2 部分剪切轴文本

我正在尝试生成一个水平图,在轴上标记有刻度。

df = data.frame(quality = c("low", "medium", "high", "perfect"),
                n = c(0.1, 11, 0.32, 87.45))

require(ggplot2)
require(dplyr)
size = 20
df %>% 
        ggplot() +
        geom_bar(aes(x = quality, y = n),
                 stat = "identity", fill = "gray70",
                 position = "dodge") +
        geom_text(aes(x = quality, y = n,
                      label = paste0(round(n, 2), "%")),
                  position = position_dodge(width = 0.9),
                  hjust = -0.2,
                  size = 10, color = "gray50") +
        coord_flip() +
        ggtitle("") +
        xlab("gps_quality\n") +
        #scale_x_continuous(limits = c(0, 101)) +
        theme_classic() +
        theme(axis.title …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

7
推荐指数
1
解决办法
4273
查看次数

标签 统计

ggplot2 ×1

r ×1