I have this rdata: https://dl.dropboxusercontent.com/u/43417085/cpp.rdata.RData
What I want in the codes below is the way to add range of values for "IBS" column for each cutoff (colours), and also make the lines more distinct for each cutoff (because the lines are mixed together and are not well separated for each cutoff) .
Here are my codes to plot the figure:
color <- c("0.25_ok"= "navy", "0.5_confounding_high" = "blanchedalmond", "0.5_ok" = "cyan3", "1.0_confounding" = "brown2", "cancer" = "darkgray", "confounding_unrelated" = "khaki2",
"contaminated_dil" = "black", "identical_ok" = "cornsilk3", "mislabelled" = "dodgerblue2", "sample_contam" = "red1", "unrelated" = "yellow1" )
p<- ggplot(cpp, aes(x = Num_Good, y = IBS, group = key.related.sheet, color = cutoff)) +
geom_line() + geom_point() #to show the dots
p1 <- p+labs(title="SNPs threshold for coherent IBD", x="Number of good SNPs", y="IBD") +
theme_bw() +
theme(axis.text.x=element_text(size=14), axis.title.x=element_text(size=16),
axis.text.y=element_text(size=14), axis.title.x=element_text(size=16),
plot.title=element_text(size=20, face="bold", color="darkgreen"))
p2 <-p1+ scale_x_continuous(expand = c(0, 0), breaks = c(0, 1500, seq(5000, max(as.data.frame(cpp)[,"Num_Good"]), 10000)),
labels = c(0, 1500, seq(5000, max(as.data.frame(cpp)[,"Num_Good"]),10000))) #expand forces the origin to start at zero
p3 <- p2 + scale_color_manual(values = color)
#rescaling the Y-axis breaks
p4 <- p3+scale_y_continuous(breaks = seq(-1,2,0.25),
labels = seq(-1,2,0.25))
p5 <- p4 + geom_hline(yintercept = 0, colour="black", linetype = "longdash")+
geom_hline(yintercept = 0.5, colour="black", linetype = "longdash")+
geom_hline(yintercept = 1.0, colour="black", linetype = "longdash")
p6 <- p5 + coord_cartesian (xlim = c(0, 30000), ylim = c())