Warning messages when creating colormaps with PyPlot

I have a handful of colormaps that I’ve created in Julia through PyPlot. The function that I use to create these colormaps triggers a warning message in v0.6.0 that I’m not sure how to fix.

For example, if I try to create a colormap as follows:

using PyPlot

blue_r_cmap =Pyplot.ColorMap("blue_r",
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.0,0.0)],
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.0,0.0)],
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.7,0.7)],33,1.0)

I get a warning message stating:

WARNING: Array{T}(::Type{T}, m::Int) is deprecated, use Array{T}(m) instead.

Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
 [2] Array(::Type{Tuple{Float64,Float64,Float64}}, ::Int64) at ./deprecated.jl:57
 [3] PyPlot.ColorMap(::String, ::Array{Tuple{Float64,Float64,Float64},1}, ::Array{Tuple{Float64,Float64,Float64},1}, ::Array{Tuple{Float64,Float64,Float64},1}, ::Int64, ::Float64) at /home/metjon/.julia/v0.6/PyPlot/src/colormaps.jl:61
 [4] include_string(::String, ::String) at ./loading.jl:515
 [5] include_string(::Module, ::String, ::String) at /home/metjon/.julia/v0.6/Compat/src/Compat.jl:464
 [6] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/metjon/.julia/v0.6/IJulia/src/execute_request.jl:154
 [7] eventloop(::ZMQ.Socket) at /home/metjon/.julia/v0.6/IJulia/src/eventloop.jl:8
 [8] (::IJulia.##14#17)() at ./task.jl:335
while loading In[3], in expression starting on line 1

I tried working around this issue by changing the format of the input arrays as suggested by the warning message but I couldn’t find a way to get it to work. I’m probably overlooking something rather simple, but I’d appreciate any suggestions on how to get rid of this warning message. Since I’m loading in a handful of these colormaps, the warning message gets pretty lengthy.

Thanks!

My guess is that this warning is cast from inside PyPlot - it’s the kind of warning you get when a syntax is not updated from julia 0.5 to 0.6. You can most likely ignore it.

You’re likely correct that the warning message is cast from inside PyPlot. It is indeed innocuous, however I was hoping there’s a way I can restructure the arrays such that the warning message is not triggered. It’s rather lengthy and I’d favor finding the correct syntactical solution (provided one exists) that gets rid of the warning message. Any thoughts on how to go about this?

Thanks for the feedback!

A workaround is to not let PyPlot use its obsolete form for the default alpha channels:

blue_r_cmap =PyPlot.ColorMap("blue_r",
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.0,0.0)],
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.0,0.0)],
[(0.0,1.0,1.0),(0.1,1.0,1.0),(1.0,0.7,0.7)],
Array{Tuple{Float64,Float64,Float64}}(0),
33,1.0)

The correct (syntactical?) solution is to turn this into a PR for the PyPlot package.