我正在寻找 1)“A”、“B”和“C”之间的更多垂直空间,“\n”不是我想要的解决方案。2)我想改变符号和文本的绘制顺序。这意味着,首先我想绘制图例的线条,然后是该文本。
attach(mtcars)
gear.f<-factor(gear,levels=c(3,4,5),
labels=c("3gears","4gears","5gears"))
cyl.f <-factor(cyl,levels=c(4,6,8),
labels=c("4cyl","6cyl","8cyl"))
densityplot(~mpg|cyl.f,
main="Density Plot by Number of Cylinders",
xlab="Miles per Gallon"
,par.settings = list(superpose.line = list(col=c(1,2,3)))
,auto.key=list(corner = c(.98, .02),text = c("A", "B", "C")
,lines=T,points=F)
)