2023-06-11

Using plotly to create an interactive scatterplot

library(plotly)
library(dplyr)
data("iris")

plot_ly(iris, x = ~Sepal.Length, y = ~Sepal.Width, type = "scatter", 
        color = ~Species) %>%
        layout(title = "Sepal length/width of 3 different iris flowers",
               xaxis = list(title = 'Sepal Length (cm)'),
               yaxis = list(title = 'Sepal Width (cm)'),
               legend = list(title = list(text = '<b> Species of Iris Flower </b>')))