0

I have the following data frame:

data frame: sum.pval

X     FIN     GBR     IBS     TSI     CEU     ACB     ASW     MXL     CLM     PEL     PUR     CDX     CHB     CHS    JPT    KHV
1 1 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.0000 0.0000
2 2 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00002 0.00000 0.00007 0.00000 0.00000 0.00000 0.00000 0.00000 0.0000 0.0000
3 3 0.85215 0.26513 0.31671 0.80404 0.25714 0.32592 0.26890 0.55262 0.89547 0.09870 0.60793 0.08745 0.01002 0.00134 0.0589 0.0528
4 4 0.00000 0.00000 0.00000 0.00000 0.00000 0.05000 0.17988 0.00335 0.00625 0.18562 0.00040 0.00534 0.00000 0.00000 0.0000 0.0000
5 5 0.00000 0.00000 0.00000 0.00000 0.00000 0.00004 0.00041 0.00001 0.00003 0.00060 0.00000 0.00000 0.00000 0.00000 0.0000 0.0000

I want to represent these p values in a heat map but just with three colors:

b$P_values == 0, col("firebrick4")
0<b$P_values<=0.05, col("firebrick1)
0.05<b$P_values, col("forestgreen")

the script I use is the following:

b<-melt(sum.pval)
names(b)<-c("Het_allowed_per_ROH","Populations","P_values")
b$Het_allowed_per_ROH = factor(b$Het_allowed_per_ROH, levels = X)
qplot(Populations, Het_allowed_per_ROH, fill=P_values, data=b,geom='tile') + ggtitle("Total ROH Sum")
+ scale_fill_gradient(colours=c("firebrick4","firebrick1","forestgreen"),
                  values=rescale(c(b$P_values==0.00),(b$P_values<=0.05 & b$P_values>0.00),(b$P_values>0.05)),guide="colorbar")

However Im not getting the result I want. I get two things. First an error message: Error in zero_range(from) : x must be length 1 or. and then I get this plot: enter image description here

This is not cleary what Im looking for and I dont know how to make it work. could you help me?

Cisco
  • 137
  • 7
  • I don't think this is related to an issue in *ggrepel*. The error comes from the `rescale` function. Take a look at the help page for that function. – aosmith Jan 25 '17 at 19:32
  • I did, and it seems there is no problem with my script... rescale should work with the script what I wrote. – Cisco Jan 26 '17 at 08:23
  • But the `to` and `range` arguments in `rescale` are supposed to have a vector of length 1 or 2, and you give it a vector as long as the dataset. If you want to categorize a continuous response, see, e.g., `cut`. – aosmith Jan 26 '17 at 14:29

0 Answers0