我用三个面板创建了一个格子图。我可以控制轴的字体大小和刻度标签,但我还没弄清楚如何增加条带标签的字体大小。这是一个具体的例子:
# See below for the fake data to run this code
library(lattice)
barchart(choice ~ yes+no+not.app|group, data=data,
stack=TRUE, col=c("green","red","blue"),
xlim=c(0,100), layout=c(3,1),
scales=list(cex=c(1.4,1.4), alternating=3),
xlab=list(label="Percent of Respondents", fontsize=20),
main="")
这是此代码生成的图表。请注意除了条带标签(“组1”,“组2”,“组3”)之外,所有字体都是好的和大的。我一直在寻找R-help和Stack Overflow,但是还没有能够解决这个问题。有谁知道神奇的咒语?
data = structure(list(choice = c("Choice 1", "Choice 1", "Choice 1",
"Choice 2", "Choice 2", "Choice 2", "Choice 3", "Choice 3", "Choice 3",
"Choice 4", "Choice 4", "Choice 4"), group = c("Group 1", "Group 2",
"Group 3", "Group 1", "Group 2", "Group 3", "Group 1", "Group 2",
"Group 3", "Group 1", "Group 2", "Group 3"), yes = c(23.53, 20.47,
22.94, 16.51, 16.54, 16.51, 9.68, 13.39, 10.4, 24.48, 29.92,
25.54), no = c(41.37, 37.01, 40.52, 48.39, 40.94, 46.94, 55.22,
44.09, 53.06, 40.42, 27.56, 37.92), not.app = c(35.1, 42.52,
36.54, 35.1, 42.52, 36.54, 35.1, 42.52, 36.54, 35.1, 42.52, 36.54
)), .Names = c("choice", "group", "yes", "no", "not.app"), row.names = c(NA,
12L), class = "data.frame")
答案 0 :(得分:24)
试试这个(提供示例的好工作):
barchart(choice ~ yes+no+not.app|group, data=data,
par.strip.text=list(cex=2),
stack=TRUE, col=c("green","red","blue"),
xlim=c(0,100), layout=c(3,1),
scales=list(cex=c(1.4,1.4), alternating=3),
xlab=list(label="Percent of Respondents", fontsize=20),
main="")
要了解有关如何管理条带要素类型的更多信息,请执行以下操作:?strip.default
还可以使用其他操纵杆strip.custom
。另请参阅latticeExtra包,该包能够使用useOuterStrips
在侧面放置条带。