ggplot2 and geom_density: How to remove baseline?

后端 未结 3 857
粉色の甜心
粉色の甜心 2020-12-09 14:29

I\'m using ggplot as described here

Smoothed density estimates

and entered in the R console

m <- ggplot(movies, aes(x = rating))         


        
3条回答
  •  Happy的楠姐
    2020-12-09 15:10

    Another way would be to calculate the density separately and then draw it. Something like this:

    a <- density(movies$rating)
    b <- data.frame(a$x, a$y)
    ggplot(b, aes(x=a.x, y=a.y)) + geom_line()
    

    It's not exactly the same, but pretty close.

提交回复
热议问题