library(plotly)Loading required package: ggplot2
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
# Definiramo mrežu
x <- seq(-3, 3, length.out = 200)
y <- seq(-3, 3, length.out = 200)
grid <- expand.grid(x = x, y = y)
z <- matrix(exp(-(grid$x^2 + grid$y^2)) * sin(5 * sqrt(grid$x^2 + grid$y^2)), nrow = 200, ncol = 200)
# 3D površina
plot_ly(x = x, y = y, z = z) %>%
add_surface(colorscale = "Plasma") %>%
layout(scene = list(
xaxis = list(title = ""),
yaxis = list(title = ""),
zaxis = list(title = "Height")
))