R - ggplot - stat_contour not able to generate contour lines
I am trying to add contour lines via stat_contour() to my
ggplot/ggplot2-plot. Unfortunately, I can not give you the real data from
which point values should be evaluated. However, another easily
repreducably example behaves the same:
testPts <- data.frame(x=rep(seq(7.08, 7.14, by=0.005), 200))
testPts$y <- runif(length(testPts$x), 50.93, 50.96)
testPts$z <- sin(testPts$y * 500)
(ggplot(data=testPts, aes(x=x, y=y, z=z))
+ geom_point(aes(colour=z))
+ stat_contour()
)
This results in the following error message:
Error in if (nrow(layer_data) == 0) return() : argument is of length zero
In addition: Warning message:
Not possible to generate contour data
The example looks not different to others posted on stackoverflow or in
the official manual/tutorial to me, and it seeminlgy doesn't matter if I
provide more specifications to stat_contour.
Thank you for your ideas and advice!
No comments:
Post a Comment