-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
heatmap color gradient problem on 32 bit machine with GR #1665
Comments
I cannot reproduce this error, on GR v0.32.2, Plots v0.19.2, PlotUtils v0.5.2, Julia v1.0.0 (metadata versions). Could you free the packages, run For the second bit, can we not just change the Int inside the rounding function to |
I can reproduce this by passing a julia> using Plots
julia> c = cgrad([:white,:red]);
julia> plot(rand(3), zcolor=rand(3), c=c)
ERROR: MethodError: no method matching length(::ColorGradient)
Closest candidates are:
length(::Core.SimpleVector) at essentials.jl:571
length(::Base.MethodList) at reflection.jl:728
length(::Core.MethodTable) at reflection.jl:802
...
Stacktrace:
[1] _similar_for(::UnitRange{Int64}, ::Type, ::ColorGradient, ::Base.HasLength) at ./array.jl:532
[2] _collect(::UnitRange{Int64}, ::ColorGradient, ::Base.HasEltype, ::Base.HasLength) at ./array.jl:563
[3] collect(::ColorGradient) at ./array.jl:557
[4] broadcastable(::ColorGradient) at ./broadcast.jl:609
[5] broadcasted(::Function, ::ColorGradient, ::Base.RefValue{Plots.Subplot{Plots.GRBackend}}, ::Int64) at ./broadcast.jl:1139
[6] _update_series_attributes!(::Dict{Symbol,Any}, ::Plots.Plot{Plots.GRBackend}, ::Plots.Subplot{Plots.GRBackend}) at /Users/nowacki/.julia/packages/Plots/LWBTU/src/args.jl:1566
[7] _process_seriesrecipe(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}) at /Users/nowacki/.julia/packages/Plots/LWBTU/src/pipeline.jl:403
[8] macro expansion at ./logging.jl:320 [inlined]
[9] _plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Float64,1}}) at /Users/nowacki/.julia/packages/Plots/LWBTU/src/plot.jl:171
[10] #plot#134(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:zcolor, :c),Tuple{Array{Float64,1},ColorGradient}}}, ::Function, ::Array{Float64,1}) at /Users/nowacki/.julia/packages/Plots/LWBTU/src/plot.jl:57
[11] (::getfield(RecipesBase, Symbol("#kw##plot")))(::NamedTuple{(:zcolor, :c),Tuple{Array{Float64,1},ColorGradient}}, ::typeof(plot), ::Array{Float64,1}) at ./none:0
[12] top-level scope at none:0 Is the answer to define # update series color
d[:seriescolor] = getSeriesRGBColor.(Ref(d[:seriescolor]), Ref(sp), plotIndex) I guess this depends on whether (I ask which is the right approach here just because I don't understand the reason to broadcast the call to [Edited to make the example copy-pastable by changing my custom REPL prompt.] |
The reason it is broadcast is because #1467 made it possible to pass a vector of colors to different line segments, requiring the ability to broadcast sometimes, but not always. This creates problems now after julia#18618 . |
@anowacki a PR would be highly appreciated! The julia version changes are always slightly hectic :-) |
No longer broadcast over d[:seriescolor] when updating series attributes. This fixes JuliaPlots#1665, where in Julia v1.0 the PlotUtils ColorGradient type is assumed to be iterable (JuliaLang/julia/#18618).
@mkborregaard , for the argument of that |
@mkborregaard and @anowacki , I just updated the packages and rebuilt them. Now I have
|
#1670 for the first issue. I'll merge now if you'll try it out offline - I don't think we have CI for 32-bit machines. |
It's not quite fixed yet |
No it is fixed - I was having some trouble keeping track of my branches under Pkg3 |
Hi, Michael.
I'll try out your changes #1670
<#1670> on my 32 bit machine,
and report back to you.
But I have a naive question; how can I apply the diff of backends/gr.jl
shown on #1670 <#1670> to my
local version of gr.jl?
Thanks for your help!
Naoki
…On Fri, Aug 17, 2018 at 1:52 AM Michael Krabbe Borregaard < ***@***.***> wrote:
#1670 <#1670> for the first
issue. I'll merge now if you'll try it out offline - I don't think we have
CI for 32-bit machines.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1665 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACwq8A3aqasJpLvmfeZzwZIV37yy86A_ks5uRoRUgaJpZM4V_PfH>
.
--
Naoki Saito, Ph.D., Professor, Department of Mathematics
University of California, One Shields Avenue, Davis, CA 95616-8633 USA
Voice: 530-754-2121, Fax: 530-752-6635, Email: [email protected]
Home Page: http://math.ucdavis.edu/~saito/
|
Address UInt round problem - see #1665
@mkborregaard , thank you so much! I just pulled the latest master, and now |
Thank @anowacki ! :-) |
So @BoundaryValueProblems about checking out the #1670 PR (which I've already merged and included in an upcoming release but testing on 32-bit would still be very good), you can see at the PR screen that the branch I'm merging from is |
@jheinen , I installed Julia v1.0.0 on my 32 bit linux machine.
The versions are: GR v0.32.2+, Plots vv0.19.2+, Julia v1.0.0.
When I ran
heatmap(randn(10,10),ratio=1,c=:viridis)
, it didn't work and produced the following error. On the other hand, if I do not specify the color gradient scheme and use the default one by just runningheatmap(randn(10,10),ratio=1)
, it works. For 64 bit machines, both of course work.Thanks for your help!
BTW, on 32 bit machine, I still had to change the following part of Plots/src/backends/gr.jl in order for gr backend to use
heatmap
as we discussed earlier on gitter:Here
Int
inside theround
functions must be replaced byUInt32
.Thanks a lot!
The text was updated successfully, but these errors were encountered: