From b60c1815c8dab3cd32b8d68a6331c2c94effb45e Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 5 Nov 2024 15:28:52 +0100 Subject: [PATCH 1/5] add :solid_pattern --- src/conversions.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conversions.jl b/src/conversions.jl index cfdd000a1ae..0750f3d06d5 100644 --- a/src/conversions.jl +++ b/src/conversions.jl @@ -1125,6 +1125,8 @@ end function line_diff_pattern(ls::Symbol, gaps::GapType = :normal) if ls === :solid return nothing + elseif ls === :solid_pattern + return Float64[] elseif ls === :dash return line_diff_pattern("-", gaps) elseif ls === :dot From 76cdde0347579d8db44431dc180a4a92ed0b3882 Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 5 Nov 2024 15:29:09 +0100 Subject: [PATCH 2/5] add test --- ReferenceTests/src/tests/updating.jl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ReferenceTests/src/tests/updating.jl b/ReferenceTests/src/tests/updating.jl index 1482da75cc3..a6c20c34654 100644 --- a/ReferenceTests/src/tests/updating.jl +++ b/ReferenceTests/src/tests/updating.jl @@ -278,3 +278,22 @@ end notify(Z) Makie.step!(st) end + +@reference_test "updating linestyles" begin + scene = Scene(size = (300, 100)) + p1 = lines!(scene, [-0.8, 0.8], [0.4, 0.4], linestyle = :solid_pattern, linewidth = 10) + p2 = lines!(scene, [-0.8, 0.8], [0, 0], linestyle = :dash, linewidth = 10) + p3 = linesegments!(scene, [-0.8, -0.25, 0.25, 0.8], [-0.5, -0.5, -0.5, -0.5], linestyle = :solid_pattern, linewidth = 10) + p4 = lines!(scene, Point2f[(-0.95, 0.9), (-0.9, -0.9), (-0.85, 0.8), (0.9, 0.8), (0.9, -0.9)], linestyle = :solid_pattern, linewidth = 10) + scene + + st = Stepper(scene) + Makie.step!(st) + + p1.linestyle[] = :dashdot + p2.linestyle[] = :solid_pattern + p3.linestyle[] = :dot + p4.linestyle[] = Linestyle([0.0, 1.0, 2.0]) + + Makie.step!(st) +end \ No newline at end of file From aa49f801a4168f679fd8e323d951ed80719cea60 Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 5 Nov 2024 15:31:54 +0100 Subject: [PATCH 3/5] add docs --- MakieCore/src/basic_plots.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MakieCore/src/basic_plots.jl b/MakieCore/src/basic_plots.jl index 35a0c5b0aa2..420b8e2946c 100644 --- a/MakieCore/src/basic_plots.jl +++ b/MakieCore/src/basic_plots.jl @@ -351,7 +351,7 @@ Creates a connected line plot for each element in `(x, y, z)`, `(x, y)` or `posi "Sets the width of the line in screen units" linewidth = @inherit linewidth """ - Sets the dash pattern of the line. Options are `:solid` (equivalent to `nothing`), `:dot`, `:dash`, `:dashdot` and `:dashdotdot`. + Sets the dash pattern of the line. Options are `:solid` (equivalent to `nothing`), `:solid_pattern` (can change to non-solid linestyles), `:dot`, `:dash`, `:dashdot` and `:dashdotdot`. These can also be given in a tuple with a gap style modifier, either `:normal`, `:dense` or `:loose`. For example, `(:dot, :loose)` or `(:dashdot, :dense)`. @@ -392,7 +392,7 @@ Plots a line for each pair of points in `(x, y, z)`, `(x, y)`, or `positions`. "Sets the width of the line in pixel units" linewidth = @inherit linewidth """ - Sets the dash pattern of the line. Options are `:solid` (equivalent to `nothing`), `:dot`, `:dash`, `:dashdot` and `:dashdotdot`. + Sets the dash pattern of the line. Options are `:solid` (equivalent to `nothing`), `:solid_pattern` (can change to non-solid linestyles), `:dot`, `:dash`, `:dashdot` and `:dashdotdot`. These can also be given in a tuple with a gap style modifier, either `:normal`, `:dense` or `:loose`. For example, `(:dot, :loose)` or `(:dashdot, :dense)`. From 03ccee21984ddf92e804d9b2ca744f9bf78ffea5 Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 5 Nov 2024 15:42:07 +0100 Subject: [PATCH 4/5] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74cebd149f0..3b4bc98235b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,11 @@ - Allow plots to move between scenes in SpecApi [#4132](https://github.com/MakieOrg/Makie.jl/pull/4132). - Added empty constructor to all backends for `Screen` allowing `display(Makie.current_backend().Screen(), fig)` [#4561](https://github.com/MakieOrg/Makie.jl/pull/4561). - Added `subsup` and `left_subsup` functions that offer stacked sub- and superscripts for `rich` text which means this style can be used with arbitrary fonts and is not limited to fonts supported by MathTeXEngine.jl [#4489](https://github.com/MakieOrg/Makie.jl/pull/4489). -- Added the `jitter_width` and `side_nudge` attributes to the `raincloud` plot definition, so that they can be used as kwargs [#4517]https://github.com/MakieOrg/Makie.jl/pull/4517) +- Added the `jitter_width` and `side_nudge` attributes to the `raincloud` plot definition, so that they can be used as kwargs [#4517](https://github.com/MakieOrg/Makie.jl/pull/4517) - Expand PlotList plots to expose their child plots to the legend interface, allowing `axislegend`show plots within PlotSpecs as individual entries. [#4546](https://github.com/MakieOrg/Makie.jl/pull/4546) - Implement S.Colorbar(plotspec) [#4520](https://github.com/MakieOrg/Makie.jl/pull/4520). - Fixed a hang when `Record` was created inside a closure passed to `IOCapture.capture` [#4562](https://github.com/MakieOrg/Makie.jl/pull/4562). +- Added `linestyle = :solid_pattern` to allow switching between non-solid and (effectively) solid linestyles. [#4570](https://github.com/MakieOrg/Makie.jl/pull/4570) ## [0.21.15] - 2024-10-25 From cbb5096828111f6fa63ed396a3277c7e866e9866 Mon Sep 17 00:00:00 2001 From: ffreyer Date: Tue, 5 Nov 2024 17:45:06 +0100 Subject: [PATCH 5/5] try semi-infinite drawn section --- src/conversions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conversions.jl b/src/conversions.jl index 0750f3d06d5..08293fca20e 100644 --- a/src/conversions.jl +++ b/src/conversions.jl @@ -1126,7 +1126,7 @@ function line_diff_pattern(ls::Symbol, gaps::GapType = :normal) if ls === :solid return nothing elseif ls === :solid_pattern - return Float64[] + return Float64[1.0e30, 0.0] elseif ls === :dash return line_diff_pattern("-", gaps) elseif ls === :dot