Thanks.
This was very helpful.
But I still have question.
I modified your example for my purpose but there is something missing and I dont know how to do. Prinicpally the "picture" is phantastic. But on the x axis I need the numbers of the chromosomes (instead of bp). The dots are plotted in dependence of bp (so geom_point (aes (x=bp, y=mlp)... This is correct but I dont want the bps to be listed at the x-axis. But I want to see the numbers of the chromosome only.
Thanks
Hermann
ggplot(df) +
geom_point(aes(x=bp, y= mlp), size=3, colour = ifelse (chr %% 2 ==1, "black", "grey")) +
ylab ("-log pval")+
theme_bw() +
theme(panel.grid.major.y = element_blank(), # No horizontal grid lines
panel.grid.major.x = element_blank(),
legend.position=c(1, 0.55), # Put legend inside plot area
legend.justification=c(1, 0.5))
> dput (df)
structure(list(snp = structure(c(1L, 4L, 5L, 6L, 7L, 2L, 3L), .Label = c("snp1",
"snp10", "snp11", "snp2", "snp3", "snp5", "snp6"), class = "factor"),
chr = structure(c(1L, 1L, 1L, 2L, 2L, 3L, 3L), .Label = c("1",
"2", "3"), class = "factor"), bp = structure(c(2L, 3L, 4L,
5L, 7L, 1L, 6L), .Label = c("10", "12", "14", "15", "2",
"20", "6"), class = "factor"), p = c(3, 4, 5, 2, 3, 2, 1),
mlp = c(3.91202300542815, 3.50655789731998, 3.2188758248682,
4.60517018598809, 3.91202300542815, 4.60517018598809, 5.52146091786225
)), .Names = c("snp", "chr", "bp", "p", "mlp"), row.names = c(NA,
-7L), class = "data.frame")