小编Seb*_*anW的帖子

在堆叠格子条形图中显示值

我想为它的每个部分显示100%条形的值.不幸的是我不知道该怎么做.图形应该是格子因为图例位置(我用ggplot2尝试过,但你不能在一行中显示图例).我对任何建议或想法感到高兴.

library(lattice)
data(postdoc, package = "latticeExtra")
colnames(postdoc) <- c("Legendtext 1", "2", "3", "4", "5")
colorset <- simpleTheme(col = c(rgb(166,27,30,maxColorValue = 255),
                                rgb(192,80,77,maxColorValue = 255), 
                                rgb(24,65,83,maxColorValue = 255),
                                rgb(60,143,167,maxColorValue = 255),
                                rgb(130,184,208,maxColorValue = 255)),
                                border = "white")
pl <- barchart(prop.table(postdoc, margin = 1),
               par.settings = colorset,
               auto.key = list(columns = 5, space = "bottom",
                               cex = 0.8, size = 1.4, between = 0.2,
                               between.columns = 0.1, adj = 1))
Run Code Online (Sandbox Code Playgroud)

graphics r lattice

10
推荐指数
1
解决办法
4092
查看次数

标签 统计

graphics ×1

lattice ×1

r ×1