Skip to content

Commit

Permalink
Add a reference test
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 authored Dec 15, 2024
1 parent 24274fe commit b63dd94
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ReferenceTests/src/tests/examples2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit b63dd94

Please sign in to comment.