Skip to content

Commit

Permalink
Fixup Unitful patch for Julia 1.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
non-Jedi committed Dec 10, 2018
1 parent 36ab6ba commit e5436d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/scale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ const color_continuous_gradient = color_continuous ### WHY HAVE THIS ALIAS?

function apply_scale(scale::ContinuousColorScale,
aess::Vector{Gadfly.Aesthetics}, datas::Gadfly.Data...)
cdata = reduce(vcat, [], [i.color for i in datas if i.color != nothing])
filter!(!isna, cdata)
cdata = skipmissing(Iterators.flatten(i.color for i in datas if i.color != nothing))
if !isempty(cdata)
cmin, cmax = extrema(cdata)
else
Expand Down
6 changes: 3 additions & 3 deletions test/testscripts/unitful_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using Unitful, Gadfly, DataFrames

a = -9.81u"m/s^2"
t = (1:0.5:10)u"s"
v = a * t
v2 = v + 2u"m/s"
h = 0.5 * a * t.^2
v = a .* t
v2 = v .+ 2u"m/s"
h = 0.5 * a .* t.^2
df = DataFrame(time=t, velocity=v, position=h,
unitlesst=ustrip.(t), unitlessv=ustrip.(v), unitlessh=ustrip.(h),
position2=reverse(h))
Expand Down
6 changes: 3 additions & 3 deletions test/testscripts/unitful_color.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using Unitful, Gadfly, DataFrames

a = -9.81u"m/s^2"
t = (1:0.5:10)u"s"
v = a * t
v2 = v + 2u"m/s"
h = 0.5 * a * t.^2
v = a .* t
v2 = v .+ 2u"m/s"
h = 0.5 * a .* t.^2
df = DataFrame(time=t, velocity=v, position=h,
unitlesst=ustrip.(t), unitlessv=ustrip.(v), unitlessh=ustrip.(h),
position2=reverse(h))
Expand Down
6 changes: 3 additions & 3 deletions test/testscripts/unitful_geoms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ using Unitful, Gadfly, DataFrames

a = -9.81u"m/s^2"
t = (1:0.5:10)u"s"
v = a * t
v2 = v + 2u"m/s"
h = 0.5 * a * t.^2
v = a .* t
v2 = v .+ 2u"m/s"
h = 0.5 * a .* t.^2
df = DataFrame(time=t, velocity=v, position=h,
unitlesst=ustrip.(t), unitlessv=ustrip.(v), unitlessh=ustrip.(h),
position2=reverse(h))
Expand Down

0 comments on commit e5436d0

Please sign in to comment.