简体   繁体   English

R:矩阵相对于矩阵的3d图

[英]R: 3d plot of matrix against matrix

Let us consider the following codes: 让我们考虑以下代码:

x=seq(1,30,1)
t=runif(10)

z_t=array(0,dim=c(10,30))

for (i in 1:10){
for (j in 1:30){
z_t[i,j]=x[j]+x[j]*t[i]
}
}

How to plot(t,x,z_t) where t is a vector of dimension 10, x is a vector of dimension 30 and z_t is matrix of dimension (10x30)? 如何绘制(t,x,z_t),其中t是尺寸为10的向量,x是尺寸为30的向量,z_t是尺寸为(10x30)的矩阵?

I am not 100% sure whether this is the plot you are looking for, but try playing around with plotly library. 我不确定100%是否是您要查找的地块,但请尝试使用地表库。

library(plotly)
plot_ly(z = z_t,  type = "surface")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM