A surface plot displays the evolution of a numeric variable on a grid. The R plotly package offers some great functions to build that kind of chart.
geom_point()
Plotly allows to build charts thanks to it
plot_ly()
function. It offers several type
option. surface
allows to make surface plots and expect a
matrix as input.
Rows and columns actually describe a grid, and the cell value will be mapped to the surface height. Once the chart is done, you can hover and zoom on the chart for more details.
# Library
library(plotly)
# Data: volcano is provided by plotly
# Plot
p <- plot_ly(z = volcano, type = "surface")
p
# save the widget
# library(htmlwidgets)
# saveWidget(p, file=paste0( getwd(), "/HtmlWidget/3dSurface.html"))
👋 After crafting hundreds of R charts over 12 years, I've distilled my top 10 tips and tricks. Receive them via email! One insight per day for the next 10 days! 🔥