JuliaAttic / Color.jl

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

colormap not working anymore #58

Closed tknopp closed 10 years ago

tknopp commented 10 years ago

Hi, cleaned my .julia directory re-added Color.jl and now get

colormap("Grays")
ERROR: `clamp` has no method matching clamp(::Float64, ::Float64, ::Float64)
you may have intended to import Base.clamp
 in MSC at /Users/knopp/.julia/v0.3/Color/src/algorithms.jl:203
 in sequential_palette at /Users/knopp/.julia/v0.3/Color/src/colormaps.jl:133
 in colormap at /Users/knopp/.julia/v0.3/Color/src/colormaps.jl:258
 in colormap at /Users/knopp/.julia/v0.3/Color/src/colormaps.jl:242

The Color.jl version is 0.3.3 and its Julia 0.3RC4. I wonder why this worked before.

timholy commented 10 years ago

It worked before because I hadn't yet broken it :smile:. Sorry about that, and thanks for the bug report.

To others: is the final element returned by colormap("Gray") really supposed to be RGB(NaN, NaN, NaN)?

I started a test/algorithms.jl file, with a very minimal test of colormap as the only entry. Overall I'd say the test coverage for this package is not yet where it needs to be. While working on bb94a801771730e3cc70e612aba15180b6d49327 I beefed up our testing of conversions, but as far as algorithms go I'm not the right person to write those tests. (Color is definitely not my area of expertise.)

It would be fantastic to see contributions from people who actually know something about color adding to our test coverage. One nice way to find out what's missing is julia --code-coverage runtests.jl, and then examine the "*.cov" files in src/ and see which functions have "-" in front of all of their lines. (One caveat: very small functions might be inlined, which causes "-" to be used inappropriately.) It seems nearly certain that bugs will be uncovered in the process of writing better tests. Particularly if they were caused by my recent parametric work, I'll be happy to consult/help fix them.

tknopp commented 10 years ago

Thanks Tim. The final element seems not supposed to be NaNs.

Winston.colormap("Grays")
ERROR: InexactError()
 in colormap at /Users/knopp/.julia/v0.3/Winston/src/plot.jl:285
 in colormap at /Users/knopp/.julia/v0.3/Winston/src/plot.jl:291
 in colormap at /Users/knopp/.julia/v0.3/Winston/src/plot.jl:288

Note that Winston also has a colormap function that internally calls the Color.jl one.

tknopp commented 10 years ago

I will open a dedicated issue for NaNs.