I've not used plotly before, but I think this page will be helpful:
From what I understand, this should do the job:
library(plotly)
p <- seq(from = (-10),
to = 10,
length.out = 30)
q <- p
f <- function(p, q) return((p ^ 2) + (q ^ 2))
m <- outer(X = p,
Y = q,
FUN = f)
plot_ly() %>%
add_surface(x = ~p,
y = ~q,
z = ~m,
opacity = 5) %>%
orca(file = "plotly_save_png_image.png")
Unfortunately, I haven't been able to try this. For some reason, the windows-release.zip for installing orca is detected as virus. I'll try to download it once again and update this post.
Update
Apparently, this is a confirmed bug.
However, I was able to download it to my cell phone and transferred it later. This indeed works and here's the plot: