This is the data https://github.com/Clairinechendra/sbucks1010/blob/main/p3.csv
Below is my code
p3_plot <- p3 %>%
ggplot(aes(x= size_ml, y= n, fill= category))+
geom_col(position="stack") +
theme_light()
ggplotly(p3_plot)
everytime i run the ggplotly it doesn't work even though i already import the library plotly. any solutions for this?
Unfortunately "it doesn't work" doesn't say much about what didn't work and how it didn't work (did you get an an error? A warning? A blank plot? No data? Or ...?)
Below is a fully reproducible example. Please do a clean restart of R/RStudio (don't restore an older session), and then copy & paste the code below to verify that you can reproduce the plot.
library(tidyverse)
p3 <- read_csv("https://raw.githubusercontent.com/Clairinechendra/sbucks1010/main/p3.csv")
p3_plot <- p3 %>%
ggplot(aes(x = size_ml, y = n, fill = category))+
geom_col(position = "stack") +
theme_light()
library(plotly)
ggplotly(p3_plot)
Two additional comments speculating as to the issue(s) you're having:
read_csv
).ggplot
object (here: p3_plot
) prior to "plotly-fication". If that plot is empty/wrong, the issue is not with plotly
.