在 lattice/densityplot 中更改 sub-titles
Change sub-titles in lattice/densityplot
我在 lattice/densityplot 工作,想将 "in"、"out" sub-titles 更改为 "inpatinet"、"outpatient"。
谢谢你。图片及代码如下:
colors = c("black", "blue")
lines = c(1,2) #1
points = c(16,17)
key.trans <- list(title="Gender",
corner = c(0.90, 0.90),
#space="bottom", columns=2, #2
text=list(c("Female","Male")),
#points=list(pch=points, col=colors),
lines=list(col=colors, lty=lines),
cex.title=1, cex=.9)
densityplot(~ Age_yrs|Location_type, groups=Sex,
data = subset(all_isolates_inc_ATCC, Age_yrs<100 &
Institution=="P06"
& Organism=="eco"
& Location_type!="unk"),
xlab = "Age, years",
lty=lines, col=colors,
lwd=2,
plot.points = FALSE,
#jitter=.00005,
key=key.trans)
可以使用 strip.custom
函数在函数中更改条带名称。 Change text on strips in lattice plots 中提出了一个相关问题。在您的情况下,您可以将以下参数添加到 densityplot()
调用中:
strip = strip.custom(factor.levels = c("In patient", "Out patient"))
更多信息可以在 strip.default
的帮助中找到,尽管 strip.custom
的帮助也可以帮助您。
我在 lattice/densityplot 工作,想将 "in"、"out" sub-titles 更改为 "inpatinet"、"outpatient"。 谢谢你。图片及代码如下:
colors = c("black", "blue")
lines = c(1,2) #1
points = c(16,17)
key.trans <- list(title="Gender",
corner = c(0.90, 0.90),
#space="bottom", columns=2, #2
text=list(c("Female","Male")),
#points=list(pch=points, col=colors),
lines=list(col=colors, lty=lines),
cex.title=1, cex=.9)
densityplot(~ Age_yrs|Location_type, groups=Sex,
data = subset(all_isolates_inc_ATCC, Age_yrs<100 &
Institution=="P06"
& Organism=="eco"
& Location_type!="unk"),
xlab = "Age, years",
lty=lines, col=colors,
lwd=2,
plot.points = FALSE,
#jitter=.00005,
key=key.trans)
可以使用 strip.custom
函数在函数中更改条带名称。 Change text on strips in lattice plots 中提出了一个相关问题。在您的情况下,您可以将以下参数添加到 densityplot()
调用中:
strip = strip.custom(factor.levels = c("In patient", "Out patient"))
更多信息可以在 strip.default
的帮助中找到,尽管 strip.custom
的帮助也可以帮助您。