3d surface plot with R and plotly

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.

3d Section 3d: warning

Most basic bubble chart with 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

# Data: volcano is provided by plotly

# Plot
p <- plot_ly(z = volcano, type = "surface")

# save the widget
# library(htmlwidgets)
# saveWidget(p, file=paste0( getwd(), "/HtmlWidget/3dSurface.html"))

Related chart types

Data art


This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message on Twitter, or send an email pasting yan.holtz.data with gmail.com.