Repository navigation
Plot unions, unit simplices and unit cubes with Makie, and unions with Plots - #187
Merged
Merged
Conversation
In Julia ≥ 1.13, `hash(x)` uses a nonzero default seed (`Base.HASH_SEED`), so `domainhash(d)` with a zero seed no longer agreed with `hash(d)` and the level set and indicator function hash tests failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- a UnionDomain is plotted by plotting each component in one color, with colors cycling between unions - UnitSimplex is a triangle in 2D and a tetrahedron in 3D - converting a HyperRectangle uses infimum/supremum, so UnitSquare() and UnitCube() no longer error The union recipe uses the current @recipe syntax, so the Makie compat is now 0.21-0.24. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #187 +/- ##
==========================================
+ Coverage 93.93% 94.04% +0.11%
==========================================
Files 27 28 +1
Lines 1846 1865 +19
==========================================
+ Hits 1734 1754 +20
+ Misses 112 111 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…docs Without backticks, Documenter looked for headers with these names instead of the docstrings, and the docs build failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A UnionDomain is plotted by plotting each of its components as a series, with only the first having a legend entry, so that e.g. a contour made of segments or a union of intervals can be plotted with `plot(d)`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends
DomainSetsMakieExtto plot more domains:UnionDomainis plotted by plotting each component in one colour, with colours cycling between unions. Components are plotted with their usual plot types and may be different kinds of domains, e.g. a disk and a rectangle.UnitSimplexis a filled triangle in 2D and a tetrahedron mesh in 3D. Other dimensions throw anArgumentError.UnitSquare()andUnitCube()used to throw aMethodError, because the conversion to a Makie rectangle only handledRectangle{<:SVector}. It now usesinfimum/supremum, which everyHyperRectanglesupports.Plots: a new
DomainSetsRecipesBaseExtplots aUnionDomainwith Plots by emitting each component as its own series. Only the first component is primary, so the others reuse its colour and get no legend entry. This makes, e.g.,plot(domain(G))work in Plots for a contour made of segments, with each segment drawn by its own recipe. For the whole union to be one colour, the component recipes must not forceprimary := true; the IntervalSets and RiemannHilbert recipes currently do, and would needprimary --> true. Tests useRecipesBase.apply_recipe, so Plots isn't a test dependency.Unions of intervals, e.g.
UnionDomain(0..1, 2..3), also work once JuliaMath/IntervalSets.jl#224 is released. That PR adds a Makie recipe for intervals, and the union recipe plots each interval with it. The corresponding test only runs when that extension is loaded.Compat: the union recipe uses the current
@recipesyntax, so the Makie compat is now0.21, 0.22, 0.23, 0.24, dropping 0.19 and 0.20. Users on those versions stay on the current release. On Makie < 0.24, colours only cycle between unions whose components have the same types, because the cycler is keyed by the concrete plot type.A small inconsistency: union pieces use the line colour palette, so a union of disks is fully opaque, whereas a single disk uses Makie's slightly transparent polygon palette. Matching them would mean choosing the palette per component type; happy to do that if you'd like.
Hash fix (separate commit): in Julia ≥ 1.13,
hash(x)uses a non-zero default seed (Base.HASH_SEED). So the one-argumentdomainhash(d), which used seed zero, no longer matchedhash(d). Eight level set and indicator function tests failed, and because each test file is a top-level testset, the run stopped before the extension tests.domainhash(d)now uses the same seed ashash(d).Testing:
Bumps the version to v0.8.3.
🤖 Generated with Claude Code