library(plotly) plot_ly(data = mtcars, x = ~wt, y = ~mpg, color = ~as.factor(cyl), size = ~hp, text = ~paste("Weight: ", wt, '<br>MPG:', mpg), type = "scatter", mode = "markers") %>% layout(title = "Car Data")