Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么是Mathematica';R中的s RegionPlot3D()?_R - Fatal编程技术网

什么是Mathematica';R中的s RegionPlot3D()?

什么是Mathematica';R中的s RegionPlot3D()?,r,R,我想生成一个3D图,显示代表不等式组合的3D区域。在Mathematica中,我使用: RegionPlot3D[ x^2+y^2+z^2全部] 由此产生: 如何在R中实现这一点?这使得绘图: #equivalent to range and plotpoints x <- seq(-1, 1, by=0.01) y <- seq(-1, 1, by=0.01) z <- seq(-1, 1, by=0.01) df <- setNames(expand.grid(

我想生成一个3D图,显示代表不等式组合的3D区域。在Mathematica中,我使用:

RegionPlot3D[
x^2+y^2+z^2<1&&x^2+y^235,绘图范围->全部]
由此产生:

如何在R中实现这一点?

这使得绘图:

#equivalent to range and plotpoints
x <- seq(-1, 1, by=0.01)
y <- seq(-1, 1, by=0.01)
z <- seq(-1, 1, by=0.01)

df <- setNames(expand.grid(x, y, z), c("x", "y", "z"))
df <- transform(df, ueq = (x^2 + y^2 + z^2 < 1) & (x^2 + y^2 < z^2))
df$color <- ifelse(df$ueq == TRUE, "green" , "red")

#use this rgl
require(rgl)
with(df[df$ueq == TRUE, ], plot3d(x=x, y=y, z=z, col=color, type="p", size=5))
grid3d(c("x", "y+", "z"))
#相当于范围和绘图点

x看一看
?persp
以及
rgl
包,我也喜欢
persp
,或者你可以调查
plot3D
@Franck Dernoncourt我的答案如何改进?
#equivalent to range and plotpoints
x <- seq(-1, 1, by=0.01)
y <- seq(-1, 1, by=0.01)
z <- seq(-1, 1, by=0.01)

df <- setNames(expand.grid(x, y, z), c("x", "y", "z"))
df <- transform(df, ueq = (x^2 + y^2 + z^2 < 1) & (x^2 + y^2 < z^2))
df$color <- ifelse(df$ueq == TRUE, "green" , "red")

#use this rgl
require(rgl)
with(df[df$ueq == TRUE, ], plot3d(x=x, y=y, z=z, col=color, type="p", size=5))
grid3d(c("x", "y+", "z"))