You can play with argument pos
in your call to text
. By using pos=1
for example:
hm_cheese2 <-heatmap.2(cheese.matrix,Rowv=NA,Colv=NA,col=my.palette,
density.info=c("none"),margins(3,5),key=TRUE,keysize=1,
trace="none", lhei=c(2,8), breaks=100, labCol="",
add.expr=text(x=seq_along(labs), y=-0.06372554, srt=45,
xpd=TRUE, adj=0, labels=labs, pos=1))
See ?text
for more on pos
.
If the labels fall outside the plot, you can try using xpd=NA
to clip them to the device region instead of the plot or the figure regions.
hm_cheese2 <-heatmap.2(cheese.matrix,Rowv=NA,Colv=NA,col=my.palette,
density.info=c("none"),margins(3,5),key=TRUE,keysize=1,
trace="none", lhei=c(2,8), breaks=100, labCol="",
add.expr=text(x=seq_along(labs), y=-0.06372554, srt=45,
xpd=NA, adj=0, labels=labs, pos=1))