-
Notifications
You must be signed in to change notification settings - Fork 250
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
The function apply_statistic_typed doesn't handle type Measure #1357
Comments
See my #1356 (comment). I'd like to first see a design outline that answers the q "what should happen to an aesthetic with type |
Here's my (part) solution for this issue: using Compose
using Compose.Measures
# extends an existing function in Measures.jl
isabsolute(::Type{Length{U, T}}) where {U,T} = !in([:w,:h]).(U)
# In Gadfly, another function is also needed here for swapped a, b
function cat_aes_var!(a::AbstractVector{T}, b::AbstractVector{U}) where {T<:Measure, U}
isabsolute(T) ? [a..., b...] : b
end This says that relative Measure types are not useful for determining the aesthetic ranges (and tickmarks), and hence are not passed to the Examples: # Relative Measure type
julia> cat_aes_var!([0.2,0.7].*w, rand(2))
2-element Array{Float64,1}:
0.2125510201773233
0.6520227057327439 But absolute Measure types can be passed to the julia> cat_aes_var!([1:2;].*mm, rand(2))
4-element Array{Any,1}:
1.0mm
2.0mm
0.6705462198009864
0.815355870966787 This will require PRs to both Measures.jl and Gadfly. I'll probably need to make some changes in |
Another julia> plot(x=[2,4], y=[2,4], size=[1.4142], color=[colorant"gold"])
TypeError: in typeassert, expected Int64, got Float64
Stacktrace:
[1] minvalmaxval(::Int64, ::Int64, ::Int64, ::Float64, ::Nothing) at C:\Users\mjf\.julia\dev\Gadfly\src\statistics.jl:1004
[2] apply_statistic_typed(::Int64, ::Int64, ::Array{Int64,1}, ::Array{Float64,1}, ::Array{Nothing,1}) at C:\Users\mjf\.julia\dev\Gadfly\src\statistics.jl:989 |
I've been using the new {h,v}band geometry at the head of the master branch for a day or so and have found that it errors in the presence of other geometries that use either xmin, xmax or ymin, ymax.
Below is an MWE and the error produced.
I had opened a PR with a hotfix (#1356).
The text was updated successfully, but these errors were encountered: