using MakieCore
using GLMakie
Type recipes
md"""
## Type recipes
"""
struct Extrema
min_values::Vector{Float64}
max_values::Vector{Float64}
end
MakieCore.plottype(::Extrema) = LineSegments
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
plot(Extrema (rand(100) .- 1, rand(100) .+ 1))
Full recipes
md"""
## Full recipes
"""
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
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
GLMakie.Screen(...)
begin
fig = Figure()
ax = Axis(fig [1, 1])
scatter!(ax , x , y )
display(fig )
end
0.686056
0.911046
0.742031
0.547614
0.18662
0.974675
0.460334
0.486987
0.112429
0.530236
0.418416
0.875377
0.130923
0.832984
0.0910894
0.129937
0.677792
0.977601
0.700709
0.0589629
0.306037
0.881698
0.851936
0.823618
0.660396
0.109525
0.893903
0.8726
0.323672
0.739427
x[] = rand(100)