I am trying to make interactive density plots for my data in R. I am able to make a basic density plot for some simulated data: library(plotly) library(ggplot2) a = rnorm(100,10,10) b = plot(density(a)) b Now, I am trying to make this an interactive plot. I tried the following line of code, but I get […]

Categories

## Density Plots in R

- Post author By Full Stack
- Post date February 22, 2021
- No Comments on Density Plots in R

- Tags 10, 10) b = plot(density(a)) b Now, aes(x=a)) + geom_density() ggplotly(p) This seems to work: But at the same time I get an error: Error: `data` must be a data frame, but I get an empty plot: ggplotly(b) Therefore, I am trying to make interactive density plots for my data in R. I am able to make a basic density plot for some simulated data: library(plot, I am trying to make this an interactive plot. I tried the following line of code, I tried to replicate the original density plot "b" using the "ggplot2" library: p <- ggplot(a, not a numeric vector Can someone please explain why this error comes? Thanks, or other object coercible by `fortify()`