I need to add lines via stat_contour() to my ggplot/ggplot2-plot. Unfortunately, I can not give you the real data from which point val
stat_contour()
ggplot
ggplot2
You should generate a z for each combination of x and y using expand.grid or outer. For example:
expand.grid
outer
library(ggplot2) testPts <- transform(expand.grid(x=1:10,y=1:5),z=sin(x*y)) (ggplot(data=testPts, aes(x=x, y=y, z=z)) + stat_contour() + geom_point(aes(colour=z)) )