It's easy if your data is already in two columns for x and y. If it's a raster, then you have to remember the right command from reshape2 or tidyr or write one yourself.
ggplot(melt(matrix), aes(x = Var1, y = Var2, fill = value)) + geom_raster()