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:
This is not cleary what Im looking for and I dont know how to make it work. could you help me?