data(iris)
p <- plot_ly(
type = "scatter",
x = iris$Petal.Length,
y = iris$Sepal.Length,
text = paste("Species: ", iris$Species,
"<br>Sepal Length: ", iris$Sepal.Length,
"<br>Sepal Width: ", iris$Sepal.Width,
"<br>Petal Length: ", iris$Petal.Length,
"<br>Petal Width: ", iris$Petal.Width),
hoverinfo = "text",
mode = "markers",
transforms = list(
list(
type = "groupby",
groups = iris$Species,
styles = list(
list(target = "setosa", value = list(marker = list(color = "blue"))),
list(target = "versicolor", value = list(marker = list(color = "red"))),
list(target = "virginica", value = list(marker = list(color = "green")))
)
)
)
) %>%
layout(
xaxis = list(title = "Petal Length"),
yaxis = list(title = "Sepal Length"),
title = "Sepal Length vs. Petal Length"
)
p