0

I did programm the following graphs in R, using the ggplot2 package. But some details I could not change.

enter image description here

To do this, I use the follow programming:

b=ggplot(data1,aes(pos,P),group =CHR) + geom_point(size=1, aes(color=CHR)) +
guides(fill=FALSE) + 
geom_hline(yintercept=20,colour="green", alpha=I(2/3)) +
geom_hline(yintercept=150,colour="red", alpha=I(3/3))
b+ scale_x_discrete("Chromosome", labels = c(1:27))

1º: I want to remove the scale legend of "chromosome". I put the guides(fill=FALSE), but did not solve.

2º: I want to put the delimitations of x axis of each chromosome. To try this I put: scale_x_discrete("Chromosome", labels = c(1:27)). But did not solve the problem.

3º: On label chromosome have a big thick black belt. I want remove this.

Thank you.

Community
  • 1
  • 1
  • For manhattan plot I would suggest you to use package `qqman` instead of `ggplot`. See here for examples: [QQMAN PACKAGE TUTORIAL](http://www.gettinggeneticsdone.com/2014/05/qqman-r-package-for-qq-and-manhattan-plots-for-gwas-results.html) But to answer and solve your first problem: Instead of `guides(fill=FALSE)` write `theme(legend.position="none")`. And to remove the thick belt completely just use `theme(axis.title.x=element_blank(),axis.text.x=element_blank(),axis.ticks.x=element_blank())`. As the second problem goes, I would suggest you using `grid.arrange` – Miha Mar 15 '17 at 12:52
  • @Miha, thank you so much. I tried to use qqman, but appear error which I could not solve, and a edditing my data like the example. But Thank you. – Amanda Botelho Alvarenga Mar 15 '17 at 13:00
  • @Miha, I am searching how I can solve the second problem with grid.arrange, but I did not find. How can I solve? – Amanda Botelho Alvarenga Mar 15 '17 at 13:37
  • Can you provide your `dput()`. – Miha Mar 15 '17 at 14:16
  • I am sorry @Miha, but provide what? – Amanda Botelho Alvarenga Mar 15 '17 at 17:00
  • Your data frame or part of it. – Miha Mar 15 '17 at 17:02
  • My dataframe is organized in a column of SNP (alphanumeric), CHR (numeric- I renamed X chromosome), BP (numeric- position of each SNP), pos (combination of CHR and BP- this that I use like "x" in this graph) and P (bayes factor- ranging 0 to 999 - numeric too). This description help? – Amanda Botelho Alvarenga Mar 15 '17 at 17:06
  • I would need actual data or subset of data you are working with not description of columns. So if you could type this in R : `dput(data1)` and if is not too long paste it here in your first question. In this way you will produce dataset which I can test. If you have problems with `dput()` please see this [How to make a great R reproducible example?](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Miha Mar 15 '17 at 17:17
  • @Miha, I could it the 2º question, with: `geom_point(pos = position_jitter(w = 0.45, h = 0.45)` – Amanda Botelho Alvarenga Mar 16 '17 at 13:43

0 Answers0