I have the following df:
frequency name sample_type exist
1: 0.0115 sam 1 1
2: 0.3000 sam 2 0
3: 0.0000 sam 3 0
4: 0.0141 bill 1 1
5: 0.0124 bill 3 1
6: 0.0000 bill 2 0
7: 0.0136 mike 3 1
8: 0.0000 mike 1 0
9: 0.0000 mike 2 0
10: 0.0112 leo 1 1
11: 0.0000 leo 2 0
12: 1.0000 leo 3 0
13: 0.0108 brad 3 1
14: 0.0000 brad 2 0
15: 0.9900 brad 1 0
16: 0.0286 randy 3 1
17: 0.0000 randy 2 0
18: 0.7000 randy 1 0
I want to create tile plot/heatmap plot, so I wrote the script:
library(data.table)
ra_df <- fread("G:\\My Drive\\Net2\\test_1.csv",
select=c(1,2,3,4))
library(ggplot2)
ra_figure <- ggplot(ra_df, aes(name, factor(sample_type), fill = frequency)) +
geom_tile(colour="white",size=0.25) +
scale_fill_gradientn(colours = c("white", "lightgreen"), values = c(0,1)) +
theme(axis.text.x = element_text(angle = 90, hjust=1),
legend.position="none", axis.title.x = element_blank(),axis.title.y = element_blank(),
plot.title = element_text(hjust = 0.5,family = "Helvetica", face = "bold.italic", size = (15),
colour="steelblue4"))+
scale_x_discrete(position = "top") +
scale_y_discrete(labels=c("3"="c","2"="b", "1"="a"),expand=c(0,0))+
coord_fixed(ratio = 3)
And I got the following figure:
As you can see the fill values have big differences between them, so the low values seem white, like zero values. The lower values are important for me to see.
How can I create this figure so the lower values will be visible as well?