Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(plotly)
- y <- rgamma(1000, shape = 0.25, rate = 0.0054)
- dens <- data.frame(x = density(y)$x, y = density(y)$y)
- miny <- 0
- maxy <- max(dens$y)
- plot_ly() %>%
- add_histogram(x = y) %>%
- add_lines(data = dens, x = ~x, y = ~y, yaxis = "y2", line = list(width = 3)) %>% layout(yaxis2 = list(overlaying = "y", side = "right", range = c(miny, maxy), showgrid = F, zeroline = F))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement