简体   繁体   中英

Plotting 3D plane and vectors

I have a plane in 3 dimensions, which I have graphed using the persp function. I also have some three dimensional vectors plotted in 3 dimensions using arrows3D. I would like to have the arrows and plane plotted together.

I have searched for ways to merge plots and to add arrows to plots, but I did not find anything about combining these two types of plots. Below is a MWE to produce a plane and an arrow separately.

y <- 1:5
z <- outer(x,y, function(a,b) a+b)
persp(x,y,z)

arrows3D(0,0,0,1,1,1)

Set add=TRUE in arrows3D :

x <- y <- 1:5
z <- outer(x, y, function(a,b) a+b)

library(plot3D)
persp(x, y, z, theta=30, phi=30)
arrows3D(x0=1, y0=1, z0=2, x1=5, y1=5, z1=10, phi=30, theta=30, add=T)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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