0

寸法 xy の 2 つの円周を 3D プロットと共にプロットし、2 つの円の交点に色を付けようとしていますが、どうすればよいですか?

# objective function
x <- seq(-1,1,.1)
y <- seq(-1,1,.1)
z <- x^2 + y^2

library(scatterplot3d)
library(plotrix)
scatterplot3d(x,y,z,pch=19,color="royalblue4")
draw.circle (1,1,1)
draw.circle (1,-1,1)
4

1 に答える 1

1

私は数学にあまり興味がありませんが、役に立つかもしれないし、コメントするには大きすぎるので、回答として投稿します。ナンセンスを投稿する場合は、私の無知を許してください。

#your data
library(scatterplot3d)
x <- seq(-1,1,.1)
y <- seq(-1,1,.1)
z <- x^2 + y^2

ang = 60 #angle of the 3D plot. experiment with different values

#your 3D plot, with extended xx', yy' limits
sp3d <- scatterplot3d(x, y, z, pch=19, color="royalblue4", 
           xlim = c(-1, 3), ylim = c(-3, 3), angle = ang)

#to use parametric equations of circles
f <- seq(-2*pi, 2*pi, 0.1)

#circle1
sp3d$points(x = 1 + 1*cos(f), y = 1 + 1*sin(f), z = rep(0, length(f)), type = "l")
#circle2
sp3d$points(x = 1 + 1*cos(f), y = -1 + 1*sin(f), z = rep(0, length(f)), type = "l")

プロットは次のとおりです。

sp3d

于 2013-10-26T09:53:00.553 に答える