The following code works well:
p <- ggplot(df,aes(x=x,y=y))
p <- p + geom_tile(aes(fill=z))
p
It plots a nice heatmap. Here df
contains x
and y
, created using expand.grid()
, and z
which contains the value at each (x
,y
) co-ordinate.
This code, on the other hand
p <- ggplot(df,aes(x=x,y=y))
p <- p + coord_map(project="lagrange")
p <- p + geom_tile(aes(fill=z))
p
doesn't plot anything much at all (and doesn't plot anything with all the coordinate transforms I've tried). My understanding is that the coord_map works on the x and y data, and the fill should be drawn on top of the transformed co-ordinates. However, this must be wrong as nothing's being plotted once the co-ordinates have been mapped to a new frame.
So my question is: how should I go about this so that it works properly? Could it be something to do with my data.frame df
?