我有4个与此图相似的图(只是使用不同的数据框(don,don1,don2)。我想将它们与指定为带有共同图例的数据线色的一个图组合在一起)。 >
ggplot(don, aes(x=poscum, y=pval)) +
# Show all points
geom_line() +
# custom X axis:
scale_x_continuous( label = axisdf$CHR, breaks= axisdf$center ) +
scale_y_continuous(expand = c(0, 0) ) + # remove space between plot area
and x axis
# Custom the theme:
theme_bw() +
theme(
legend.position="none",
panel.border = element_blank(),
panel.grid.major = element_line(colour="white"),
panel.grid.minor = element_line(colour="white"),
axis.ticks = element_line(colour = "black"),
axis.line = element_line(colour = "black"),
)
答案 0 :(得分:1)
您可以为此使用方面。像这样:
donall <- data.frame(rbind(don, don1, don2), group= rep("don", nrow(don)), rep("don1", nrow(don1)), rep("don2", nrow(don2)))
ggplot(donall, aes(x=poscum, y=pval)) +
geom_line()+
facet_wrap(~group, ncol=2) +....