加载程辑包
library(ggplot2)
library(dplyr)
用到的模拟数据
method_names = c("as","fa","dv","wi","ic","ix")
data = data.frame(metr = c(runif(6,2,3),runif(6,2,3),
runif(6,2,3),runif(6,2,3)),
method = rep(method_names,4),fact = c(rep("a",6),rep("s",6),rep("sp",6),rep("F",6)))
data.plo <- data %>%
group_by(method, fact)
画图(注意:背景主题theme_classic()需要在theme函数之前,是ggplot模板之一)
ggplot(data.plo, aes(x=method, y=metr,colour = method)) +
geom_point()+
facet_wrap(~fact)+
theme_classic()+theme(axis.text.x = element_text(angle = 45,vjust = 0.85,hjust = 0.75),plot.title = element_text(hjust = 0.5))+
scale_y_continuous(limits = c(2,3))+xlab(" ")+ylab("Metric Value"