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: 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. |
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 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 |
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 | |
| 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]) |
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))) |
NewerOlder