JuliaAttic / Color.jl

Basic color manipulation utilities.
Other
47 stars 21 forks source link

Wrong value in colormap("Grays") #59

Closed tknopp closed 9 years ago

tknopp commented 10 years ago

As Tim observed in #58, the gray colormap has a wrong last value that contains NaNs instead of zeros. This used to work at a former version of Color.jl

julia> Color.colormap("Grays",4)
4-element Array{RGB{Float64},1}:
 RGB{Float64}(1.0,0.9999999843772079,0.9999999986434457)                  
 RGB{Float64}(0.8022332446272299,0.8022332107836624,0.8022332223755984)   
 RGB{Float64}(0.48514909922353305,0.48514907789844725,0.48514908520261363)
 RGB{Float64}(NaN,NaN,NaN)  
jiahao commented 10 years ago

I traced it down to convert{T}(::Type{XYZ{T}}, c::Luv, wp::XYZ):

timholy commented 10 years ago

Thanks, Jiahao!

CodeLenz commented 9 years ago

Hi.

I am sorry to bother you with this closed bug, but I am still having it with the current Julia and Color versions. The command Color.colormap("Grays") still returns some Nans and any atempt to use this colormap gives BoundErrors. Is there any workaround ? x My versions: Julia: 0.3.2+2 (Windows) (6babc84*) Color: 0.3.12

Thank you, Eduardo.

jiahao commented 9 years ago

This looks like a different bug.

julia> z=Color.colormap("Grays")
100-element Array{RGB{Float64},1}:
 RGB{Float64}(1.0,0.9999999843772079,0.9999999986434464)               
 RGB{Float64}(0.9953438809796115,0.9953438395120359,0.9953438537153104)
 RGB{Float64}(0.9906156490689292,0.9906156077880247,0.9906156219273617)
 RGB{Float64}(0.9858143003211964,0.9858142592298492,0.98581427330426)  
 RGB{Float64}(0.9809387935584134,0.9809387526595515,0.9809387666680328)
 RGB{Float64}(0.9759880764437571,0.9759880357403498,0.975988049681885) 
 RGB{Float64}(0.9709610855361143,0.9709610450311729,0.970961058904731) 
 RGB{Float64}(0.9658567463560132,0.965856706052591,0.9658567198571254) 
 RGB{Float64}(0.960673973463667,0.9606739333648607,0.9606739470993128) 
 RGB{Float64}(0.9554116705498868,0.9554116306588364,0.9554116443221273)
 RGB{Float64}(0.9500687305406562,0.9500686908605455,0.9500687044515875)
 RGB{Float64}(0.9446440357162313,0.9446439962502874,0.9446440097679738)
 RGB{Float64}(0.9391364578456477,0.9391364185971429,0.9391364320403532)
 RGB{Float64}(0.9335448583376053,0.9335448193098572,0.9335448326774552)
 RGB{Float64}(0.927868088408735,0.9278680496051054,0.9278680628959401) 
 RGB{Float64}(0.9221049892703218,0.9221049506942189,0.9221049639071214)
 ⋮                                                                     
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(NaN,NaN,NaN)                                             
 RGB{Float64}(0.0,0.0,0.0)                                             
ikirill commented 9 years ago

Still present in current git version, with nightly julia version:

julia> Color.colormap("Grays", 4)
4-element Array{Color.RGB{Float64},1}:
 Color.RGB{Float64}(1.0,0.9999999843772079,0.9999999986434464)
 Color.RGB{Float64}(0.8022332446272302,0.8022332107836626,0.8022332223756009)
 Color.RGB{Float64}(NaN,NaN,NaN)
 Color.RGB{Float64}(0.0,0.0,0.0)
jiahao commented 9 years ago

I've traced it down to the following bug:

julia> p = Color.LCHuv{Float64}(0.0,0.0,0.0); 1.0p 
Color.LCHuv{Float64}(0.0,NaN,NaN)