Skip to content

Instantly share code, notes, and snippets.

View jkrumbiegel's full-sized avatar

Julius Krumbiegel jkrumbiegel

View GitHub Profile
@jkrumbiegel
jkrumbiegel / fontOnCurve.jl
Created April 12, 2026 11:25
TextOnPath for Makie 0.24 — place text along a BezierPath
using LinearAlgebra: norm
"""
TextOnPath(text::String, path::Makie.BezierPath)
A text value that lays out characters along a `BezierPath`. Pass as the `text`
argument to `text!`, together with `markerspace = :data` so that glyph positions
and fontsize are in data-space units. The text position should be `Point2f(0)`.
Important: don't provide a closed path — it can lead to infinite loops.
@jkrumbiegel
jkrumbiegel / makie_table_widget.jl
Created January 28, 2026 12:43
Makie Table widget
using GLMakie
##
@recipe TextTable (origin,) begin
text = String[;;] # size = (rows, columns)
cell_padding = Vec4f(5, 5, 2, 2)
colsize = Makie.automatic # could be a vector
rowsize = Makie.automatic # could be a vector
@jkrumbiegel
jkrumbiegel / image_extending_out_of_axis.jl
Created January 16, 2026 21:38
Image extending out of Makie Axis
using CairoMakie
img = Makie.loadasset("cow.png")
sz = reverse(size(img))
f = Figure()
for i in 1:3, j in 1:3
Axis(f[i, j])
end
ax = content(f[2, 2])
@jkrumbiegel
jkrumbiegel / tangent_lines_circles_makie.jl
Created September 1, 2025 07:19
Tangent lines two circles Makie projected
using LinearAlgebra
"""
outertangents(c1::Circle, c2::Circle) -> Vector{Tuple{Point2f, Point2f}}
Compute the outer tangent lines between two circles.
Returns a vector of two tuples, each containing two Point2f objects representing the endpoints of the outer tangent lines.
"""
function outertangents(c1, c2)
# Extract centers and radii
@jkrumbiegel
jkrumbiegel / makie_tab_interface.jl
Created July 25, 2025 17:51
Makie tab interface using deletion
function tear_down!(tabgrid)
for e in @view tabgrid.content[end:-1:begin]
if e.content isa GridLayout
tear_down!(e.content)
Makie.GridLayoutBase.remove_from_gridlayout!(e)
else
delete!(e.content)
end
end
trim!(tabgrid)
@jkrumbiegel
jkrumbiegel / bar.jl
Created July 18, 2025 09:31
dodged bar smaller bar inside AlgebraOfGraphics
mapping(
["X", "X", "X"],
[1, 2, 3],
dodge = ["A", "B", "C"],
color = ["A", "B", "C"],
) * visual(BarPlot, direction = :x) +
mapping(
["X", "X", "X"],
[0.7, 1.5, 2.2],
dodge = ["A", "B", "C"],
@jkrumbiegel
jkrumbiegel / gist:52a90ff54149617ff7eb2431433d9e80
Created July 18, 2025 09:30
dodged bar scatter markers AoG
mapping(
["X", "X", "X"],
[1, 2, 3],
dodge = ["A", "B", "C"],
color = ["A", "B", "C"],
) * visual(BarPlot, direction = :x) +
mapping(
[0.7, 1.8, 2.2],
["X", "X", "X"],
dodge_y = ["A", "B", "C"]
@jkrumbiegel
jkrumbiegel / pretalx_pdf_schedule.jl
Last active January 19, 2026 13:40
juliacon pretalx custom pdf schedule
using JSON
using Downloads
using Typst_jll
using Dates
url = "https://pretalx.com/juliacon-2025/schedule/export/schedule.json"
json = JSON.parsefile(Downloads.download(url))
@jkrumbiegel
jkrumbiegel / makie_align_axes_around_value.jl
Created June 8, 2025 19:25
makie_align_axes_around_value.jl
f = Figure()
ax1 = Axis(f[1, 1])
scatter!(randn(100) .- 1)
ax2 = Axis(f[1, 2])
scatter!(randn(100) .* 2)
on(ax1.finallimits) do lims
aligned = 0
(xmin, ymin), (xmax, ymax) = extrema(lims)
dy1, dy2 = (ymin, ymax) .- aligned
@jkrumbiegel
jkrumbiegel / cairomakie_draw_into_buffer.jl
Created June 5, 2025 07:42
CairoMakie draw into buffer
using CairoMakie
using CairoMakie.Colors
sz = (400, 300)
px_per_unit = 2
img = fill(ARGB32(1, 0, 0, 1), ((sz .* px_per_unit) .+ (200, 0))...)
surf = CairoMakie.Cairo.CairoImageSurface(img)
f = Figure(size = sz)
scatter(f[1, 1], cumsum(randn(100)))