I'm trying to do a levelplot using ggplot2 for a (meteorological) variable. The variable is measured continuously in time (my x-axis), but in non-continuous heights (y-axis) at every time step. The produced plot therefore shows data at the heights (y-coordinates) specified, but nothing in between. Here's an example:
library(ggplot2)
data <- runif(400, min=0, max=10)
index <- c(1:20)
heights <- c(1,2,3,4,5,7,9,12,15,19,23,28,33,39,45,52,59,67,75,83)
dat <- as.data.frame(cbind(expand.grid(X=index,Y=heights),data))
ggplot(dat, aes(x=dat[,1], y=dat[,2],z=dat[,3])) +geom_tile(aes(fill=dat[,3]))
This produces the following plot:
Is there an easy way to fill the plot fully, i.e. make the lines in the upper part of the plot broader? Thank you!