diff --git a/CHANGELOG.md b/CHANGELOG.md index d73e4b9b8be..f1e6d3fa141 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) - Added logical size annotation to `text/html` inline videos so that sizes are appropriate independent of the current `px_per_unit` value [#4563](https://github.com/MakieOrg/Makie.jl/pull/4563). ## [0.21.15] - 2024-10-25 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)`. 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 diff --git a/src/conversions.jl b/src/conversions.jl index cfdd000a1ae..08293fca20e 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[1.0e30, 0.0] elseif ls === :dash return line_diff_pattern("-", gaps) elseif ls === :dot