Answers for "ggplot in R how to show information by hovering"

0

ggplot in R how to show information by hovering

p <- ggplot(data = df, aes(x = Date, y = Revenue, group = 1,
            text = paste("Date: ", Date,
                         "<br>Revenue: $", Revenue,
                         "<br>Target: $", Target)
)) +
   geom_line(colour = "grey", aes(Date, Target)) +
   geom_line(colour = "#408FA6")
ggplotly(p, tooltip = "text")
Posted by: Guest on July-14-2021
0

ggplot in R how to show information by hovering

install.packages("plotly")
library(plotly)

p <- ggplot(data = df, aes(x = Date, y = Revenue)) +
   geom_line(colour = "grey", aes(Date, Target)) +
   geom_line(colour = "#408FA6")
ggplotly(p)
Posted by: Guest on July-14-2021

Browse Popular Code Answers by Language