我正在尝试使用R格子准备堆栈条形图,并在垂直轴上使用log10刻度绘制数据。如果没有log10规模,事情将按预期
print(dataframe)
但是,当我使用以下log 10比例进行绘图时
# Dummy data
Grp <- c('A','B','A','B','A','B')
Sub <- c(1,1,2,2,3,3)
tst <- rbind(Grp,Sub)
tst <- data.frame(t(tst),stringsAsFactors = FALSE)
tst$Val <- c(5,10,10,20,80,90)
# Stacked bar chart normal scale
require(lattice)
require(latticeExtra)
barchart(Val ~ Grp,
data = tst,
horiz = FALSE,
main = '',
groups = Sub,
stack = TRUE,
auto.key=list(space = 'top', columns = 3,
points = FALSE, rectangles = TRUE,
title = ''),
par.strip.text = list(col = 'white', font = 1.5),
panel = function(x,y,...){
panel.grid(h = -1, v = 0);
panel.barchart(x,y,...)
}
)
)
对于y10的对数比例尺,堆叠的条形的比例似乎正确吗?我在这里听不懂