From bc9c1f7537f9d0ccd7339fb685bbf6d45f6b2cd4 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Mon, 5 Aug 2024 11:35:05 +0200 Subject: [PATCH 1/6] adds lscene limits example --- docs/src/.vitepress/config.mts | 1 + examples/3d/mscatters/lscene_limits.jl | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 examples/3d/mscatters/lscene_limits.jl diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index dd5f8146..cea0b6f3 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -358,6 +358,7 @@ const viteConfig = defineViteConfig({ { text: 'RRGraph3D',link: '/examples/3d/mscatters/RRGraph3D' }, { text: 'SSAO_meshscatter',link: '/examples/3d/mscatters/SSAO_meshscatter' }, { text: 'SSAO_mgrid',link: '/examples/3d/mscatters/SSAO_mgrid' }, + { text: 'LScene limits',link: '/examples/3d/mscatters/lscene_limits' }, ], }, { diff --git a/examples/3d/mscatters/lscene_limits.jl b/examples/3d/mscatters/lscene_limits.jl new file mode 100644 index 00000000..84388d6a --- /dev/null +++ b/examples/3d/mscatters/lscene_limits.jl @@ -0,0 +1,18 @@ +# ## Sets limits on a LScene + +# ![](lscene_limits.png) + +using GLMakie +using Random +Random.seed!(1618) +GLMakie.activate!() + +fig = Figure() +ax = LScene(fig[1, 1], scenekw = (; + limits=Rect3f(Vec3f(0,0,0),Vec3f(1.5, 1.5, 2.5))) + ) +meshscatter!(ax, rand(Point3f, 10); color = :orangered) +meshscatter!(ax, rand(Point3f, 10) .+ Point3f(0,0,1); + color = :grey25, marker=Rect3f(Vec3f(-0.5), Vec3f(1))) +fig +save("lscene_limits.png", fig); # hide \ No newline at end of file From f6dfcfd0137fbbce68277f64e0280b85cb79e4f8 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Tue, 6 Aug 2024 20:03:14 +0200 Subject: [PATCH 2/6] regression Mesh --- examples/3d/meshes/isosurfaces.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/3d/meshes/isosurfaces.jl b/examples/3d/meshes/isosurfaces.jl index 29e0e22e..9bcd7a0f 100644 --- a/examples/3d/meshes/isosurfaces.jl +++ b/examples/3d/meshes/isosurfaces.jl @@ -9,13 +9,14 @@ using Meshing, GeometryBasics GLMakie.activate!() isoval = 100 -algo = MarchingCubes(iso=isoval, insidepositive=false) +algo = MarchingCubes(; iso=isoval) function show_isosurface(f,h,ξ; color=(:dodgerblue,0.5)) s = [h(x,y,z) for x in ξ, y in ξ, z in ξ] .+ isoval - mc = GeometryBasics.Mesh(s, algo) - - return mesh(f, normal_mesh(mc); color, + # generate the mesh using marching cubes + vts, fcs = isosurface(s, algo) + # mc = GeometryBasics.Mesh(s, algo) + return mesh(f, vts, map(v -> GeometryBasics.TriangleFace(v...), fcs); color, diffuse = Vec3f0(0.8), specular = Vec3f0(1.1), shininess = 30f0, From a9119ef9e20b7487ccbcd2dbb1fb87c52563c226 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Tue, 6 Aug 2024 20:29:42 +0200 Subject: [PATCH 3/6] scope --- examples/3d/meshes/isosurfaces.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/3d/meshes/isosurfaces.jl b/examples/3d/meshes/isosurfaces.jl index 9bcd7a0f..ba3c9932 100644 --- a/examples/3d/meshes/isosurfaces.jl +++ b/examples/3d/meshes/isosurfaces.jl @@ -8,10 +8,9 @@ using GLMakie using Meshing, GeometryBasics GLMakie.activate!() -isoval = 100 -algo = MarchingCubes(; iso=isoval) +function show_isosurface(f,h,ξ; color=(:dodgerblue,0.5), isoval=100) + algo = MarchingCubes(; iso=isoval) -function show_isosurface(f,h,ξ; color=(:dodgerblue,0.5)) s = [h(x,y,z) for x in ξ, y in ξ, z in ξ] .+ isoval # generate the mesh using marching cubes vts, fcs = isosurface(s, algo) From d765a43b087178d342e9a0939e474a86c6b31ba8 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Tue, 6 Aug 2024 20:49:11 +0200 Subject: [PATCH 4/6] parsing comments? issue --- examples/3d/meshes/isosurfaces.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/3d/meshes/isosurfaces.jl b/examples/3d/meshes/isosurfaces.jl index ba3c9932..7eeb6f92 100644 --- a/examples/3d/meshes/isosurfaces.jl +++ b/examples/3d/meshes/isosurfaces.jl @@ -12,10 +12,15 @@ function show_isosurface(f,h,ξ; color=(:dodgerblue,0.5), isoval=100) algo = MarchingCubes(; iso=isoval) s = [h(x,y,z) for x in ξ, y in ξ, z in ξ] .+ isoval - # generate the mesh using marching cubes + + ## generate the mesh using marching cubes + vts, fcs = isosurface(s, algo) - # mc = GeometryBasics.Mesh(s, algo) - return mesh(f, vts, map(v -> GeometryBasics.TriangleFace(v...), fcs); color, + + ## mc = GeometryBasics.Mesh(s, algo) + + return mesh(f, vts, map(v -> GeometryBasics.TriangleFace(v...), fcs); + color, diffuse = Vec3f0(0.8), specular = Vec3f0(1.1), shininess = 30f0, From b9f940d658cf2a1e974f2f47c9cf5cbbe9cc2e8e Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Wed, 7 Aug 2024 17:20:15 +0200 Subject: [PATCH 5/6] fixes AoG, and found bugs --- docs/gen_mds.jl | 1 + examples/aog/MarketData.jl | 4 ++-- examples/aog/density_ridges.jl | 3 ++- examples/aog/penguinsAoG.jl | 4 ++-- examples/aog/textScatterLines.jl | 6 +++--- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/gen_mds.jl b/docs/gen_mds.jl index 859dcce2..3f7c7f91 100644 --- a/docs/gen_mds.jl +++ b/docs/gen_mds.jl @@ -23,6 +23,7 @@ function get_files(folders) "textScatterLines.jl", "gott_azimuthal.jl", "us_states.jl", + "gapminder", ]) fpaths = "$(f)/" .* names diff --git a/examples/aog/MarketData.jl b/examples/aog/MarketData.jl index 1caabc80..bba01aed 100644 --- a/examples/aog/MarketData.jl +++ b/examples/aog/MarketData.jl @@ -32,11 +32,11 @@ save("market_data2.svg", current_figure()); # hide df = DataFrame(ohlc) pltd = data(df[200:280,:]) plt = pltd * mapping(:timestamp, :Open => "StockChart") -plt *= mapping(fillto=:Close, color = (:Open, :Close) => isless => "Open isless => "Open (t -> t / 10) => "flipper length (cm)", :bill_length_mm => (t -> t / 10) => "bill length (cm)") ## declare the grouping and the respective visual attribute -p_len *= mapping(color=:species, marker=:species) +p_len *= mapping(color=:species) with_theme(theme_ggplot2(),size = (600,400), palette=palette, Scatter=(cycle=cycle,)) do - draw(p_len + p_len * linear(); + draw(p_len * mapping(marker=:species) + p_len * linear(); axis = (; title="Flipper and bill length")) end diff --git a/examples/aog/textScatterLines.jl b/examples/aog/textScatterLines.jl index ae51ee32..92bf44da 100644 --- a/examples/aog/textScatterLines.jl +++ b/examples/aog/textScatterLines.jl @@ -8,9 +8,9 @@ d = DataFrame(name = repeat(["A","B","C","D","E","F"], inner=4), time=repeat([0,1,3,6], outer=6), value = rand(24)); pSL = data(d) -pSL *= mapping(:time, :value, color = :name, #text = :name => verbatim # now is not working :( - ) -pSL *= visual(ScatterLines) # + visual(Makie.Text, align = (:center, :bottom)) +pSL *= mapping(:time, :value) +pSL *= mapping(color = :name) * visual(ScatterLines) + + mapping(color = :name, text = :name => verbatim) * visual(Makie.Text, align = (:center, :bottom)) with_theme(theme_ggplot2(), size = (600,400)) do draw(pSL) end From ee859e433fffbbf1a8ff1a4f8afa7796e8cfbff1 Mon Sep 17 00:00:00 2001 From: Lazaro Alonso Date: Wed, 7 Aug 2024 19:07:32 +0200 Subject: [PATCH 6/6] missed extension --- docs/gen_mds.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/gen_mds.jl b/docs/gen_mds.jl index 3f7c7f91..e4ee31df 100644 --- a/docs/gen_mds.jl +++ b/docs/gen_mds.jl @@ -23,7 +23,7 @@ function get_files(folders) "textScatterLines.jl", "gott_azimuthal.jl", "us_states.jl", - "gapminder", + "gapminder.jl", ]) fpaths = "$(f)/" .* names