MakieOrg / GeoMakie.jl

Geographical plotting utilities for Makie.jl
https://geo.makie.org
MIT License
167 stars 24 forks source link

Problem with contour! in GeoMakie v0.6.2 #213

Closed scientist007v2 closed 3 months ago

scientist007v2 commented 5 months ago

I used the example script from the GeoMakie.jl page, but for contour!:

using GeoMakie, CairoMakie

lons = -180:180
lats = -90:90
field = [exp(cosd(l)) + 3(y/90) for l in lons, y in lats]

fig = Figure()
ax = GeoAxis(fig[1,1])
contour!(ax, lons, lats, field)
fig

Above doesn't work for me anymore with GeoMakie v0.6.2. Other functions, such as contourf!, surface!, or heatmap! work. contour! had worked with GeoMakie v0.5.1. What is different? What am I doing wrong? Or is it a bug?

An error message is created after "fig":

Error showing value of type Figure: ERROR: MethodError: no method matching point_iterator(::MakieCore.Text{Tuple{Vector{Makie.GlyphCollection}}})

Closest candidates are: point_iterator(::Volume) @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:92 point_iterator(::Union{Image, Heatmap, Surface}) @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:87 point_iterator(::MakieCore.Mesh) @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:77 ...

Stacktrace: [1] _point_iterator(plot::MakieCore.Text{Tuple{Vector{Makie.GlyphCollection}}}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:211 [2] _point_iterator(list::Vector{Plot}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:201 [3] _point_iterator(plot::MakieCore.Text{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:213 [4] _point_iterator(list::Vector{Plot}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:201 [5] _point_iterator @ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:213 [inlined] [6] iterate_transformed(plot::Plot{Makie.contour, Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:217 [7] (::GeoMakie.var"#60#62"{GeoMakie.var"#exclude#63"{…}, Base.RefValue{…}})(plot::Plot{Makie.contour, Tuple{…}}) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:228 [8] foreach(f::GeoMakie.var"#60#62"{GeoMakie.var"#exclude#63"{…}, Base.RefValue{…}}, itr::Vector{AbstractPlot}) @ Base ./abstractarray.jl:3097 [9] foreach_plot @ ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:108 [inlined] [10] foreach_plot @ ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:102 [inlined] [11] transformed_limits @ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:226 [inlined] [12] getlimits(la::GeoAxis, dim::Int64) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:253 [13] autolimits(axis::GeoAxis, dim::Int64) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:143 [14] xautolimits @ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:156 [inlined] [15] reset_limits!(axis::GeoAxis; xauto::Bool, yauto::Bool) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:53 [16] reset_limits! @ ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:44 [inlined] [17] update_state_before_display!(ax::GeoAxis) @ GeoMakie ~/.julia/packages/GeoMakie/vcMuZ/src/makie-axis.jl:295 [18] update_state_before_display!(f::Figure) @ Makie ~/.julia/packages/Makie/ND0gA/src/figureplotting.jl:217 [19] display(figlike::Figure; backend::Module, inline::MakieCore.Automatic, update::Bool, screen_config::@Kwargs{}) @ Makie ~/.julia/packages/Makie/ND0gA/src/display.jl:164 [20] display(figlike::Figure) @ Makie ~/.julia/packages/Makie/ND0gA/src/display.jl:130 [21] #invokelatest#2 @ ./essentials.jl:892 [inlined] [22] invokelatest @ ./essentials.jl:889 [inlined] [23] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…}) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:315 [24] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284 [25] with_repl_linfo(f::Any, repl::REPL.LineEditREPL) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569 [26] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282 [27] (::REPL.var"#do_respond#80"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:911 [28] #invokelatest#2 @ ./essentials.jl:892 [inlined] [29] invokelatest @ ./essentials.jl:889 [inlined] [30] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState) @ REPL.LineEdit /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656 [31] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef) @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1312 [32] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})() @ REPL /snap/julia/95/share/julia/stdlib/v1.10/REPL/src/REPL.jl:386 Some type information was truncated. Use show(err) to see complete types.

Thanks to the developers for all the work!

asinghvi17 commented 4 months ago

Can confirm, looks like the point transformer needs to be updated. The reason for this is that contour includes text along the contour lines.

This will probably be a patch release from a throwaway branch, since the whole structure was changed in Makie 0.21 and the code here works in #207.