R plot filled.contour() output in ggpplot2

前端 未结 3 1726
南旧
南旧 2020-12-15 00:45

I want to plot this figure created with filled.contour(), but in ggplot2, how do I do this?

I want to use ggplot2 because the graphing conventions are easier. The r

3条回答
  •  猫巷女王i
    2020-12-15 01:23

    To follow up on @hrbrmstr's minimal example, you can also have ggplot2 compute "z" for you:

    library(ggplot2)
    ggplot(data = faithful, aes(x = eruptions, y = waiting)) +
      stat_density2d(aes(colour = ..level.., fill = ..level..), geom = "polygon")
    

提交回复
热议问题