以下の R Markdown (Rmd) コードは、表面プロットが埋め込まれた html ドキュメントを生成するはずです。
```{r, plotly=TRUE}
library(plotly)
py <- plotly()
x_vec = c(seq(-5, 4.9, 0.1))
x_matrix = matrix(c(x_vec), nrow = 100, ncol = 1)
y_matrix = matrix(c(x_vec), nrow = 1, ncol = 100)
data <- list(
x = x_vec,
y = x_vec,
z = matrix(c(cos(x_matrix %*% y_matrix) + sin(x_matrix %*% y_matrix)), nrow = 100, ncol = 100),
type = "surface")
layout <- list(
title = "Waaaves in r",
scene = list(bgcolor = "rgb(244, 244, 248)"))
response <- py$plotly(data, session="knitr",
kwargs = list(
layout = layout,
world_readable=FALSE,
filename = "waves example",
fileopt = "overwrite"))
```
ドキュメントはコードが埋め込まれた出力を作成しますが、プロットはありません。というエラーメッセージが表示されるだけです。
「おっと、サーバーでエラーが発生しました。」
ここで何が起こっているのか分かりますか?