Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

using MakieCore
144 μs
using GLMakie
139 μs

Type recipes

md"""
## Type recipes
"""
8.1 ms
struct Extrema
min_values::Vector{Float64}
max_values::Vector{Float64}
end
1.1 ms
MakieCore.plottype(::Extrema) = LineSegments
254 μs
function MakieCore.convert_arguments(
::Type{<:LineSegments},
values::Extrema)
points = Point2f[]
for (i, (min_val, max_val)) in enumerate(
zip(values.min_values, values.max_values))
push!(points, (i, min_val))
push!(points, (i, max_val))
end
(points,)
end
1.3 ms
plot(Extrema(rand(100) .- 1, rand(100) .+ 1))
278 ms

Full recipes

md"""
## Full recipes
"""
170 μs
begin
@MakieCore.recipe(Rug, x, y) do scene
Attributes()
end
function MakieCore.plot!(plot::Rug)
vlines!(plot, plot[1], ymax=0.025)
hlines!(plot, plot[2], xmax=0.025)
end
end
4.8 ms
Observable{Vector{Float64}} with 0 listeners. Value:
[0.7578800326698261, 0.5084003664296306, 0.41588739475416525, 0.09775587228891425, 0.8762432174830335, 0.9212949297245487, 0.3531635617447193, 0.294154137509409, 0.5082165605650584, 0.34650813639729483  …  0.60353802982827, 0.03622202268529029, 0.7011400359002113, 0.28496026508498673, 0.36031334691792494, 0.41030217259633783, 0.6840559277496443, 0.4564163041791627, 0.834166885390131, 0.991804461250142]
begin
x = Observable(rand(100))
y = Observable(rand(100))
end
3.7 μs
GLMakie.Screen(...)
begin
fig = Figure()
ax = Axis(fig[1, 1])
scatter!(ax, x, y)
rug!(ax, x, y)
display(fig)
end
323 ms
x[] = rand(100)
1.2 s