library(simplevis)
library(dplyr)
plot_data <- slice_sample(ggplot2::diamonds, prop = 0.05) %>%
mutate_text(vars_vctr = c("carat", "price"))
plot <- gg_point(data = plot_data,
x_var = carat,
y_var = price,
text_var = text,
title = "Diamond price by carat",
x_title = "Carat",
y_title = "Price ($US thousands)")
plotly::ggplotly(plot, tooltip = "text")
Run the code above in your browser using DataLab