I have a plot obtained with ggplot2
ggplot()+geom_line(data=results,aes(x=SNR,y=MeanLambdaMin,group=rep),col="blue")+
geom_line(data=results,aes(x=SNR,y=MeanA,group=rep),col="green")+
geom_line(data=results,aes(x=SNR,y=VarA,group=rep),col="red")+
geom_line(data=results,aes(x=SNR,y=VarB,group=rep),col="black")+
facet_wrap(~ rep, as.table=T)+xlab("SNR")+ylab("")
The result is good

Unlikely I have to print it in black and white. What is the best thing to do? Is there any option which optimize the color for a black and white versione?
here there is a reproducible example
results=data.frame("SNR"=1:30)
results$MeanA=results$SNR^2
results$VarA=results$SNR*2
results$VarB=results$SNR^(1/2)
results$MeanLambdaMin=1:30
results$rep=sample(x=1:3,size=30,replace=T)
ggplot()+geom_line(data=results,aes(x=SNR,y=MeanLambdaMin,group=rep),col="blue")+
geom_line(data=results,aes(x=SNR,y=MeanA,group=rep),col="green")+
geom_line(data=results,aes(x=SNR,y=VarA,group=rep),col="red")+
geom_line(data=results,aes(x=SNR,y=VarB,group=rep),col="black")+
facet_wrap(~ rep, as.table=T)+xlab("SNR")+ylab("")
Your y values should be in one variable that correspond to the variable Species in this example. For instance:
Change linetype:
ggplot(iris) +
geom_line(aes(Sepal.Length,Petal.Length,linetype=Species)) +
theme_classic()

or
Change linetype and shape of points:
ggplot(iris) +
geom_line(aes(Sepal.Length,Petal.Length,linetype=Species)) +
geom_point(aes(Sepal.Length,Petal.Length,shape=Species)) +
theme_classic()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With