poly
poly(vertices, indices; kwargs...)
poly(points; kwargs...)
poly(shape; kwargs...)
poly(mesh; kwargs...)
Plots a polygon based on the arguments given. When vertices and indices are given, it functions similarly to
mesh
. When points are given, it draws one polygon that connects all the points in order. When a shape is given (essentially anything decomposable by
GeometryBasics
), it will plot
decompose(shape)
.
poly(coordinates, connectivity; kwargs...)
Plots polygons, which are defined by
coordinates
(the coordinates of the vertices) and
connectivity
(the edges between the vertices).
Attributes
Available attributes and their defaults for
MakieCore.Combined{Makie.poly, T} where T
are:
color RGBA{Float32}(0.0f0,0.0f0,0.0f0,0.6f0)
colormap :viridis
colorrange MakieCore.Automatic()
cycle [:color => :patchcolor]
highclip MakieCore.Automatic()
inspectable true
linestyle "nothing"
lowclip MakieCore.Automatic()
nan_color :transparent
overdraw false
shading false
space :data
strokecolor :black
strokewidth 0
transparency false
visible true
Examples
using CairoMakie
using Makie.GeometryBasics
f = Figure()
Axis(f[1, 1])
poly!(Point2f[(0, 0), (2, 0), (3, 1), (1, 1)], color = :red, strokecolor = :black, strokewidth = 1)
f
using CairoMakie
using Makie.GeometryBasics
f = Figure()
Axis(f[1, 1])
# polygon with hole
p = Polygon(
Point2f[(0, 0), (2, 0), (3, 1), (1, 1)],
[Point2f[(0.75, 0.25), (1.75, 0.25), (2.25, 0.75), (1.25, 0.75)]]
)
poly!(p, color = :blue)
f
using CairoMakie
using Makie.GeometryBasics
f = Figure()
Axis(f[1, 1])
# vector of shapes
poly!(
[Rect(i, j, 0.75, 0.5) for i in 1:5 for j in 1:3],
color = 1:15,
colormap = :heat
)
f
using CairoMakie
using Makie.GeometryBasics
f = Figure()
Axis(f[1, 1], aspect = DataAspect())
# shape decomposition
poly!(Circle(Point2f(0, 0), 15f0), color = :pink)
f
using CairoMakie
using Makie.GeometryBasics
f = Figure()
Axis(f[1, 1]; backgroundcolor = :gray15)
# vector of polygons
ps = [Polygon(rand(Point2f, 3) .+ Point2f(i, j))
for i in 1:5 for j in 1:10]
poly!(ps, color = rand(RGBf, length(ps)))
f
These docs were autogenerated using Makie: v0.17.13, GLMakie: v0.6.13, CairoMakie: v0.8.13, WGLMakie: v0.6.13