怎么用Makie.jl画一组点加一个点的三维坐标


#1

现在有一组点的三维坐标xyz,还有一个点的三维坐标xyzV,我想用不同的颜色把它们表示出来,该怎么搞呢。

我这样试了试,

scene = Scene(resolution = (1000, 1000))
meshscatter!(xyz[:,1],xyz[:,2],xyz[:,3],limits = FRect3D(Vec3f0(-50, -50, -50), Vec3f0(100, 100, 100)),markersize=0.7)
meshscatter!(xyzV[1],xyzV[2],xyzV[3],limits = FRect3D(Vec3f0(-50, -50, -50), Vec3f0(100, 100, 100)),color=:red,markersize=1.5)

但是报错如下,

No overload for MeshScatter{...} and also no overload for trait AbstractPlotting.PointBased() found! Arguments: (Int64, Int64, Int64)
error(::String) at error.jl:33
#convert_arguments#214(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{MeshScatter{...}}, ::Int64, ::Vararg{Int64,N} where N) at conversions.jl:54
convert_arguments(::Type{MeshScatter{...}}, ::Int64, ::Int64, ::Int64) at conversions.jl:49
#plot!#195(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Scene, ::Type{MeshScatter{...}}, ::Attributes, ::Int64, ::Vararg{Int64,N} where N) at interfaces.jl:494
plot!(::Scene, ::Type{MeshScatter{...}}, ::Attributes, ::Int64, ::Int64, ::Int64) at interfaces.jl:481
#meshscatter!#145(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:limits, :color, :markersize),Tuple{GeometryTypes.HyperRectangle{3,Float32},Symbol,Float64}}}, ::Function, ::Int64, ::Vararg{Int64,N} where N) at recipes.jl:24
(::getfield(AbstractPlotting, Symbol("#kw##meshscatter!")))(::NamedTuple{(:limits, :color, :markersize),Tuple{GeometryTypes.HyperRectangle{3,Float32},Symbol,Float64}}, ::typeof(meshscatter!), ::Int64, ::Int64, ::Int64) at none:0
top-level scope at none:0

有老哥知道该怎么搞嘛?


#2

Makie 似乎不能直接用單點
試試以下這種,應該可行

meshscatter!([xyzV[1]], [xyzV[2]], [xyzV[3]])

另外要畫點座標可以用scatter,但不知道這是不是你要的效果?

using Makie

xyz = rand(10, 3)
xyzV = rand(1, 3)

scene = Scene()
scatter!(xyz, color=:red)
scatter!(xyzV, color=:blue)