什么是Mathematica';R中的s RegionPlot3D()?
我想生成一个3D图,显示代表不等式组合的3D区域。在Mathematica中,我使用:什么是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(
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"))