library(plotly)
## Warning: package 'plotly' was built under R version 4.3.2
## 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
library(rgl)
## Warning: package 'rgl' was built under R version 4.3.2
DATE: 12 FEBRUARY 2024
x <- seq(-5,5, length.out = 100)
y <- seq(-5,5, length.out = 100)
z <- outer(x, y, function(x,y)
sin(sqrt(x^2 + y^2)))
#create 3D plot
plot_ly(x = ~x , y = ~y, z = ~z, type = "surface") %>%
layout(scene = list(aspectmode = "manual", aspectratio = list(x =1, y =1, z= 0.5)))