-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
Had a little discussion with @asinghvi17 about an error I ran into. Here's the code I was initially working with:
using CairoMakie
using CSV
using DataFrames
using GeoDataFrames
using GeoInterfaceMakie
using GeoMakie
# Can be added via: add https://github.com/JuliaHealth/IPUMS.jl#add_nhgis_loader
using IPUMS
# You can download this data here: https://international.ipums.org/international/resources/gis/ENUTS2_2013.zip
geodf_2 = load_ipums_nhgis("ENUTS2_2013.shp")
filter!(x -> x.CNTRY_NAME == "Poland", geodf_2)
fig = Figure(
size = (1200, 1400),
fontsize = 20
);
ax = CairoMakie.Axis(
fig[1, 1],
);
poly!(ax, geodf_2.geometry |> skipmissing .|> GeoMakie.to_multipoly, color = 1:16, colormap = :Reds, strokecolor = :black, strokewidth = 3);
Yet it fails with this:
poly!(ax, geodf_2.geometry, color = 1:16, colormap = :Reds, strokecolor = :black, strokewidth = 3);
Giving the following error:
ERROR: No recipe for poly with args: Tuple{Vector{Union{Missing, ArchGDAL.IGeometry}}}
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] plot!
@ ~/.julia/packages/Makie/qMluh/src/interfaces.jl:353 [inlined]
[3] connect_plot!(parent::Scene, plot::Poly{Tuple{Vector{Union{Missing, ArchGDAL.IGeometry}}}})
@ Makie ~/.julia/packages/Makie/qMluh/src/interfaces.jl:380
[4] plot!
@ ~/.julia/packages/Makie/qMluh/src/interfaces.jl:389 [inlined]
[5] plot!(ax::Axis, plot::Poly{Tuple{Vector{Union{Missing, ArchGDAL.IGeometry}}}})
@ Makie ~/.julia/packages/Makie/qMluh/src/figureplotting.jl:412
[6] _create_plot!(::Function, ::Dict{Symbol, Any}, ::Axis, ::Vector{Union{Missing, ArchGDAL.IGeometry}})
@ Makie ~/.julia/packages/Makie/qMluh/src/figureplotting.jl:381
[7] poly!(::Axis, ::Vararg{Any}; kw::@Kwargs{color::UnitRange{Int64}, colormap::Symbol, strokecolor::Symbol, strokewidth::Int64})
@ MakieCore ~/.julia/packages/MakieCore/UpNdE/src/recipes.jl:440
[8] top-level scope
@ REPL[176]:1
Here's potentially an MWE:
ps = Any[Polygon(rand(Point2f, 3) .+ Point2f(i, j)) for i in 1:5 for j in 1:10]
push!(ps, missing)
poly!(ps, color = rand(RGBf, length(ps)))
Which gives:
ERROR: No recipe for poly with args: Tuple{Vector{Union{Missing, Polygon{2, Float32, Point{2, Float32}, LineString{2, Float32, Point{2, Float32}, Base.Reinterpre
tArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Point{2, Float32}}, TupleView{Tuple{Point{2, Float32}, Point{2, Float32}}, 2,
false}}, Vector{LineString{2, Float32, Point{2, Float32}, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point{2, Float32}, Poi
e{Point{2, Float32}, Point{2, Float32}}, 2, 1, Vector{Point{2, Float32}}}, false}}}}}}}
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] plot!
@ ~/.julia/packages/Makie/qMluh/src/interfaces.jl:353 [inlined]
[3] connect_plot!(parent::Scene, plot::Poly{Tuple{Vector{Union{Missing, Polygon{2, Float32, Point{…}, LineString{…}, Vector{…}}}}
@ Makie ~/.julia/packages/Makie/qMluh/src/interfaces.jl:380
[4] plot!
@ ~/.julia/packages/Makie/qMluh/src/interfaces.jl:389 [inlined]
[5] plot!(ax::Axis, plot::Poly{Tuple{Vector{Union{Missing, Polygon{2, Float32, Point{…}, LineString{…}, Vector{…}}}}}})
@ Makie ~/.julia/packages/Makie/qMluh/src/figureplotting.jl:412
[6] _create_plot!(F::Function, attributes::Dict{Symbol, Any}, args::Vector{Any})
@ Makie ~/.julia/packages/Makie/qMluh/src/figureplotting.jl:381
[7] #poly!#91
@ ~/.julia/packages/MakieCore/UpNdE/src/recipes.jl:440 [inlined]
[8] top-level scope
@ REPL[185]:1
Some type information was truncated. Use `show(err)` to see complete types.
Not sure how to remedy this... Thanks!
Metadata
Metadata
Assignees
Labels
No labels