📜  ggplot - 堆栈条图中的前 10 个子集 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:51:58.647000             🧑  作者: Mango

代码示例1
stack <- ggplot(data_melt, 
         aes(x = reorder(name, value, FUN = sum), y = value, 
             fill= variable)) + 
             geom_bar(stat = "identity", width = 0.8) + 

             # zoom in to last 10 bars on the axis
             scale_x_discrete(expand = c(0, 0.5)) +
             coord_flip(xlim = c(length(unique(data_melt$name))-9,
                                 length(unique(data_melt$name))))