This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r1 = Rect2f((10, 20), (5, 8)) | |
r2 = Rect2f((20, 30), (5, 8)) | |
f, ax, _ = poly(r1) | |
linewidth = Observable(20) | |
r2_pixel = lift(ax.scene.camera.projectionview, ax.scene.viewport, linewidth) do _, _, lw | |
mi, ma = extrema(r2) | |
_mi = Makie.project(ax.scene, mi) .+ 0.5lw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra: normalize | |
f = Figure() | |
ax1 = Axis(f[1, 1]) | |
slope1 = 2 | |
data1 = [1 0; slope1 1] * randn(2, 500) | |
scatter!(ax1, data1, alpha = 0.1) | |
ax2 = Axis(f[1, 2]) | |
slope2 = -0.5 | |
data2 = [1 0; slope2 1] * randn(2, 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = Figure() | |
main_ax = Axis(f[1, 1]) | |
twin_ax_layout = GridLayout(f[1, 1, Right()]) | |
twin_axis_pairs = map(1:3) do i | |
data_axis = Axis(f[1, 1]) | |
label_axis = Axis(twin_ax_layout[1, i], width = 0, alignmode = Outside(), yaxisposition = :right) | |
hidedecorations!(data_axis) | |
hidespines!(data_axis) | |
hidexdecorations!(label_axis) | |
linkyaxes!(data_axis, label_axis) |
NewerOlder