I have a graph generated by ggplot2 in R. In facet_wrap
I have two variables. I want to color them different. I tried to change the color but it changed for both. I want for every strip a color so I want to colors.
ggplot(trial, aes(x =total , y = power, colour = Levels)) +
geom_line()+ facet_wrap(~P1+P2) + geom_point() + theme(legend.position = "right",plot.title = element_text(color="darkblue", size=16, face="bold.italic", hjust = 0.5),axis.title.x = element_text(color="black", size=12, face="bold"),
axis.title.y = element_text(color="black", size=12, face="bold"), strip.background = element_rect(fill = "blue") ) +
ggtitle("Plot")
library(statmod)
trial=expand.grid(n1=c(10,20,30,40,50),n2=c(10,20,30,40,50),
p1=c(0.1,0.2,0.3,0.5,0.8,0.9),p2=c(0.1,0.2,0.5,0.8,0.9), alpha=0.05)
trial$P1=as.factor(trial$p1)
trial$P2=as.factor(trial$p2)
trial$total = trial$n1 + trial$n2
for(row in 1:nrow(trial)){
trial$power[row]=power.fisher.test(trial$p1[row], trial$p2[row],
trial$n1[row],trial$n2[row],
alpha=0.05, nsim=100,
alternative="two.sided")}