我正在使用ggplot2构建一个包含四个图的图形,每个图由一个特定的建模域组成。我想用粗体字母上的字母制作下面的图。使用符号太有问题了,因为我有8个类别,符号看起来太相似了。
以下是可重现的例子。
数据:
Covariate.Weights.Data= structure(list(Species = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L), .Label = c("American black duck",
"American wigeon", "Blue-winged teal", "Gadwall", "Green-winged teal",
"Mallard", "Northern pintail", "Northern shoveler"), class = "factor"),
Flyway = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("Atlantic",
"Mississippi"), class = "factor"), Season = structure(c(1L,
1L,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, 1, 1, 0.07, 0.99, 1, 1, 1,
0.69, 0, 1, 0.04, 0, 0, 0, 0.08, 0, 0, 0, 0.02, 0, 0, 0,
0, 0, 0, 0.94, 0, 0, 0, 0, 0, 0, 0, 0, 0.93, 0.01, 0, 0,
0)), .Names = c("Species", "Flyway", "Season", "Covariates",
"Weights"), class = "data.frame", row.names = c(NA, -96L))
简介:
require(ggplot2)
Covariates.Weights.Plot =
ggplot(Covariate.Weights.Data, aes(x=Covariates,y=Weights,shape=Species)) +
facet_grid(Flyway~Season) + ylab("Relative Importance") +
geom_point(size=5, position=position_jitter(h=0.1,w=0.3)) +
scale_shape_manual(values=LETTERS[c(1,23,2,7,20,13,16,19)]) +
theme(text=element_text(size=20, face="bold"),
axis.text.y=element_text(size=20),
axis.text.x=element_text(size=20),
axis.title.y=element_text(size=30, face="bold", vjust=1),
axis.title.x=element_text(size=30, face="bold", vjust=0),
strip.text=element_text(size=30, colour="black", face="bold",
vjust=1))
Covariates.Weights.Plot
答案 0 :(得分:6)
也许ggplot
专家会直接在ggplot
知道这是否可行,但由于ggplot
使用grid
,您可以
require(grid)
grid.edit("geom_point.points", grep = TRUE, global=TRUE, gp = gpar(fontface="bold"))
事后加粗字母。
答案 1 :(得分:1)