Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting polygons with dashed and dotted strokestyle broken #3109

Closed
lassepe opened this issue Jul 30, 2023 · 2 comments
Closed

Plotting polygons with dashed and dotted strokestyle broken #3109

lassepe opened this issue Jul 30, 2023 · 2 comments
Labels

Comments

@lassepe
Copy link
Contributor

lassepe commented Jul 30, 2023

On Makie master (and 0.19.7), plotting polygons with dashed or dotted strokestyle is broken. Git bisect points to 0b7e590

It may be good to add the below reproducer as a test, too.

Reproducer:

using CairoMakie: CairoMakie
using Makie: Makie

CairoMakie.activate!()
figure = Makie.Figure()
axis = Makie.Axis(figure[1, 1])
Makie.poly!(
    axis,
    Makie.Rect(0.0, 0.0, 1.0, 1.0);
    strokewidth = 1,
    linestyle = :dash,
)

Makie.save("test.png", figure)

Error:

ERROR: LoadError: MethodError: no method matching diff(::Float64)

Closest candidates are:
  diff(::FillArrays.AbstractFill{T, 1}) where T
   @ FillArrays ~/.julia/packages/FillArrays/zFq6r/src/FillArrays.jl:624
  diff(::StaticArraysCore.StaticArray{Tuple{N}, T, 1} where {N, T})
   @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/mapreduce.jl:312
  diff(::StaticArraysCore.StaticArray; dims)
   @ StaticArrays ~/.julia/packages/StaticArrays/9KYrc/src/mapreduce.jl:311
  ...
Click to expand stacktrace
Stacktrace:
  [1] (::CairoMakie.var"#64#65"{})(r::GeometryBasics.HyperRectangle{…}, c::ColorTypes.RGBA{…}, sc::ColorTypes.RGBA{…}, ss::Float64, sw::Int64)
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/overrides.jl:93
  [2] macro expansion
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/utilities/utilities.jl:216 [inlined]
  [3] broadcast_foreach(::CairoMakie.var"#64#65"{}, ::Vector{…}, ::ColorTypes.RGBA{…}, ::ColorTypes.RGBA{…}, ::Vector{…}, ::Int64)
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/utilities/utilities.jl:202
  [4] draw_poly(scene::Makie.Scene, screen::CairoMakie.Screen{CairoMakie.IMAGE}, poly::MakieCore.Poly{Tuple{…}}, rects::Vector{GeometryBasics.Rect2{…}})
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/overrides.jl:88
  [5] draw_poly(scene::Makie.Scene, screen::CairoMakie.Screen{CairoMakie.IMAGE}, poly::MakieCore.Poly{Tuple{GeometryBasics.Rect2{…}}}, rect::GeometryBasics.Rect2{Float64})
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/overrides.jl:75
  [6] draw_plot(scene::Makie.Scene, screen::CairoMakie.Screen{CairoMakie.IMAGE}, poly::MakieCore.Poly{Tuple{GeometryBasics.Rect2{Float64}}})
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/overrides.jl:12
  [7] cairo_draw(screen::CairoMakie.Screen{CairoMakie.IMAGE}, scene::Makie.Scene)
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/infrastructure.jl:51
  [8] backend_show(screen::CairoMakie.Screen{CairoMakie.IMAGE}, io::IOStream, ::MIME{Symbol("image/png")}, scene::Makie.Scene)
    @ CairoMakie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/CairoMakie/src/display.jl:111
  [9] (::Makie.var"#1095#1096"{Module, Bool, @Kwargs{}, Makie.Figure, MIME{Symbol("image/png")}, Makie.Scene})(io::IOStream)
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/display.jl:324
 [10] open(::Makie.var"#1095#1096"{Module, Bool, @Kwargs{}, Makie.Figure, MIME{Symbol("image/png")}, Makie.Scene}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
    @ Base ./io.jl:396
 [11] open(::Function, ::String, ::String)
    @ Base ./io.jl:393 [inlined]
 [12] save(file::FileIO.File{FileIO.DataFormat{:PNG}, String}, fig::Makie.Figure; resolution::Tuple{Int64, Int64}, backend::Module, update::Bool, screen_config::@Kwargs{})
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/display.jl:319
 [13] save(file::FileIO.File{FileIO.DataFormat{:PNG}, String}, fig::Makie.Figure)
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/display.jl:297
 [14] save(filename::String, fig::Makie.Figure; args::@Kwargs{})
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/display.jl:294
 [15] save(filename::String, fig::Makie.Figure)
    @ Makie ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/dev/Makie/src/display.jl:291
 [16] top-level scope
    @ ~/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/main.jl:22
Some type information was truncated. Use `show(err)` to see complete types.
in expression starting at /home/lassepe/worktree/BugReports/Makie.jl-cairo-dashed-rectangle/main.jl:22
@lassepe lassepe added the bug label Jul 30, 2023
@lassepe lassepe changed the title Plotting polygons with dashed strokestyle broken Plotting polygons with dashed strokestyle broken Jul 30, 2023
@lassepe lassepe changed the title Plotting polygons with dashed strokestyle broken Plotting polygons with dashed and dotted strokestyle broken Jul 30, 2023
SimonDanisch added a commit that referenced this issue Jul 31, 2023
@SimonDanisch SimonDanisch mentioned this issue Jul 31, 2023
4 tasks
@SimonDanisch
Copy link
Member

Fixed in #3104... Really weird, could have sworn I tested the PR!
I made the mistake to not add a test, since WGLMakie doesn't support linestyles yet, but should soon, so I wanted to add some more tests once that's there ...

@lassepe
Copy link
Contributor Author

lassepe commented Jul 31, 2023

Wow, that was quick 💪 Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants