From b63dd94ef3a7273863d8de160a73ee85ae3491b6 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sun, 15 Dec 2024 09:49:07 +0530 Subject: [PATCH] Add a reference test --- ReferenceTests/src/tests/examples2d.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ReferenceTests/src/tests/examples2d.jl b/ReferenceTests/src/tests/examples2d.jl index de209fdb03b..5a0a961f886 100644 --- a/ReferenceTests/src/tests/examples2d.jl +++ b/ReferenceTests/src/tests/examples2d.jl @@ -865,6 +865,32 @@ end f end +@reference_test "contour 2d with curvilinear grid" begin + x = -10:10 + y = -10:10 + # The curvilinear grid: + xs = [x + 0.01y^3 for x in x, y in y] + ys = [y + 10cos(x/40) for x in x, y in y] + + # Now, for simplicity, we calculate the `Z` values to be + # the radius from the center of the grid (0, 10). + zs = sqrt.(xs .^ 2 .+ (ys .- 10) .^ 2) + + + # We can use Makie's tick finders to get some nice looking contour levels. + # This could also be Makie.get_tickvalues(Makie.LinearTicks(7), extrema(zs)...) + # but it's more stable as a test if we hardcode it. + levels = 0:4:20 + + + # and now, we plot! + fig, ax, srf = surface(xs, ys, zs; shading = NoShading, axis = (; type = Axis, aspect = DataAspect())) + ctr = contour!(ax, xs, ys, zs; color = :orange, levels = levels, labels = true, labelfont = :bold, labelsize = 12) + translate!(ctr, 0, 0, 10) + + fig +end + @reference_test "contour labels 3D" begin fig = Figure() Axis3(fig[1, 1])