I have a dataframe which contains the x coordinate, y coordinate, and a value at that position. I would like to create a heatmap (density plot?) from this data which is colored based on value at each position. I am looking for a heatmap like which came from this https://stackoverflow.com/questions/5004063/creating-a-heat-map-from-x-y-corrdinates-in-r. My data is different however. Rather than having a value for x and a value for y, I have coordinates and a value found at that pair. I also am needing the axes of the plot to be the x and y coordinates.
Here is an example of my data:
x_coord <- c(1,2,3,4)
y_coord <- c(1,2,3,4)
value <- c(12,15,19,30)
foo.df <- data.frame(x_coord, y_coord, value)
x_coord y_coord value
1 1 1 12
2 2 2 15
3 3 3 19
4 4 4 30
If this is a repost, please link me and I will delete this post. I have found quite a bit on heatmaps for R, but none which seemed to work with data of this nature.
Any ideas?