将GGR中的绘图与常见图例相结合
我有4个与此类似的图(只需使用不同的数据框(don、don1、don2)。我想将它们组合在一个图中,并将线颜色指定为具有公共图例的数据框将GGR中的绘图与常见图例相结合,r,ggplot2,R,Ggplot2,我有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(exp
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"),
)
您可以为此使用facet。如下所示:
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) +....
donall请提供,以使您的问题具有可复制性!有许多选项可供选择。答案涵盖了大部分选项。