can't draw line in ggplotly with tooltip

hello R community,

i am making line plot with tooltip, but it couldn't show up

wsdm_for_registration_plotly <- wsdm_for_registration  %>%
  head(14) %>%
  ggplot( aes(x=year_registration, y=`number of subscriber`,text=paste0("years :" ,year_registration,"<br>",
        "number of subscriber: ", scales::comma(`number of subscriber`, 1)))) +
    geom_line() +
    geom_point(color="#69b3a2", size=4) +
     scale_y_continuous(labels = scales::comma)  +
    ggtitle("Subscriber Growth year to year") +
    ylab("number of subscriber") +
    theme_ipsum()`Preformatted text`

thank you

None of the geoms use the text aesthetic, take a look at geom_text() or geom_label() for mapping variables to the label aesthetic.

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

okay, this is my reprex

df <- data.frame(
      year_registration= c(2004, 2005,2006,2007 ),
       `number of subscriber`= c(4160,6901,9192,16069))

wsdm_for_registration_plotly <-df  %>%
  ggplot( aes(x=year_registration, y=number.of.subscriber,text=paste0("years :" ,year_registration,"<br>",
                                                                      "number of subscriber: ", scales::comma(`number.of.subscriber`, 1)))) +
  geom_line() +
  geom_point(color="#69b3a2", size=4) +
  scale_y_continuous(labels = scales::comma)  +
  ggtitle("Subscriber Growth year to year") +
  ylab("number of subscriber") +
  theme_ipsum()
#> Error in wsdm_for_registration %>% head(14) %>% ggplot(aes(x = year_registration, : could not find function "%>%"
ggplotly(wsdm_for_registration_plotly, tooltip = "text")
#> Error in ggplotly(wsdm_for_registration_plotly, tooltip = "text"): could not find function "ggplotly"

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.