If you want to move the legend position, use the following code:
library(reshape2) # for melt df <- melt(outer(1:4, 1:4), varnames = c("X1", "X2")) p1 <- ggplot(df, aes(X1, X2)) + geom_tile(aes(fill = value)) p1 + scale_fill_continuous(guide = guide_legend()) + theme(legend.position="bottom")
This will give you the desired result. 
Shreyas Karnik Apr 05 2018-12-12T00: 00Z
source share