[Makie] Help with plotting just the boundary of a polygon

Hi, I am using makie to plot some shapes. Is there any way to plot just the boundary? The poly function works the exact way I want, but it doesn’t appear to have an arguement that allows you to just plot the boundary of your shape.

Does lines do what you want?

1 Like

If you are not constrained to the shapes provided by GeometryBasics.jl, consider using the shapes in Meshes.jl, there are tons of utility functions to extract boundaries, etc:

using Meshes
using MeshViz

import GLMakie as Mke

shape = Triangle((0.,0.), (1.,0.), (1.,1.))

viz(shape, color = :cyan, boundarycolor = :red)

# alternatively extract the boundary as a chain
bound = boundary(shape)

viz(bound, color = :green)

You could do color = :transparent with poly and set the stroke color to whatever else you want

2 Likes

Thanks! Note for future people with the same question, you also need to update the strokewidth.

I was able to manipulate it to make it work with lines, but it was pretty clunky. (Needed to connect the last point in the vector, and needed to change a vector of 2D points into a vector of X coordinates and Y coordinates)

I was able to manipulate it to make it work with lines, but it was pretty clunky. (Needed to connect the last point in the vector, and needed to change a vector of 2D points into a vector of X coordinates and Y coordinates)

You will find yourself in a nightmare when your shapes are less trivial and made of multiple pieces with holes, etc. The recipes in MeshViz.jl are extremely flexible and were written to work with quite complicated shapes.