Skip to content
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

Julia 1.0 incompatibility in cat_aes_var!() #1228

Closed
dognotdog opened this issue Dec 10, 2018 · 4 comments · Fixed by #1333
Closed

Julia 1.0 incompatibility in cat_aes_var!() #1228

dognotdog opened this issue Dec 10, 2018 · 4 comments · Fixed by #1333

Comments

@dognotdog
Copy link

In cat_aes_var! at

a=[promote(a..., b...)...]

might be able to be replaced with
a=[a..., b...]

as promote throws an error in Julia 1.0 if the two are essentially the same and no actual promotion takes place. I do not know enough about this to gauge all possible side effects of the change, but it worked in my special case drawing different Geom.point shapes, whereas I would get an exception with the described error otherwise.

@bjarthur
Copy link
Member

thanks for the report! to gauge side effects, it's easiest to run the tests. at the julia prompt simply ] test Gadfly. if you have the time, please let us know if that throws any errors.

@dognotdog
Copy link
Author

dognotdog commented Dec 10, 2018

Since Gadfly just updated itself to 1.0.1, I can paste the error log:

promotion of types typeof(Gadfly.Shape.utriangle) and typeof(Gadfly.Shape.diamond) failed to change any arguments

Stacktrace:
 [1] error(::String, ::String, ::String) at ./error.jl:42
 [2] sametype_error(::Tuple{typeof(Gadfly.Shape.utriangle),typeof(Gadfly.Shape.diamond)}) at ./promotion.jl:308
 [3] not_sametype(::Tuple{typeof(Gadfly.Shape.utriangle),typeof(Gadfly.Shape.diamond)}, ::Tuple{typeof(Gadfly.Shape.utriangle),typeof(Gadfly.Shape.diamond)}) at ./promotion.jl:302
 [4] promote(::Function, ::Function) at ./promotion.jl:285
 [5] cat_aes_var!(::Array{typeof(Gadfly.Shape.utriangle),1}, ::Array{typeof(Gadfly.Shape.diamond),1}) at /Users/dog/.julia/packages/Gadfly/09PWZ/src/aesthetics.jl:263
 [6] concat(::Gadfly.Aesthetics, ::Vararg{Gadfly.Aesthetics,N} where N) at /Users/dog/.julia/packages/Gadfly/09PWZ/src/aesthetics.jl:242
 [7] render_prepare(::Plot) at /Users/dog/.julia/packages/Gadfly/09PWZ/src/Gadfly.jl:664
 [8] render(::Plot) at /Users/dog/.julia/packages/Gadfly/09PWZ/src/Gadfly.jl:745
 [9] draw(::Compose.Image{Compose.PNGBackend}, ::Plot) at /Users/dog/.julia/packages/Gadfly/09PWZ/src/Gadfly.jl:854

All tests pass with with our without this change (EDIT: but my script only works with).

@bjarthur
Copy link
Member

bjarthur commented Dec 11, 2018

would be great to have your script so we can add it to the unit tests. can you boil it down to a minimum breaking example? thanks.

@Mattriks
Copy link
Member

Here's the above error:

p1 = plot( layer(x=[5], y=[1.0], shape=[Shape.star1]),
    layer(x=1:10, y=rand(10), Geom.point, shape=[Shape.circle], alpha=[0.1]),
    Theme(point_size=4pt, discrete_highlight_color=identity, key_position=:none)
)
promotion of types typeof(Gadfly.Shape.star1) and typeof(Compose.circle) failed to change any arguments
Stacktrace:
[4] promote(::Function, ::Function) at .\promotion.jl:285
[5]  cat_aes_var!(::Array{typeof(Gadfly.Shape.star1),1}, ::Array{typeof(Compose.circle),1}) at C:\Users\mjf\.julia\dev\Gadfly\src\aesthetics.jl:266

and I also found this:

Zi = [(x,y) for x in -5:0.5:5, y in -5:0.5:5]
fn1(x) = x[1]*exp(-hypot(x[1]/3, x[2]/3)^2); fn2(x) = cos(hypot(x[1], x[2])/0.5)+1.0
i, ls = -5:0.5:5, 0.2:0.2:0.8
p2 = plot(Coord.cartesian(fixed=true),
    layer(z=fn2.(Zi), x=i, y=i, Geom.contour(levels=[1.0]), Theme(line_style=[:dash])),
    layer(z=fn1.(Zi), x=i, y=i, Stat.contour(levels=[-ls; ls]), Geom.polygon(fill=true)),
    Scale.color_continuous(minvalue=-1, maxvalue=1.0), Theme(lowlight_color=identity)
)
MethodError: no method matching append!(::Array{Float64,2}, ::Array{Float64,2})
Stacktrace:
[1] cat_aes_var!(::Array{Float64,2}, ::Array{Float64,2}) at C:\Users\mjf\.julia\dev\Gadfly\src\aesthetics.jl:274

@Mattriks Mattriks mentioned this issue Oct 24, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants