# Makie scatter plot of vector of points

I would like to pass a vector of 3D points:

``````v = Vector{Point3f0}(undef, 10)
``````

to scatter plot. Do I have to separate it into x, y and z columns first and call:

``````scene = scatter(x, y, z, color = :red, markersize = 0.02)
``````

or there is a simpler way?

BTW, why name the type `Point3f0` instead of `Point3f`?

1 Like

I think this was chosen in reference to the `f0` suffix for Float32 literals:

``````julia> typeof(1.2)
Float64

julia> typeof(1.2f0)
Float32
``````

But I agree itâ€™s confusing, since the `0` in `f0` is incidentalâ€¦ `1.2f3` is also valid syntax for a Float32. So `Point3f` would make more sense, and it is also more usual. These types are defined in https://github.com/JuliaGeometry/GeometryBasics.jl . Maybe it would be worth filing an issue to suggest changing it.

1 Like

It should just work to pass the Vector of points to the plotting function?

3 Likes
1 Like

Indeed it does:

``````scatter(rand(Point3f0, 10), color = :red, markersize = 0.02)
``````

Iâ€™m just learning my ABCs and asking silly questions.

No worries, I was just wondering given the way you phrased the question whether you had encountered a bug

Out of curiosity, how did you know this would work? I canâ€™t find any example using this syntaxâ€¦ I would have tried `scatter([x y z])` (which fails) but wouldnâ€™t have guessed `scatter(Point3f0.(x,y,z))`). It also seems hard to find it by reading https://makie.juliaplots.org/stable/signatures.htmlâ€¦

1 Like

Iâ€™ve been using Makie for a while, so I just knew. But I donâ€™t know if itâ€™s explicitly mentioned in the docs somewhere

1 Like