I'm trying to generate heat map with geom_tile
, where the fill of the plot is determined by one parameter and transparency of plot determined by second parameter. I managed to obtain the plot I wanted but failed to make adjustment on the legend for alpha
.
The continuous data for alpha
ranged from 38 to 64, but the legend was showing from 40 to 60, which might be misleading.
I would like to adjust the legend so as it started from 0 up to 100. Also, curious why didn't the legend for alpha
work like color
, which come with gradient by default.
Any suggestions will be greatly appreciated.
> ggplot(mapxspGC_sort, aes(x=Genes, y=SpName, fill=Presence, alpha=GC))+
+ geom_tile() + labs(x="Genes", y="Species",color="%GC")+
+ scale_fill_gradient(low="white",high="black",guide=FALSE)
+ theme_bw()+theme(panel.grid.major=element_line(linetype="blank"))
Here's part of the long heatmap plot:
I have tried to add scale_alpha_continuous(range=c(0,100))
and scale_alpha_continuous(limit=c(0,100))
, but they didn't work.