Coder Social home page Coder Social logo

Comments (7)

ctrebbau avatar ctrebbau commented on September 22, 2024 1

I am running Colors v0.12.10 which Pkg does not tag for possible update or that it is being held back.

It is somewhat strange; when I run the command on a fresh session I cannot blow it up -VSCode just gives up on displaying the palette but it is still there (>20_000). But on my development context I get the overflow with just 150.
The exact command is run-of-the-mill colmap = colormap("Reds", maxcount; w=7, logscale = true) where maxcount = 150. I'm using Makie for plotting of an animated choropleth and have on volatile very many data points but no processes running that would hijack the stack, to the best of my knowledge.

Please let me know what else I can do.

from colors.jl.

timholy avatar timholy commented on September 22, 2024

What was working? You didn't post the command that triggered the error.

from colors.jl.

timholy avatar timholy commented on September 22, 2024

Oh I see, it's essentially the title. But

julia> colormap("Blues", 5; w=7, logscale=false)
5-element Array{RGB{Float64},1} with eltype RGB{Float64}:
 RGB{Float64}(1.0,0.9689444400515476,0.8339613400131303)
 RGB{Float64}(0.7002333050365439,0.9232888688313844,0.5721953036991152)
 RGB{Float64}(0.0,0.8116721169252812,0.7458361582969534)
 RGB{Float64}(0.0,0.5087434882664857,0.7762718761091344)
 RGB{Float64}(0.019190711289394265,0.15713212232170762,0.3484547991055406)

If you can post a reproducible example that would be a big help.

from colors.jl.

ctrebbau avatar ctrebbau commented on September 22, 2024

Hello Tim (hats off to you). I'm trying to define the color bar for a heatmap/choropleth based on some count and had recorded a maxcount of 150 and I guess that blew the stack.

from colors.jl.

timholy avatar timholy commented on September 22, 2024

If you know the args that triggered this is seems to merit investigation. colormap("Blues", 150; w=7, logscale=false) also works for me. (maxcount=150 does not sound excessive.)

Also, which version of Colors are you using? Line 326 does not contain a recursive call in the current master branch:

Td = Tuple{F, F, F, F, F, F, F, F, RGB{F}, RGB{F}, RGB{F}}

from colors.jl.

timholy avatar timholy commented on September 22, 2024

Thanks very much for the concrete call. It still doesn't replicate for me BUT I think I figured it out based on the fact that your version is

colormap(cname::AbstractString, args...; kwargs...) = colormap(String(cname), args...; kwargs...)
:

julia> colormap("Reds", 3; w=7, logscale = true)
3-element Array{RGB{Float64},1} with eltype RGB{Float64}:
 RGB{Float64}(0.9582804535342538,0.958741006843247,0.9347144456966647)
 RGB{Float64}(0.8905762771702996,0.9198617509685533,0.9659542256449846)
 RGB{Float64}(0.42599527176569785,0.04573322950982179,0.03379128459010661)

julia> colormap("Reds", Int32(3); w=7, logscale = true)
ERROR: StackOverflowError:
Stacktrace:
 [1] colormap(cname::String, args::Int32; kwargs::Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol}, NamedTuple{(:w, :logscale), Tuple{Int64, Bool}}}) (repeats 39992 times)
   @ Colors ~/.julia/packages/Colors/mIuXl/src/colormaps.jl:326

The problem comes from specifying N as an Integer that is not Int: that line is supposed to dispatch to

function colormap(cname::String, N::Int=100; mid=0.5, logscale::Bool=false, kvs...)
but it can't if N isn't an Int.

That should let you work around it, but this is something we should fix. It already looks fixed on master so maybe we should just focus on getting that out.

from colors.jl.

ctrebbau avatar ctrebbau commented on September 22, 2024

Got it. Thanks!

from colors.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.