3D surface plot with plotly error

Hello everybody,

I am a new user of R and I want plot a 3D surface graph, but when I run my script this error message is sent :

Storing 'username' as the environment variable 'plotly_username' Error in Sys.setenv(plotly_username = username) : wrong length for argument

Here you have the script (inspirated by this tutorial : https://moderndata.plot.ly/3d-surface-plots-with-rstudio-and-plotly/) :

data_SMPS <- as.data.frame(data_SMPS)
x <- data_SMPS$total[1:100] - data_SMPS$total[1:100]
x[ ]=1
x_vec <- as.vector(x)
y <- data_SMPS$total[1:100]
y_vec <- as.vector(y)
y_vec <- t(y)

data_plot <- list(

   x = x_vec,
   y = y_vec,
   z = matrix(c(x_vec %*% y_vec) , nrow = 100, ncol = 100), type = "surface")

layout <- list(

   title = "test",
   scene = list(bgcolor = "rgb(244, 244, 248)"))

response <- plotly(data_plot)

Thank you in advance to your answers.

Yacine

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.