Skip to content

Commit

Permalink
fix depwarns
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Sep 1, 2018
1 parent ce97f6b commit afefa1a
Show file tree
Hide file tree
Showing 43 changed files with 235 additions and 235 deletions.
2 changes: 2 additions & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
julia 0.7
CategoricalArrays # might be able to remove
Colors 0.3.4
Compat 0.18.0
Compose 0.5.2
Expand All @@ -13,6 +14,7 @@ IterTools
JSON
KernelDensity
Loess
Measures
Showoff 0.0.3
StatsBase
Juno
Expand Down
26 changes: 14 additions & 12 deletions src/Gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ using JSON
using Showoff
using IndirectArrays
using CategoricalArrays
using Printf
using Base64

import IterTools
import IterTools: distinct, drop, chain
import Compose: draw, hstack, vstack, gridstack, isinstalled, parse_colorant
import Compose: draw, hstack, vstack, gridstack, parse_colorant
import Base: +, -, /, *,
copy, push!, start, next, done, show, getindex, cat,
show, isfinite, display
Expand Down Expand Up @@ -378,7 +380,7 @@ function render_prepare(plot::Plot)

# Process layers, filling inheriting mappings or data from the Plot where
# they are missing.
datas = Array{Data}(length(plot.layers))
datas = Array{Data}(undef, length(plot.layers))
for (i, layer) in enumerate(plot.layers)
if layer.data_source === nothing && isempty(layer.mapping)
layer.data_source = plot.data_source
Expand Down Expand Up @@ -434,7 +436,7 @@ function render_prepare(plot::Plot)
end

# Add default statistics for geometries.
layer_stats = Array{Vector{StatisticElement}}(length(plot.layers))
layer_stats = Array{Vector{StatisticElement}}(undef, length(plot.layers))
for (i, layer) in enumerate(plot.layers)
layer_stats[i] = isempty(layer.statistics) ? ( isa(layer.geom, Geom.SubplotGeometry) ?
default_statistic(layer.geom) : [default_statistic(layer.geom)] ) : layer.statistics
Expand Down Expand Up @@ -550,7 +552,7 @@ function render_prepare(plot::Plot)
(haskey(plot.mapping, var) || haskey(scales, var)) && continue

t = :categorical
for data in chain(datas, subplot_datas)
for data in Iterators.flatten((datas, subplot_datas))
val = getfield(data, var)
if val != nothing && val != :categorical
t = classify_data(val)
Expand Down Expand Up @@ -711,8 +713,8 @@ function render_prepare(plot::Plot)
end

# build arrays of scaled aesthetics for layers within subplots
layer_subplot_aess = Array{Vector{Aesthetics}}(length(plot.layers))
layer_subplot_datas = Array{Vector{Data}}(length(plot.layers))
layer_subplot_aess = Array{Vector{Aesthetics}}(undef, length(plot.layers))
layer_subplot_datas = Array{Vector{Data}}(undef, length(plot.layers))
j = 1
for (i, layer) in enumerate(plot.layers)
layer_subplot_aess[i] = Aesthetics[]
Expand Down Expand Up @@ -988,7 +990,7 @@ function default_mime()
end
end

import Base.REPL: REPLDisplay
import REPL: REPLDisplay

"""
display(p::Plot)
Expand All @@ -998,19 +1000,19 @@ This function is handy when rendering by `plot` has been suppressed
with either trailing semi-colon or by calling it within a function.
"""
function display(d::REPLDisplay, p::Union{Plot,Compose.Context})
if mimewritable("text/html", p)
if showable("text/html", p)
display(d,"text/html", p)
return
elseif mimewritable("image/png", p)
elseif showable("image/png", p)
display(d,"image/png", p)
return
elseif mimewritable("application/pdf", p)
elseif showable("application/pdf", p)
display(d,"application/pdf", p)
return
elseif mimewritable("image/svg+xml", p)
elseif showable("image/svg+xml", p)
display(d,"image/svg+xml", p)
return
elseif mimewritable("application/postscript", p)
elseif showable("application/postscript", p)
display(d,"application/postscript", p)
return
end
Expand Down
28 changes: 14 additions & 14 deletions src/aesthetics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const NumericalAesthetic =
@varset Aesthetics begin
x, Union{NumericalOrCategoricalAesthetic, Distribution}
y, Union{NumericalOrCategoricalAesthetic, Distribution}
z, Union{(Void), Function, NumericalAesthetic}
z, Union{Nothing, Function, NumericalAesthetic}
xend, NumericalAesthetic
yend, NumericalAesthetic

size, Union{CategoricalAesthetic,Vector,Void}
shape, Union{CategoricalAesthetic,Vector,Void}
color, Union{CategoricalAesthetic,Vector,Void}
linestyle, Union{CategoricalAesthetic,Vector,Void}
size, Union{CategoricalAesthetic,Vector,Nothing}
shape, Union{CategoricalAesthetic,Vector,Nothing}
color, Union{CategoricalAesthetic,Vector,Nothing}
linestyle, Union{CategoricalAesthetic,Vector,Nothing}

label, CategoricalAesthetic
group, CategoricalAesthetic
Expand Down Expand Up @@ -56,7 +56,7 @@ const NumericalAesthetic =
ytick, NumericalAesthetic
xgrid, NumericalAesthetic
ygrid, NumericalAesthetic
color_key_colors, Maybe(Associative)
color_key_colors, Maybe(AbstractDict)
color_key_title, Maybe(AbstractString)
color_key_continuous, Maybe(Bool)
color_function, Maybe(Function)
Expand Down Expand Up @@ -88,8 +88,8 @@ const NumericalAesthetic =
shape_label, Function, showoff

# pseudo-aesthetics
pad_categorical_x, Nullable{Bool}, Nullable{Bool}()
pad_categorical_y, Nullable{Bool}, Nullable{Bool}()
pad_categorical_x, Union{Missing,Bool}, missing
pad_categorical_y, Union{Missing,Bool}, missing
end


Expand Down Expand Up @@ -273,9 +273,9 @@ cat_aes_var!(a, b) = a
function cat_aes_var!(a::AbstractArray{T}, b::AbstractArray{U}) where {T, U}
V = promote_type(T, U)
if isa(a, Array{Union{Missing,T}}) || isa(b, Array{Union{Missing,U}})
ab = Array{Union{Missing,V}}(length(a) + length(b))
ab = Array{Union{Missing,V}}(undef, length(a) + length(b))
else
ab = Array{V}(length(a) + length(b))
ab = Array{V}(undef, length(a) + length(b))
end
i = 1
for x in a
Expand Down Expand Up @@ -320,8 +320,8 @@ function by_xy_group(aes::T, xgroup, ygroup,
xrefs = xgroup === nothing ? [1] : xgroup
yrefs = ygroup === nothing ? [1] : ygroup

aes_grid = Array{T}(n, m)
staging = Array{AbstractArray}(n, m)
aes_grid = Array{T}(undef, n, m)
staging = Array{AbstractArray}(undef, n, m)
for i in 1:n, j in 1:m
aes_grid[i, j] = T()
end
Expand Down Expand Up @@ -370,7 +370,7 @@ function by_xy_group(aes::T, xgroup, ygroup,
if !applicable(convert, typeof(vals), staging[i, j])
T2 = eltype(vals)
if T2 <: Color T2 = Color end
da = Array{Union{Missing,T2}}(length(staging[i, j]))
da = Array{Union{Missing,T2}}(undef, length(staging[i, j]))
copy!(da, staging[i, j])
setfield!(aes_grid[i, j], var, da)
else
Expand Down Expand Up @@ -404,7 +404,7 @@ function inherit!(a::Aesthetics, b::Aesthetics;
bval = getfield(b, field)
if field in clobber_set
setfield!(a, field, bval)
elseif aval === nothing || aval === string || aval == showoff
elseif aval === missing || aval === nothing || aval === string || aval == showoff
setfield!(a, field, bval)
elseif field == :xviewmin || field == :yviewmin
bval != nothing && (aval == nothing || aval > bval) && setfield!(a, field, bval)
Expand Down
2 changes: 1 addition & 1 deletion src/bincount.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end
# numbins: number of bins
#
function bin!(bincounts::Vector, xs, x_min, binwidth, numbins)
bincounts[1:numbins] = 0
bincounts[1:numbins] .= 0
for x in xs
if !isconcrete(x)
continue
Expand Down
20 changes: 10 additions & 10 deletions src/coord.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,21 @@ end
#
function apply_coordinate(coord::Cartesian, aess::Vector{Gadfly.Aesthetics},
scales::Dict{Symbol, Gadfly.ScaleElement})
pad_categorical_x = Nullable{Bool}()
pad_categorical_y = Nullable{Bool}()
pad_categorical_x = missing
pad_categorical_y = missing
for aes in aess
if !isnull(aes.pad_categorical_x)
if isnull(pad_categorical_x)
if aes.pad_categorical_x !== missing
if pad_categorical_x === missing
pad_categorical_x = aes.pad_categorical_x
else
pad_categorical_x = Nullable(get(pad_categorical_x) || get(aes.pad_categorical_x))
pad_categorical_x = pad_categorical_x || aes.pad_categorical_x
end
end
if !isnull(aes.pad_categorical_y)
if isnull(pad_categorical_y)
if aes.pad_categorical_y !== missing
if pad_categorical_y === missing
pad_categorical_y = aes.pad_categorical_y
else
pad_categorical_y = Nullable(get(pad_categorical_y) || get(aes.pad_categorical_y))
pad_categorical_y = pad_categorical_y || aes.pad_categorical_y
end
end
end
Expand Down Expand Up @@ -237,12 +237,12 @@ function apply_coordinate(coord::Cartesian, aess::Vector{Gadfly.Aesthetics},
xpadding = Scale.iscategorical(scales, :x) ? 0mm : 2mm
ypadding = Scale.iscategorical(scales, :y) ? 0mm : 2mm

if Scale.iscategorical(scales, :x) && (isnull(pad_categorical_x) || get(pad_categorical_x))
if Scale.iscategorical(scales, :x) && (pad_categorical_x===missing || pad_categorical_x)
xmin -= 0.5
xmax += 0.5
end

if Scale.iscategorical(scales, :y) && (isnull(pad_categorical_y) || get(pad_categorical_y))
if Scale.iscategorical(scales, :y) && (pad_categorical_y===missing || pad_categorical_y)
ymin -= 0.5
ymax += 0.5
end
Expand Down
4 changes: 2 additions & 2 deletions src/geom/bar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function render_dodged_bar(geom::BarGeometry,
dodge_pos_dict[aes.ymin[i]] = aes.ymin[i]*cy
end

dodge_pos = Array{Measure}(length(idxs))
dodge_pos = Array{Measure}(undef, length(idxs))
for (i, j) in enumerate(idxs)
dodge_pos[i] = dodge_pos_dict[aes.ymin[j]] + theme.bar_spacing/2
dodge_pos_dict[aes.ymin[j]] += dodge_height[aes.ymin[j]]
Expand Down Expand Up @@ -220,7 +220,7 @@ function render_dodged_bar(geom::BarGeometry,
dodge_pos_dict[aes.xmin[i]] = aes.xmin[i]*cx
end

dodge_pos = Array{Measure}(length(idxs))
dodge_pos = Array{Measure}(undef, length(idxs))
for (i, j) in enumerate(idxs)
dodge_pos[i] = dodge_pos_dict[aes.xmin[j]] + theme.bar_spacing/2
dodge_pos_dict[aes.xmin[j]] += dodge_width[aes.xmin[j]]
Expand Down
8 changes: 4 additions & 4 deletions src/geom/beeswarm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ function render(geom::BeeswarmGeometry, theme::Gadfly.Theme, aes::Gadfly.Aesthet

point_dist = (2*theme.point_size + geom.padding).value
point_dist += eps(point_dist)
offsets = Array{Length{:mm}}(length(val))
positions = Array{Compose.Measure}(length(val))
offsets = Array{Length{:mm}}(undef, length(val))
positions = Array{Compose.Measure}(undef, length(val))

n = length(val)
overlaps = Array{Bool}(n)
absvals = Array{Float64}(n)
overlaps = Array{Bool}(undef, n)
absvals = Array{Float64}(undef, n)
for (i, v) in enumerate(val)
absvals[i] = Compose.resolve_position(
draw_context.box,
Expand Down
6 changes: 3 additions & 3 deletions src/geom/line.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ function Gadfly.Geom.render(geom::LineGeometry, theme::Gadfly.Theme, aes::Gadfly
ug = unique(groups)

n = length(ug)
lines = Vector{Vector{Tuple{XT,YT}}}(n)
line_colors = Vector{CT}(n)
line_styles = Vector{LST}(n)
lines = Vector{Vector{Tuple{XT,YT}}}(undef, n)
line_colors = Vector{CT}(undef, n)
line_styles = Vector{LST}(undef, n)
linestyle_palette_length = length(theme.line_style)
for (k,g) in enumerate(ug)
i = groups.==[g]
Expand Down
2 changes: 1 addition & 1 deletion src/geom/polygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function polygon_points(xs, ys, preserve_order)
return T[(x, y) for (x, y) in zip(xs, ys)]
else
centroid_x, centroid_y = mean(xs), mean(ys)
θ = atan(xs - centroid_x, ys - centroid_y)
θ = atan.(xs - centroid_x, ys - centroid_y)
perm = sortperm(θ)
return T[(x, y) for (x, y) in zip(xs[perm], ys[perm])]
end
Expand Down
2 changes: 1 addition & 1 deletion src/geom/rectbin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function render(geom::RectangularBinGeometry, theme::Gadfly.Theme, aes::Gadfly.A
if length(aes.color) == n
cs = aes.color
else
cs = Array{RGBA{Float32}}(n)
cs = Array{RGBA{Float32}}(undef, n)
for i in 1:n
cs[i] = aes.color[((i - 1) % length(aes.color)) + 1]
end
Expand Down
8 changes: 4 additions & 4 deletions src/geom/subplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ function render(geom::SubplotGrid, theme::Gadfly.Theme,
end
end

layer_aes_grid = Array{Matrix{Gadfly.Aesthetics}}(length(geom.layers))
layer_aes_grid = Array{Matrix{Gadfly.Aesthetics}}(undef, length(geom.layers))
for (i, (layer, aes)) in enumerate(zip(geom.layers, subplot_layer_aess))
layer_aes_grid[i] = Gadfly.by_xy_group(aes, aes.xgroup, aes.ygroup, m, n)
end

layer_data_grid = Array{Matrix{Gadfly.Data}}(length(geom.layers))
layer_data_grid = Array{Matrix{Gadfly.Data}}(undef, length(geom.layers))
for (i, (layer, data, aes)) in enumerate(zip(geom.layers, subplot_layer_datas,
subplot_layer_aess))
layer_data_grid[i] = Gadfly.by_xy_group(data, aes.xgroup, aes.ygroup, m, n)
Expand Down Expand Up @@ -224,7 +224,7 @@ function render(geom::SubplotGrid, theme::Gadfly.Theme,
Gadfly.inherit!(col_aes, geom_aes)
Stat.apply_statistic(Stat.xticks(), scales, coord, col_aes)

aes_grid[:, j] = col_aes
aes_grid[:, j] .= col_aes
end
end

Expand Down Expand Up @@ -349,7 +349,7 @@ function render(geom::SubplotGrid, theme::Gadfly.Theme,
# copy over the correct units, since we are reparenting the children
for u in 1:size(subtbl, 1), v in 1:size(subtbl, 2)
for child in subtbl[u, v]
if isnull(child.units)
if child.units===nothing
child.units = subtbl.units
end
end
Expand Down
Loading

0 comments on commit afefa1a

Please sign in to comment.