Skip to content

Commit 8089113

Browse files
authored
Merge branch 'master' into add-tricontour
2 parents 0c5580b + 381cf4a commit 8089113

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1061
-353
lines changed

CHANGELOG.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## [Unreleased]
44

5+
- Added `font` attribute and fixed faulty selection in `scatter`. Scatter fonts can now be themed with `markerfont`. [#4832](https://github.com/MakieOrg/Makie.jl/pull/4832)
6+
- Fixed categorical `cgrad` interpolating at small enough steps [#4858](https://github.com/MakieOrg/Makie.jl/pull/4858)
7+
- Added `tricontour` plot, which plots contour lines, similar to `tricontourf` [#4795](https://github.com/MakieOrg/Makie.jl/pull/4795).
8+
9+
## [0.22.2] - 2025-02-26
10+
11+
- Added support for curvilinear grids in `contourf` (contour filled), where `x` and `y` are matrices (`contour` lines were added in [0.22.0]) [#4670](https://github.com/MakieOrg/Makie.jl/pull/4670).
512
- Updated WGLMakie's threejs version from 0.157 to 0.173, fixing some threejs bugs [#4809](https://github.com/MakieOrg/Makie.jl/pull/4809).
613
- Moved Axis3 clip planes slightly outside to avoid clipping objects on the border with 0 margin [#4742](https://github.com/MakieOrg/Makie.jl/pull/4742)
714
- Fixed an issue with transformations not propagating to child plots when their spaces only match indirectly. [#4723](https://github.com/MakieOrg/Makie.jl/pull/4723)
@@ -24,7 +31,12 @@
2431
- Changed `inspectable` to be inherited from the parent scenes theme. [#4739](https://github.com/MakieOrg/Makie.jl/pull/4739)
2532
- Reverted change to `poly` which disallowed 3D geometries from being plotted [#4738](https://github.com/MakieOrg/Makie.jl/pull/4738)
2633
- Enabled autocompletion on Block types, e.g. `?Axis.xti...` [#4786](https://github.com/MakieOrg/Makie.jl/pull/4786)
27-
- Added `tricontour` plot, which plots contour lines, similar to `tricontourf` [#4795](https://github.com/MakieOrg/Makie.jl/pull/4795).
34+
- Added `dpi` metadata to all rendered png files, where `px_per_unit = 1` means 96dpi, `px_per_unit = 2` means 192dpi, and so on. This gives frontends a chance to show plain Makie png images with the correct scaling [#4812](https://github.com/MakieOrg/Makie.jl/pull/4812).
35+
- Fixed issue with voxels not working correctly with `rotate!()` [#4824](https://github.com/MakieOrg/Makie.jl/pull/4824)
36+
- Fixed issue with tick event not triggering in WGLMakie [#4818](https://github.com/MakieOrg/Makie.jl/pull/4818)
37+
- Improved performance of some Blocks, mainly `Textbox` and `Menu` [#4821](https://github.com/MakieOrg/Makie.jl/pull/4821)
38+
- Fixed issue with `PolarAxis` not considering tick visibility in protrusion calculations. [#4823](https://github.com/MakieOrg/Makie.jl/pull/4823)
39+
- Fixed some plots failing to create Legend entries due to missing attributes [#4826](https://github.com/MakieOrg/Makie.jl/pull/4826)
2840

2941
## [0.22.1] - 2025-01-17
3042

@@ -749,7 +761,8 @@ All other changes are collected [in this PR](https://github.com/MakieOrg/Makie.j
749761
- Fixed rendering of `heatmap`s with one or more reversed ranges in CairoMakie, as in `heatmap(1:10, 10:-1:1, rand(10, 10))` [#1100](https://github.com/MakieOrg/Makie.jl/pull/1100).
750762
- Fixed volume slice recipe and added docs for it [#1123](https://github.com/MakieOrg/Makie.jl/pull/1123).
751763

752-
[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.22.1...HEAD
764+
[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.22.2...HEAD
765+
[0.22.2]: https://github.com/MakieOrg/Makie.jl/compare/v0.22.1...v0.22.2
753766
[0.22.1]: https://github.com/MakieOrg/Makie.jl/compare/v0.22.0...v0.22.1
754767
[0.22.0]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.18...v0.22.0
755768
[0.21.18]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.17...v0.21.18

CairoMakie/Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CairoMakie"
22
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
33
author = ["Simon Danisch <[email protected]>"]
4-
version = "0.13.1"
4+
version = "0.13.2"
55

66
[deps]
77
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
@@ -24,7 +24,7 @@ FileIO = "1.1"
2424
FreeType = "3, 4.0"
2525
GeometryBasics = "0.5"
2626
LinearAlgebra = "1.0, 1.6"
27-
Makie = "=0.22.1"
27+
Makie = "=0.22.2"
2828
PrecompileTools = "1.0"
2929
julia = "1.3"
3030

GLMakie/Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "GLMakie"
22
uuid = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
3-
version = "0.11.2"
3+
version = "0.11.3"
44

55
[deps]
66
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
@@ -30,7 +30,7 @@ FreeTypeAbstraction = "0.10"
3030
GLFW = "3.4.3"
3131
GeometryBasics = "0.5"
3232
LinearAlgebra = "1.0, 1.6"
33-
Makie = "=0.22.1"
33+
Makie = "=0.22.2"
3434
Markdown = "1.0, 1.6"
3535
MeshIO = "0.5"
3636
ModernGL = "1"

GLMakie/assets/shader/voxel.vert

+2-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ void main() {
174174
// the quad is associated with the "previous" or "next" slice of voxels. We
175175
// can derive that from the normal direction, as the normal always points
176176
// away from the voxel center.
177-
o_uvw = (plane_vertex - 0.5 * (1.0 - gap) * o_normal) / size;
177+
// requires object space normal (unit_vecs[dim])
178+
o_uvw = (plane_vertex - 0.5 * (1.0 - gap) * normal_dir * unit_vecs[dim]) / size;
178179

179180
// normal in: -x -y -z +x +y +z direction
180181
o_side = dim + 3 * int(0.5 + 0.5 * normal_dir);

GLMakie/src/drawing_primitives.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ function draw_atomic(screen::Screen, scene::Scene, @nospecialize(plot::Union{Sca
451451
return nothing
452452
end
453453
end
454-
font = get(gl_attributes, :font, Observable(Makie.defaultfont()))
454+
font = map(to_font, pop!(gl_attributes, :font))
455455
gl_attributes[:uv_offset_width][] == Vec4f(0) && delete!(gl_attributes, :uv_offset_width)
456456
get!(gl_attributes, :uv_offset_width) do
457457
return Makie.primitive_uv_offset_width(atlas, marker, font)

GLMakie/src/glshaders/voxel.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ function draw_voxels(screen, main::VolumeTypes, data::Dict)
33
geom = Rect2f(Point2f(0), Vec2f(1.0))
44
to_opengl_mesh!(screen.glscreen, data, const_lift(GeometryBasics.triangle_mesh, geom))
55
shading = pop!(data, :shading, FastShading)
6+
debug = to_value(pop!(data, :debug, ""))
67
@gen_defaults! data begin
78
voxel_id = main => Texture
89
gap = 0f0
@@ -26,7 +27,7 @@ function draw_voxels(screen, main::VolumeTypes, data::Dict)
2627
"MAX_LIGHT_PARAMETERS" => "#define MAX_LIGHT_PARAMETERS $(screen.config.max_light_parameters)",
2728
"buffers" => output_buffers(screen, to_value(transparency)),
2829
"buffer_writes" => output_buffer_writes(screen, to_value(transparency)),
29-
"DEBUG_FLAG_DEFINE" => to_value(get(data, :debug, ""))
30+
"DEBUG_FLAG_DEFINE" => debug
3031
)
3132
)
3233
end

GLMakie/test/runtests.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ end
110110
sleep(0.1)
111111
GLMakie.closeall()
112112

113-
# Why does it start with a skipped tick?
113+
# Why does it start with a skipped tick?
114114
i = 1
115115
while tick_record[i].state == Makie.SkippedRenderTick
116116
check_tick(tick_record[1], Makie.SkippedRenderTick, i)
@@ -134,6 +134,11 @@ end
134134
end
135135

136136

137+
138+
139+
# NOTE: Keep this at the end! It also verifies that all cleanup is complete after
140+
# all other tests have finished
141+
137142
@testset "gl object deletion" begin
138143
GLMakie.closeall()
139144

MakieCore/Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MakieCore"
22
uuid = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
33
authors = ["Simon Danisch"]
4-
version = "0.9.0"
4+
version = "0.9.1"
55

66
[deps]
77
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"

MakieCore/src/basic_plots.jl

+2
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ Plots a marker for each element in `(x, y, z)`, `(x, y)`, or `positions`.
484484
marker_offset = Vec3f(0)
485485
"Controls whether the model matrix (without translation) applies to the marker itself, rather than just the positions. (If this is true, `scale!` and `rotate!` will affect the marker."
486486
transform_marker = false
487+
"Sets the font used for character markers. Can be a `String` specifying the (partial) name of a font or the file path of a font file"
488+
font = @inherit markerfont
487489
"Optional distancefield used for e.g. font and bezier path rendering. Will get set automatically."
488490
distancefield = nothing
489491
uv_offset_width = (0.0, 0.0, 0.0, 0.0)

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Makie"
22
uuid = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
33
authors = ["Simon Danisch", "Julius Krumbiegel"]
4-
version = "0.22.1"
4+
version = "0.22.2"
55

66
[deps]
77
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
@@ -97,7 +97,7 @@ KernelDensity = "0.5, 0.6"
9797
LaTeXStrings = "1.2"
9898
LinearAlgebra = "1.0, 1.6"
9999
MacroTools = "0.5"
100-
MakieCore = "=0.9"
100+
MakieCore = "=0.9.1"
101101
Markdown = "1.0, 1.6"
102102
MathTeXEngine = "0.5, 0.6"
103103
Observables = "0.5.5"

RPRMakie/Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RPRMakie"
22
uuid = "22d9f318-5e34-4b44-b769-6e3734a732a6"
33
authors = ["Simon Danisch"]
4-
version = "0.8.1"
4+
version = "0.8.2"
55

66
[deps]
77
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
@@ -17,7 +17,7 @@ Colors = "0.9, 0.10, 0.11, 0.12, 0.13"
1717
FileIO = "1.6"
1818
GeometryBasics = "0.5"
1919
LinearAlgebra = "1.0, 1.6"
20-
Makie = "=0.22.1"
20+
Makie = "=0.22.2"
2121
Printf = "1.0, 1.6"
2222
RadeonProRender = "0.3.2"
2323
julia = "1.3"

ReferenceTests/src/tests/attributes.jl

+51-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,60 @@
66
fig
77
end
88

9-
@reference_test "(mesh)scatter with NaN rotation and markersize" begin
10-
scene = Scene(size = (150, 300))
9+
@reference_test "(mesh)scatter with NaN rotation and markersize, edge cases" begin
10+
parent = Scene(size = (300, 300))
11+
scene = Scene(parent, viewport = Rect2f(0,0, 150, 300))
1112
xs = [-0.6, 0.0, 0.6]
1213
scatter!(scene, xs, fill( 0.75, 3), marker = :ltriangle, rotation = [0.5, NaN, -0.5], markersize = 50)
1314
scatter!(scene, xs, fill( 0.25, 3), marker = :ltriangle, markersize = [50, NaN, 50])
1415
meshscatter!(scene, xs, fill(-0.25, 3), marker = Rect2f(-0.5,-0.5,1,1), rotation = [0.5, NaN, -0.5], markersize = 0.2)
1516
meshscatter!(scene, xs, fill(-0.75, 3), marker = Rect2f(-0.5,-0.5,1,1), markersize = [0.2, NaN, 0.2])
16-
scene
17+
18+
# Edge case: Quaternionf(0,0,0,1) should not default billboard to true
19+
scene3 = Scene(parent, viewport = Rect2f(150, 0, 150, 300), camera = cam3d!)
20+
scatter!(scene3, (0.5, 0.5, 0), marker = Rect,
21+
rotation = Quaternionf(0.01,0,0,1), markersize = 0.5, markerspace = :data)
22+
scatter!(scene3, (-0.5, 0.5, 0), marker = Rect,
23+
rotation = Quaternionf(0,0,0,1), markersize = 0.5, markerspace = :data)
24+
scatter!(scene3, [-0.5, 0.5], [-0.5, -0.5], [0, 0], marker = Rect, markersize = 0.5, markerspace = :data)
25+
26+
parent
27+
end
28+
29+
@reference_test "Categorical color interpolation" begin
30+
parent = Scene(size = (500, 500))
31+
32+
# test with cgrad
33+
# - optimally switch near horizontal center (colormap gets upscaled to colorrange)
34+
# - no interpolation (match image behind marker/line (slightly above or below))
35+
scene = Scene(parent, viewport = Rect2f(0, 0, 500, 190))
36+
cg = cgrad(:viridis, 5, categorical = true, scale = log10);
37+
scatter_kwargs = (colorrange = (0, 1000), colormap = cg, marker = Rect, markersize = 25)
38+
line_kwargs = (colorrange = (0, 1000), colormap = cg, linewidth = 10)
39+
image!(scene, -1..1, -1..1, reshape(cg.colors.colors, (1, 5)), interpolate = false)
40+
for i in 2:5
41+
edge = cg.values[i]
42+
y = range(-1, 1, length=6)[i]
43+
scatter!(scene, -1..1, fill(y, 15), color = round(Int, 1000 * edge) .+ (-5:9); scatter_kwargs...)
44+
lines!(scene, -1..1, fill(y, 15), color = round(Int, 1000 * edge) .+ (-5:9); line_kwargs...)
45+
end
46+
47+
# test with categorical
48+
# - optimally alternate between black and white (no downscaling of colormap)
49+
# - no interpolation (match image behind marker/line (slightly above or below))
50+
scene = Scene(parent, viewport = Rect2f(0, 200, 500, 300))
51+
cg = Categorical([RGBf(i%2, i%2, i%2) for i in 0:1000]);
52+
scatter_kwargs = (colorrange = (0, 1000), colormap = cg, marker = Rect, markersize = 20, alpha = 1)
53+
line_kwargs = (colorrange = (0, 1000), colormap = cg, linewidth = 8, alpha = 1)
54+
cm = to_colormap(cg)
55+
image!(scene, -1..1, -1..1, reshape(cm[1:6], (1, 6)), interpolate = false)
56+
p = nothing
57+
for i in 1:5
58+
edge = 100 * i
59+
y = range(-1, 1, length=7)[i+1]
60+
p = scatter!(scene, -1..1, fill(y, 15), color = edge .+ (-7:7); scatter_kwargs...)
61+
lines!(scene, -1..1, fill(y, 15), color = edge .+ (-7:7); line_kwargs...)
62+
end
63+
64+
parent
1765
end

ReferenceTests/src/tests/examples2d.jl

+22
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,28 @@ end
894894
fig
895895
end
896896

897+
@reference_test "filled contour 2d with curvilinear grid" begin
898+
x = -10:10
899+
y = -10:10
900+
# The curvilinear grid:
901+
xs = [x + 0.01y^3 for x in x, y in y]
902+
ys = [y + 10cos(x/40) for x in x, y in y]
903+
904+
# Now, for simplicity, we calculate the `Z` values to be
905+
# the radius from the center of the grid (0, 10).
906+
zs = sqrt.(xs .^ 2 .+ (ys .- 10) .^ 2)
907+
908+
# We can use Makie's tick finders to get some nice looking contour levels.
909+
# This could also be Makie.get_tickvalues(Makie.LinearTicks(7), extrema(zs)...)
910+
# but it's more stable as a test if we hardcode it.
911+
levels = 0:4:20
912+
913+
# and now, we plot!
914+
fig, ax, ctr = contourf(xs, ys, zs; levels = levels)
915+
916+
fig
917+
end
918+
897919
@reference_test "contour labels 3D" begin
898920
fig = Figure()
899921
Axis3(fig[1, 1])

ReferenceTests/src/tests/figures_and_makielayout.jl

+22-22
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@ end
5050
[
5151
Label(fig, "A", width = nothing) Label(fig, "C", width = nothing);
5252
menu1 menu3;
53+
Box(fig, visible = false) Box(fig, visible = false);
5354
Label(fig, "B", width = nothing) Label(fig, "D", width = nothing);
5455
menu2 menu4;
5556
]
5657
)
57-
menu2.is_open = true
58+
59+
menu1.is_open = true
5860
menu4.is_open = true
61+
5962
fig
6063
end
6164

@@ -233,37 +236,25 @@ end
233236
fig
234237
end
235238

236-
@reference_test "PolarAxis surface" begin
237-
f = Figure()
238-
ax = PolarAxis(f[1, 1])
239-
zs = [r*cos(phi) for phi in range(0, 4pi, length=100), r in range(1, 2, length=100)]
240-
p = surface!(ax, 0..2pi, 0..10, zs, shading = NoShading, colormap = :coolwarm, colorrange=(-2, 2))
241-
rlims!(ax, 0, 11) # verify that r = 10 doesn't end up at r > 10
242-
translate!(p, 0, 0, -200)
243-
Colorbar(f[1, 2], p)
244-
f
245-
end
246-
247-
# may fail in WGLMakie due to missing dashes
248-
@reference_test "PolarAxis scatterlines spine" begin
249-
f = Figure(size = (800, 400))
239+
@reference_test "PolarAxis decorations" begin
240+
# may fail in WGLMakie due to missing dashes
241+
# tests: some decorations, theta_as_x, title, scatter, lines
242+
f = Figure(size = (800, 800), backgroundcolor = :gray)
250243
ax1 = PolarAxis(f[1, 1], title = "No spine", spinevisible = false, theta_as_x = false)
251244
scatterlines!(ax1, range(0, 1, length=100), range(0, 10pi, length=100), color = 1:100)
252245

253246
ax2 = PolarAxis(f[1, 2], title = "Modified spine")
254247
ax2.spinecolor[] = :red
255248
ax2.spinestyle[] = :dash
256249
ax2.spinewidth[] = 5
250+
rlims!(ax2, 0, 1.5)
257251
scatterlines!(ax2, range(0, 10pi, length=100), range(0, 1, length=100), color = 1:100)
258-
f
259-
end
260252

261-
# may fail in CairoMakie due to different text stroke handling
262-
# and in WGLMakie due to missing stroke
263-
@reference_test "PolarAxis decorations" begin
264-
f = Figure(size = (400, 400), backgroundcolor = :black)
253+
# may fail in CairoMakie due to different text stroke handling
254+
# and in WGLMakie due to missing stroke
255+
# tests: decorations
265256
ax = PolarAxis(
266-
f[1, 1],
257+
f[2, 1],
267258
backgroundcolor = :black,
268259
rminorgridvisible = true, rminorgridcolor = :red,
269260
rminorgridwidth = 1.0, rminorgridstyle = :dash,
@@ -278,6 +269,15 @@ end
278269
thetaticks = ([0, π/2, π, 3π/2], ["A", "B", "C", rich("D", color = :orange)]), # https://github.com/MakieOrg/Makie.jl/issues/3583
279270
rticks = ([0.0, 2.5, 5.0, 7.5, 10.0], ["0.0", "2.5", "5.0", "7.5", rich("10.0", color = :orange)])
280271
)
272+
273+
# tests: surface, grid layering, hidedecorations!() effect on spacing
274+
ax = PolarAxis(f[2, 2], gridz = 1, backgroundcolor = :lightblue)
275+
hidedecorations!(ax)
276+
ax.rgridvisible[] = true
277+
ax.thetagridvisible[] = true
278+
zs = [r*cos(phi) for phi in range(0, 4pi, length=100), r in range(1, 2, length=100)]
279+
p = surface!(ax, 0..2pi, 0..10, zeros(size(zs)), color = zs, shading = NoShading, colormap = :coolwarm, colorrange=(-2, 2))
280+
rlims!(ax, 0, 11) # verify that r = 10 doesn't end up at r > 10
281281
f
282282
end
283283

ReferenceTests/src/tests/primitives.jl

+20
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ end
790790
cs = [:white, :red, :green, :blue, :black, :orange, :cyan, :magenta]
791791
voxels(fig[1, 1], chunk, color = cs, axis=(show_axis = false,))
792792
a, p = voxels(fig[1, 2], Float32.(chunk), colormap = [:red, :blue], is_air = x -> x == 0.0, axis=(show_axis = false,))
793+
Makie.rotate!(p, Vec3f(1,2,3), 0.8)
793794
fig
794795
end
795796

@@ -1160,3 +1161,22 @@ end
11601161

11611162
fig
11621163
end
1164+
1165+
@reference_test "Scatter fonts" begin
1166+
scene = Scene(size = (150, 150), camera = campixel!)
1167+
1168+
# Just needs to not be Fira Mona here, but good to test the default too
1169+
@test Makie.to_font(Makie.automatic) == Makie.to_font("TeX Gyre Heros Makie")
1170+
1171+
scatter!(scene, (40, 40), marker=Rect, markersize=45, color = :black, strokecolor = :red, strokewidth = 1)
1172+
scatter!(scene, (40, 40), marker='', markersize=45, color = :white)
1173+
scatter!(scene, (110, 40), marker=Rect, markersize=45, color = :green, strokecolor = :red, strokewidth = 1)
1174+
text!(scene, (110, 40), text = "", fontsize = 45, align = (:center, :center), color = :white)
1175+
1176+
scatter!(scene, (40, 110), marker=Rect, font = "Fira Mono", markersize=45, color = :black, strokecolor = :red, strokewidth = 1)
1177+
scatter!(scene, (40, 110), marker='', font = "Fira Mono", markersize=45, color = :white)
1178+
scatter!(scene, (110, 110), marker=Rect, font = "Fira Mono", markersize=45, color = :green, strokecolor = :red, strokewidth = 1)
1179+
text!(scene, (110, 110), text = "", font = "Fira Mono", fontsize = 45, align = (:center, :center), color = :white)
1180+
1181+
scene
1182+
end

0 commit comments

Comments
 (0)