1. Basic Scatterplot
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, type = "scatter", mode = "markers")
3. 3D Scatterplot
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, z = ~Sepal.Width,
color = ~Species, type = "scatter3d", mode = "markers")
4. Line Graph for Time Series Data
time <- seq.Date(from = as.Date("2023-01-01"), by = "month", length.out = 12)
values <- rnorm(12)
plot_ly(x = ~time, y = ~values, type = "scatter", mode = "lines+markers")
5. Histogram (Visualizing Data Distribution)
plot_ly(data = iris, x = ~Petal.Length, type = "histogram")
6. Boxplot (Comparing Distributions)
plot_ly(data = iris, y = ~Petal.Length, color = ~Species, type = "box")
7. Heatmap (2D Data Visualization)
z <- matrix(rnorm(100), nrow = 10)
plot_ly(z = ~z, type = "heatmap")
3D Surface Plot
z <- outer(seq(-2, 2, length.out = 30), seq(-2, 2, length.out = 30), function(x, y) x^2 + y^2)
plot_ly(z = ~z, type = "surface")
9. Choropleth Map (Geographic Visualization)
plot_ly(type = "choropleth",
locations = c("USA", "CAN", "MEX"),
locationmode = "country names",
z = c(1000, 800, 600),
colorscale = "Viridis")