JuliaPlots / GraphRecipes.jl

Graph-related recipes to be used with Plots.jl
Other
165 stars 27 forks source link

Inf error when plotting nodes with same x, y location #197

Open jamesmulhern opened 7 months ago

jamesmulhern commented 7 months ago

When using the x,y,z attribute, and error rises if multiple nodes share the same location.

The exact error text is

ArgumentError: matrix contains Infs or NaNs

It appears to be a LinearAlegbra error that is rising inside the nearest_intersection function.

BeastyBlacksmith commented 7 months ago

Please provide the complete stacktrace

jamesmulhern commented 7 months ago
ERROR: ArgumentError: matrix contains Infs or NaNs
Stacktrace:
  [1] chkfinite
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:86 [inlined]
  [2] getrf!(A::Matrix{Float64}; check::Bool)
    @ LinearAlgebra.LAPACK ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:559
  [3] getrf!
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lapack.jl:557 [inlined]
  [4] #lu!#170
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:81 [inlined]
  [5] lu!
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:80 [inlined]
  [6] #lu#176
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:299 [inlined]
  [7] lu (repeats 2 times)
    @ ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/lu.jl:298 [inlined]
  [8] \(A::Matrix{Float64}, B::Vector{Float64})
    @ LinearAlgebra ~/julia/julia-1.9.3/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:1115
  [9] nearest_intersection(xs::Float64, ys::Float64, xd::Float64, yd::Float64, vec_xy_d::Vector{Tuple{Float64, Float64}})
    @ GraphRecipes ~/.julia/packages/GraphRecipes/rzVTu/src/utils.jl:113
 [10] macro expansion
    @ ~/.julia/packages/GraphRecipes/rzVTu/src/graphs.jl:683 [inlined]
 [11] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, g::GraphRecipes.GraphPlot)
    @ GraphRecipes ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:300
 [12] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/user_recipe.jl:38
 [13] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/BGM3l/src/RecipesPipeline.jl:72
 [14] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/sxUvK/src/plot.jl:223
 [15] #plot#188
    @ ~/.julia/packages/Plots/sxUvK/src/plot.jl:102 [inlined]
 [16] plot
    @ ~/.julia/packages/Plots/sxUvK/src/plot.jl:93 [inlined]
 [17] #graphplot#80
    @ ~/.julia/packages/RecipesBase/BRe07/src/RecipesBase.jl:380 [inlined]
 [18] main()
    @ Main ~/Thesis/GraphGeneration/bin/GTFS_Graph_Test.jl:365
 [19] top-level scope
    @ ~/Thesis/GraphGeneration/bin/GTFS_Graph_Test.jl:374
jamesmulhern commented 7 months ago

I was able to circumvent the issue by adding a small random value to each x and y location.