use === nothing
Should decrease compile times
This commit is contained in:
parent
ae4031b993
commit
f12f6db310
58
src/args.jl
58
src/args.jl
@ -685,15 +685,15 @@ function processLineArg(plotattributes::KW, arg)
|
|||||||
plotattributes[:linestyle] = arg
|
plotattributes[:linestyle] = arg
|
||||||
|
|
||||||
elseif typeof(arg) <: Stroke
|
elseif typeof(arg) <: Stroke
|
||||||
arg.width == nothing || (plotattributes[:linewidth] = arg.width)
|
arg.width === nothing || (plotattributes[:linewidth] = arg.width)
|
||||||
arg.color == nothing || (plotattributes[:linecolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[:linecolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[:linealpha] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[:linealpha] = arg.alpha)
|
||||||
arg.style == nothing || (plotattributes[:linestyle] = arg.style)
|
arg.style === nothing || (plotattributes[:linestyle] = arg.style)
|
||||||
|
|
||||||
elseif typeof(arg) <: Brush
|
elseif typeof(arg) <: Brush
|
||||||
arg.size == nothing || (plotattributes[:fillrange] = arg.size)
|
arg.size === nothing || (plotattributes[:fillrange] = arg.size)
|
||||||
arg.color == nothing || (plotattributes[:fillcolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[:fillcolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[:fillalpha] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[:fillalpha] = arg.alpha)
|
||||||
|
|
||||||
elseif typeof(arg) <: Arrow || arg in (:arrow, :arrows)
|
elseif typeof(arg) <: Arrow || arg in (:arrow, :arrows)
|
||||||
plotattributes[:arrow] = arg
|
plotattributes[:arrow] = arg
|
||||||
@ -724,15 +724,15 @@ function processMarkerArg(plotattributes::KW, arg)
|
|||||||
plotattributes[:markerstrokestyle] = arg
|
plotattributes[:markerstrokestyle] = arg
|
||||||
|
|
||||||
elseif typeof(arg) <: Stroke
|
elseif typeof(arg) <: Stroke
|
||||||
arg.width == nothing || (plotattributes[:markerstrokewidth] = arg.width)
|
arg.width === nothing || (plotattributes[:markerstrokewidth] = arg.width)
|
||||||
arg.color == nothing || (plotattributes[:markerstrokecolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[:markerstrokecolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[:markerstrokealpha] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[:markerstrokealpha] = arg.alpha)
|
||||||
arg.style == nothing || (plotattributes[:markerstrokestyle] = arg.style)
|
arg.style === nothing || (plotattributes[:markerstrokestyle] = arg.style)
|
||||||
|
|
||||||
elseif typeof(arg) <: Brush
|
elseif typeof(arg) <: Brush
|
||||||
arg.size == nothing || (plotattributes[:markersize] = arg.size)
|
arg.size === nothing || (plotattributes[:markersize] = arg.size)
|
||||||
arg.color == nothing || (plotattributes[:markercolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[:markercolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[:markeralpha] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[:markeralpha] = arg.alpha)
|
||||||
|
|
||||||
# linealpha
|
# linealpha
|
||||||
elseif allAlphas(arg)
|
elseif allAlphas(arg)
|
||||||
@ -757,9 +757,9 @@ end
|
|||||||
function processFillArg(plotattributes::KW, arg)
|
function processFillArg(plotattributes::KW, arg)
|
||||||
# fr = get(plotattributes, :fillrange, 0)
|
# fr = get(plotattributes, :fillrange, 0)
|
||||||
if typeof(arg) <: Brush
|
if typeof(arg) <: Brush
|
||||||
arg.size == nothing || (plotattributes[:fillrange] = arg.size)
|
arg.size === nothing || (plotattributes[:fillrange] = arg.size)
|
||||||
arg.color == nothing || (plotattributes[:fillcolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[:fillcolor] = arg.color == :auto ? :auto : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[:fillalpha] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[:fillalpha] = arg.alpha)
|
||||||
|
|
||||||
elseif typeof(arg) <: Bool
|
elseif typeof(arg) <: Bool
|
||||||
plotattributes[:fillrange] = arg ? 0 : nothing
|
plotattributes[:fillrange] = arg ? 0 : nothing
|
||||||
@ -793,10 +793,10 @@ function processGridArg!(plotattributes::KW, arg, letter)
|
|||||||
plotattributes[Symbol(letter, :gridstyle)] = arg
|
plotattributes[Symbol(letter, :gridstyle)] = arg
|
||||||
|
|
||||||
elseif typeof(arg) <: Stroke
|
elseif typeof(arg) <: Stroke
|
||||||
arg.width == nothing || (plotattributes[Symbol(letter, :gridlinewidth)] = arg.width)
|
arg.width === nothing || (plotattributes[Symbol(letter, :gridlinewidth)] = arg.width)
|
||||||
arg.color == nothing || (plotattributes[Symbol(letter, :foreground_color_grid)] = arg.color in (:auto, :match) ? :match : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[Symbol(letter, :foreground_color_grid)] = arg.color in (:auto, :match) ? :match : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[Symbol(letter, :gridalpha)] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[Symbol(letter, :gridalpha)] = arg.alpha)
|
||||||
arg.style == nothing || (plotattributes[Symbol(letter, :gridstyle)] = arg.style)
|
arg.style === nothing || (plotattributes[Symbol(letter, :gridstyle)] = arg.style)
|
||||||
|
|
||||||
# linealpha
|
# linealpha
|
||||||
elseif allAlphas(arg)
|
elseif allAlphas(arg)
|
||||||
@ -822,10 +822,10 @@ function processMinorGridArg!(plotattributes::KW, arg, letter)
|
|||||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||||
|
|
||||||
elseif typeof(arg) <: Stroke
|
elseif typeof(arg) <: Stroke
|
||||||
arg.width == nothing || (plotattributes[Symbol(letter, :minorgridlinewidth)] = arg.width)
|
arg.width === nothing || (plotattributes[Symbol(letter, :minorgridlinewidth)] = arg.width)
|
||||||
arg.color == nothing || (plotattributes[Symbol(letter, :foreground_color_minor_grid)] = arg.color in (:auto, :match) ? :match : plot_color(arg.color))
|
arg.color === nothing || (plotattributes[Symbol(letter, :foreground_color_minor_grid)] = arg.color in (:auto, :match) ? :match : plot_color(arg.color))
|
||||||
arg.alpha == nothing || (plotattributes[Symbol(letter, :minorgridalpha)] = arg.alpha)
|
arg.alpha === nothing || (plotattributes[Symbol(letter, :minorgridalpha)] = arg.alpha)
|
||||||
arg.style == nothing || (plotattributes[Symbol(letter, :minorgridstyle)] = arg.style)
|
arg.style === nothing || (plotattributes[Symbol(letter, :minorgridstyle)] = arg.style)
|
||||||
plotattributes[Symbol(letter, :minorgrid)] = true
|
plotattributes[Symbol(letter, :minorgrid)] = true
|
||||||
|
|
||||||
# linealpha
|
# linealpha
|
||||||
@ -1237,7 +1237,7 @@ end
|
|||||||
# v = plotattributes[k]
|
# v = plotattributes[k]
|
||||||
# plotattributes[k] = if v == :match
|
# plotattributes[k] = if v == :match
|
||||||
# match_color
|
# match_color
|
||||||
# elseif v == nothing
|
# elseif v === nothing
|
||||||
# plot_color(RGBA(0,0,0,0))
|
# plot_color(RGBA(0,0,0,0))
|
||||||
# else
|
# else
|
||||||
# v
|
# v
|
||||||
@ -1246,7 +1246,7 @@ end
|
|||||||
|
|
||||||
function color_or_nothing!(plotattributes::KW, k::Symbol)
|
function color_or_nothing!(plotattributes::KW, k::Symbol)
|
||||||
v = plotattributes[k]
|
v = plotattributes[k]
|
||||||
plotattributes[k] = if v == nothing || v == false
|
plotattributes[k] = if v === nothing || v == false
|
||||||
RGBA{Float64}(0,0,0,0)
|
RGBA{Float64}(0,0,0,0)
|
||||||
elseif v != :match
|
elseif v != :match
|
||||||
plot_color(v)
|
plot_color(v)
|
||||||
@ -1563,11 +1563,11 @@ function _update_series_attributes!(plotattributes::KW, plt::Plot, sp::Subplot)
|
|||||||
|
|
||||||
# update alphas
|
# update alphas
|
||||||
for asym in (:linealpha, :markeralpha, :fillalpha)
|
for asym in (:linealpha, :markeralpha, :fillalpha)
|
||||||
if plotattributes[asym] == nothing
|
if plotattributes[asym] === nothing
|
||||||
plotattributes[asym] = plotattributes[:seriesalpha]
|
plotattributes[asym] = plotattributes[:seriesalpha]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if plotattributes[:markerstrokealpha] == nothing
|
if plotattributes[:markerstrokealpha] === nothing
|
||||||
plotattributes[:markerstrokealpha] = plotattributes[:markeralpha]
|
plotattributes[:markerstrokealpha] = plotattributes[:markeralpha]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
10
src/axes.jl
10
src/axes.jl
@ -67,7 +67,7 @@ function process_axis_arg!(plotattributes::KW, arg, letter = "")
|
|||||||
elseif T <: AVec
|
elseif T <: AVec
|
||||||
plotattributes[Symbol(letter,:ticks)] = arg
|
plotattributes[Symbol(letter,:ticks)] = arg
|
||||||
|
|
||||||
elseif arg == nothing
|
elseif arg === nothing
|
||||||
plotattributes[Symbol(letter,:ticks)] = []
|
plotattributes[Symbol(letter,:ticks)] = []
|
||||||
|
|
||||||
elseif T <: Bool || arg in _allShowaxisArgs
|
elseif T <: Bool || arg in _allShowaxisArgs
|
||||||
@ -166,7 +166,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
|
|||||||
# or DateTime) is chosen based on the time span between amin and amax
|
# or DateTime) is chosen based on the time span between amin and amax
|
||||||
# rather than on the input format
|
# rather than on the input format
|
||||||
# TODO: maybe: non-trivial scale (:ln, :log2, :log10) for date/datetime
|
# TODO: maybe: non-trivial scale (:ln, :log2, :log10) for date/datetime
|
||||||
if ticks == nothing && scale == :identity
|
if ticks === nothing && scale == :identity
|
||||||
if axis[:formatter] == dateformatter
|
if axis[:formatter] == dateformatter
|
||||||
# optimize_datetime_ticks returns ticks and labels(!) based on
|
# optimize_datetime_ticks returns ticks and labels(!) based on
|
||||||
# integers/floats corresponding to the DateTime type. Thus, the axes
|
# integers/floats corresponding to the DateTime type. Thus, the axes
|
||||||
@ -184,7 +184,7 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# get a list of well-laid-out ticks
|
# get a list of well-laid-out ticks
|
||||||
if ticks == nothing
|
if ticks === nothing
|
||||||
scaled_ticks = optimize_ticks(
|
scaled_ticks = optimize_ticks(
|
||||||
sf(amin),
|
sf(amin),
|
||||||
sf(amax);
|
sf(amax);
|
||||||
@ -399,7 +399,7 @@ function expand_extrema!(sp::Subplot, plotattributes::KW)
|
|||||||
|
|
||||||
# expand for fillrange
|
# expand for fillrange
|
||||||
fr = plotattributes[:fillrange]
|
fr = plotattributes[:fillrange]
|
||||||
if fr == nothing && plotattributes[:seriestype] == :bar
|
if fr === nothing && plotattributes[:seriestype] == :bar
|
||||||
fr = 0.0
|
fr = 0.0
|
||||||
end
|
end
|
||||||
if fr != nothing && !all3D(plotattributes)
|
if fr != nothing && !all3D(plotattributes)
|
||||||
@ -419,7 +419,7 @@ function expand_extrema!(sp::Subplot, plotattributes::KW)
|
|||||||
data = plotattributes[dsym]
|
data = plotattributes[dsym]
|
||||||
|
|
||||||
bw = plotattributes[:bar_width]
|
bw = plotattributes[:bar_width]
|
||||||
if bw == nothing
|
if bw === nothing
|
||||||
bw = plotattributes[:bar_width] = _bar_width * ignorenan_minimum(filter(x->x>0,diff(sort(data))))
|
bw = plotattributes[:bar_width] = _bar_width * ignorenan_minimum(filter(x->x>0,diff(sort(data))))
|
||||||
end
|
end
|
||||||
axis = sp.attr[Symbol(dsym, :axis)]
|
axis = sp.attr[Symbol(dsym, :axis)]
|
||||||
|
|||||||
@ -77,7 +77,7 @@ text_size(lab::AbstractString, sz::Number, rot::Number = 0) = text_size(length(l
|
|||||||
# account for the size/length/rotation of tick labels
|
# account for the size/length/rotation of tick labels
|
||||||
function tick_padding(sp::Subplot, axis::Axis)
|
function tick_padding(sp::Subplot, axis::Axis)
|
||||||
ticks = get_ticks(sp, axis)
|
ticks = get_ticks(sp, axis)
|
||||||
if ticks == nothing
|
if ticks === nothing
|
||||||
0mm
|
0mm
|
||||||
else
|
else
|
||||||
vals, labs = ticks
|
vals, labs = ticks
|
||||||
|
|||||||
@ -620,7 +620,7 @@ end
|
|||||||
|
|
||||||
function gr_set_gradient(series::Series)
|
function gr_set_gradient(series::Series)
|
||||||
color = gr_get_color(series)
|
color = gr_get_color(series)
|
||||||
color !== nothing && gr_set_gradient(color)
|
color !=== nothing && gr_set_gradient(color)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gr_get_color(series::Series)
|
function gr_get_color(series::Series)
|
||||||
@ -1509,7 +1509,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
lc = get_linecolor(series, clims)
|
lc = get_linecolor(series, clims)
|
||||||
gr_set_line(get_linewidth(series), get_linestyle(series), lc) #, series[:linealpha])
|
gr_set_line(get_linewidth(series), get_linestyle(series), lc) #, series[:linealpha])
|
||||||
|
|
||||||
if (st == :shape || series[:fillrange] != nothing) && series[:ribbon] == nothing
|
if (st == :shape || series[:fillrange] != nothing) && series[:ribbon] === nothing
|
||||||
fc = get_fillcolor(series, clims)
|
fc = get_fillcolor(series, clims)
|
||||||
gr_set_fill(fc) #, series[:fillalpha])
|
gr_set_fill(fc) #, series[:fillalpha])
|
||||||
l, r = xpos-0.07, xpos-0.01
|
l, r = xpos-0.07, xpos-0.01
|
||||||
@ -1526,7 +1526,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
|
|
||||||
if st in (:path, :straightline)
|
if st in (:path, :straightline)
|
||||||
gr_set_transparency(lc, get_linealpha(series))
|
gr_set_transparency(lc, get_linealpha(series))
|
||||||
if series[:fillrange] == nothing || series[:ribbon] != nothing
|
if series[:fillrange] === nothing || series[:ribbon] != nothing
|
||||||
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos, ypos])
|
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos, ypos])
|
||||||
else
|
else
|
||||||
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos+0.4dy, ypos+0.4dy])
|
GR.polyline([xpos - 0.07, xpos - 0.01], [ypos+0.4dy, ypos+0.4dy])
|
||||||
|
|||||||
@ -827,7 +827,7 @@ function plotly_html_head(plt::Plot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function plotly_html_body(plt, style = nothing)
|
function plotly_html_body(plt, style = nothing)
|
||||||
if style == nothing
|
if style === nothing
|
||||||
w, h = plt[:size]
|
w, h = plt[:size]
|
||||||
style = "width:$(w)px;height:$(h)px;"
|
style = "width:$(w)px;height:$(h)px;"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -871,7 +871,7 @@ end
|
|||||||
function py_set_ticks(ax, ticks, letter)
|
function py_set_ticks(ax, ticks, letter)
|
||||||
ticks == :auto && return
|
ticks == :auto && return
|
||||||
axis = getproperty(ax, Symbol(letter,"axis"))
|
axis = getproperty(ax, Symbol(letter,"axis"))
|
||||||
if ticks == :none || ticks == nothing || ticks == false
|
if ticks == :none || ticks === nothing || ticks == false
|
||||||
kw = KW()
|
kw = KW()
|
||||||
for dir in (:top,:bottom,:left,:right)
|
for dir in (:top,:bottom,:left,:right)
|
||||||
kw[dir] = kw[Symbol(:label,dir)] = false
|
kw[dir] = kw[Symbol(:label,dir)] = false
|
||||||
@ -978,7 +978,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
# update subplots
|
# update subplots
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
if ax == nothing
|
if ax === nothing
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1186,7 +1186,7 @@ end
|
|||||||
# to fit ticks, tick labels, guides, colorbars, etc.
|
# to fit ticks, tick labels, guides, colorbars, etc.
|
||||||
function _update_min_padding!(sp::Subplot{PyPlotBackend})
|
function _update_min_padding!(sp::Subplot{PyPlotBackend})
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
ax == nothing && return sp.minpad
|
ax === nothing && return sp.minpad
|
||||||
plotbb = py_bbox(ax)
|
plotbb = py_bbox(ax)
|
||||||
|
|
||||||
# TODO: this should initialize to the margin from sp.attr
|
# TODO: this should initialize to the margin from sp.attr
|
||||||
@ -1352,7 +1352,7 @@ end
|
|||||||
function _update_plot_object(plt::Plot{PyPlotBackend})
|
function _update_plot_object(plt::Plot{PyPlotBackend})
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
ax = sp.o
|
ax = sp.o
|
||||||
ax == nothing && return
|
ax === nothing && return
|
||||||
figw, figh = sp.plt[:size]
|
figw, figh = sp.plt[:size]
|
||||||
figw, figh = figw*px, figh*px
|
figw, figh = figw*px, figh*px
|
||||||
pcts = bbox_to_pcts(sp.plotarea, figw, figh)
|
pcts = bbox_to_pcts(sp.plotarea, figw, figh)
|
||||||
|
|||||||
@ -568,7 +568,7 @@ mutable struct EachAnn
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Base.iterate(ea::EachAnn, i = 1)
|
function Base.iterate(ea::EachAnn, i = 1)
|
||||||
if ea.anns == nothing || isempty(ea.anns.strs) || i > length(ea.y)
|
if ea.anns === nothing || isempty(ea.anns.strs) || i > length(ea.y)
|
||||||
return nothing
|
return nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ mutable struct CurrentPlot
|
|||||||
end
|
end
|
||||||
const CURRENT_PLOT = CurrentPlot(nothing)
|
const CURRENT_PLOT = CurrentPlot(nothing)
|
||||||
|
|
||||||
isplotnull() = CURRENT_PLOT.nullableplot == nothing
|
isplotnull() = CURRENT_PLOT.nullableplot === nothing
|
||||||
|
|
||||||
"""
|
"""
|
||||||
current()
|
current()
|
||||||
|
|||||||
@ -239,7 +239,7 @@ end
|
|||||||
@recipe function f(::Type{Val{:sticks}}, x, y, z)
|
@recipe function f(::Type{Val{:sticks}}, x, y, z)
|
||||||
n = length(x)
|
n = length(x)
|
||||||
fr = plotattributes[:fillrange]
|
fr = plotattributes[:fillrange]
|
||||||
if fr == nothing
|
if fr === nothing
|
||||||
sp = plotattributes[:subplot]
|
sp = plotattributes[:subplot]
|
||||||
yaxis = sp[:yaxis]
|
yaxis = sp[:yaxis]
|
||||||
fr = if yaxis[:scale] == :identity
|
fr = if yaxis[:scale] == :identity
|
||||||
@ -321,7 +321,7 @@ end
|
|||||||
|
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := newy
|
||||||
if z == nothing
|
if z === nothing
|
||||||
seriestype := :path
|
seriestype := :path
|
||||||
else
|
else
|
||||||
seriestype := :path3d
|
seriestype := :path3d
|
||||||
@ -357,7 +357,7 @@ end
|
|||||||
|
|
||||||
# compute half-width of bars
|
# compute half-width of bars
|
||||||
bw = plotattributes[:bar_width]
|
bw = plotattributes[:bar_width]
|
||||||
hw = if bw == nothing
|
hw = if bw === nothing
|
||||||
if nx > 1
|
if nx > 1
|
||||||
0.5*_bar_width*ignorenan_minimum(filter(x->x>0, diff(procx)))
|
0.5*_bar_width*ignorenan_minimum(filter(x->x>0, diff(procx)))
|
||||||
else
|
else
|
||||||
@ -369,7 +369,7 @@ end
|
|||||||
|
|
||||||
# make fillto a vector... default fills to 0
|
# make fillto a vector... default fills to 0
|
||||||
fillto = plotattributes[:fillrange]
|
fillto = plotattributes[:fillrange]
|
||||||
if fillto == nothing
|
if fillto === nothing
|
||||||
fillto = 0
|
fillto = 0
|
||||||
end
|
end
|
||||||
if (yscale in _logScales) && !all(_is_positive, fillto)
|
if (yscale in _logScales) && !all(_is_positive, fillto)
|
||||||
@ -491,7 +491,7 @@ end
|
|||||||
|
|
||||||
@recipe function f(::Type{Val{:barbins}}, x, y, z)
|
@recipe function f(::Type{Val{:barbins}}, x, y, z)
|
||||||
edge, weights, xscale, yscale, baseline = _preprocess_binlike(plotattributes, x, y)
|
edge, weights, xscale, yscale, baseline = _preprocess_binlike(plotattributes, x, y)
|
||||||
if (plotattributes[:bar_width] == nothing)
|
if (plotattributes[:bar_width] === nothing)
|
||||||
bar_width := diff(edge)
|
bar_width := diff(edge)
|
||||||
end
|
end
|
||||||
x := _bin_centers(edge)
|
x := _bin_centers(edge)
|
||||||
@ -667,7 +667,7 @@ end
|
|||||||
function _make_hist(vs::NTuple{N,AbstractVector}, binning; normed = false, weights = nothing) where N
|
function _make_hist(vs::NTuple{N,AbstractVector}, binning; normed = false, weights = nothing) where N
|
||||||
localvs = _filternans(vs)
|
localvs = _filternans(vs)
|
||||||
edges = _hist_edges(localvs, binning)
|
edges = _hist_edges(localvs, binning)
|
||||||
h = float( weights == nothing ?
|
h = float( weights === nothing ?
|
||||||
StatsBase.fit(StatsBase.Histogram, localvs, edges, closed = :left) :
|
StatsBase.fit(StatsBase.Histogram, localvs, edges, closed = :left) :
|
||||||
StatsBase.fit(StatsBase.Histogram, localvs, StatsBase.Weights(weights), edges, closed = :left)
|
StatsBase.fit(StatsBase.Histogram, localvs, StatsBase.Weights(weights), edges, closed = :left)
|
||||||
)
|
)
|
||||||
|
|||||||
20
src/utils.jl
20
src/utils.jl
@ -26,7 +26,7 @@ function histogramHack(; kw...)
|
|||||||
plotattributes[:x] = midpoints
|
plotattributes[:x] = midpoints
|
||||||
plotattributes[:y] = float(counts)
|
plotattributes[:y] = float(counts)
|
||||||
plotattributes[:seriestype] = :bar
|
plotattributes[:seriestype] = :bar
|
||||||
plotattributes[:fillrange] = plotattributes[:fillrange] == nothing ? 0.0 : plotattributes[:fillrange]
|
plotattributes[:fillrange] = plotattributes[:fillrange] === nothing ? 0.0 : plotattributes[:fillrange]
|
||||||
plotattributes
|
plotattributes
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ function barHack(; kw...)
|
|||||||
plotattributes = KW(kw)
|
plotattributes = KW(kw)
|
||||||
midpoints = plotattributes[:x]
|
midpoints = plotattributes[:x]
|
||||||
heights = plotattributes[:y]
|
heights = plotattributes[:y]
|
||||||
fillrange = plotattributes[:fillrange] == nothing ? 0.0 : plotattributes[:fillrange]
|
fillrange = plotattributes[:fillrange] === nothing ? 0.0 : plotattributes[:fillrange]
|
||||||
|
|
||||||
# estimate the edges
|
# estimate the edges
|
||||||
dists = diff(midpoints) * 0.5
|
dists = diff(midpoints) * 0.5
|
||||||
@ -81,7 +81,7 @@ function sticksHack(; kw...)
|
|||||||
# these are the line vertices
|
# these are the line vertices
|
||||||
x = Float64[]
|
x = Float64[]
|
||||||
y = Float64[]
|
y = Float64[]
|
||||||
fillrange = plotattributesLine[:fillrange] == nothing ? 0.0 : plotattributesLine[:fillrange]
|
fillrange = plotattributesLine[:fillrange] === nothing ? 0.0 : plotattributesLine[:fillrange]
|
||||||
|
|
||||||
# calculate the vertices
|
# calculate the vertices
|
||||||
yScatter = plotattributesScatter[:y]
|
yScatter = plotattributesScatter[:y]
|
||||||
@ -194,7 +194,7 @@ end
|
|||||||
|
|
||||||
function iter_segments(series::Series)
|
function iter_segments(series::Series)
|
||||||
x, y, z = series[:x], series[:y], series[:z]
|
x, y, z = series[:x], series[:y], series[:z]
|
||||||
if x == nothing
|
if x === nothing
|
||||||
return UnitRange{Int}[]
|
return UnitRange{Int}[]
|
||||||
elseif has_attribute_segments(series)
|
elseif has_attribute_segments(series)
|
||||||
if series[:seriestype] in (:scatter, :scatter3d)
|
if series[:seriestype] in (:scatter, :scatter3d)
|
||||||
@ -478,7 +478,7 @@ function make_fillrange_from_ribbon(kw::KW)
|
|||||||
rib1, rib2 = -first(rib), last(rib)
|
rib1, rib2 = -first(rib), last(rib)
|
||||||
# kw[:ribbon] = nothing
|
# kw[:ribbon] = nothing
|
||||||
kw[:fillrange] = make_fillrange_side(y, rib1), make_fillrange_side(y, rib2)
|
kw[:fillrange] = make_fillrange_side(y, rib1), make_fillrange_side(y, rib2)
|
||||||
(get(kw, :fillalpha, nothing) == nothing) && (kw[:fillalpha] = 0.5)
|
(get(kw, :fillalpha, nothing) === nothing) && (kw[:fillalpha] = 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
#turn tuple of fillranges to one path
|
#turn tuple of fillranges to one path
|
||||||
@ -560,18 +560,18 @@ function colorbar_style(series::Series)
|
|||||||
elseif iscontour(series)
|
elseif iscontour(series)
|
||||||
cbar_lines
|
cbar_lines
|
||||||
elseif series[:seriestype] ∈ (:heatmap,:surface) ||
|
elseif series[:seriestype] ∈ (:heatmap,:surface) ||
|
||||||
any(series[z] !== nothing for z ∈ [:marker_z,:line_z,:fill_z])
|
any(series[z] !=== nothing for z ∈ [:marker_z,:line_z,:fill_z])
|
||||||
cbar_gradient
|
cbar_gradient
|
||||||
else
|
else
|
||||||
nothing
|
nothing
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hascolorbar(series::Series) = colorbar_style(series) !== nothing
|
hascolorbar(series::Series) = colorbar_style(series) !=== nothing
|
||||||
hascolorbar(sp::Subplot) = sp[:colorbar] != :none && any(hascolorbar(s) for s in series_list(sp))
|
hascolorbar(sp::Subplot) = sp[:colorbar] != :none && any(hascolorbar(s) for s in series_list(sp))
|
||||||
|
|
||||||
iscontour(series::Series) = series[:seriestype] == :contour
|
iscontour(series::Series) = series[:seriestype] == :contour
|
||||||
isfilledcontour(series::Series) = iscontour(series) && series[:fillrange] !== nothing
|
isfilledcontour(series::Series) = iscontour(series) && series[:fillrange] !=== nothing
|
||||||
|
|
||||||
function contour_levels(series::Series, clims)
|
function contour_levels(series::Series, clims)
|
||||||
iscontour(series) || error("Not a contour series")
|
iscontour(series) || error("Not a contour series")
|
||||||
@ -602,7 +602,7 @@ for comp in (:line, :fill, :marker)
|
|||||||
function $get_compcolor(series, cmin::Real, cmax::Real, i::Int = 1)
|
function $get_compcolor(series, cmin::Real, cmax::Real, i::Int = 1)
|
||||||
c = series[$Symbol($compcolor)]
|
c = series[$Symbol($compcolor)]
|
||||||
z = series[$Symbol($comp_z)]
|
z = series[$Symbol($comp_z)]
|
||||||
if z == nothing
|
if z === nothing
|
||||||
isa(c, ColorGradient) ? c : plot_color(_cycle(c, i))
|
isa(c, ColorGradient) ? c : plot_color(_cycle(c, i))
|
||||||
else
|
else
|
||||||
grad = isa(c, ColorGradient) ? c : cgrad()
|
grad = isa(c, ColorGradient) ? c : cgrad()
|
||||||
@ -613,7 +613,7 @@ for comp in (:line, :fill, :marker)
|
|||||||
$get_compcolor(series, clims, i::Int = 1) = $get_compcolor(series, clims[1], clims[2], i)
|
$get_compcolor(series, clims, i::Int = 1) = $get_compcolor(series, clims[1], clims[2], i)
|
||||||
|
|
||||||
function $get_compcolor(series, i::Int = 1)
|
function $get_compcolor(series, i::Int = 1)
|
||||||
if series[$Symbol($comp_z)] == nothing
|
if series[$Symbol($comp_z)] === nothing
|
||||||
$get_compcolor(series, 0, 1, i)
|
$get_compcolor(series, 0, 1, i)
|
||||||
else
|
else
|
||||||
$get_compcolor(series, get_clims(series[:subplot]), i)
|
$get_compcolor(series, get_clims(series[:subplot]), i)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is
|
|||||||
|
|
||||||
# now we have the fn (if any)... do the comparison
|
# now we have the fn (if any)... do the comparison
|
||||||
# @show reffn
|
# @show reffn
|
||||||
if reffn == nothing
|
if reffn === nothing
|
||||||
reffn = newfn
|
reffn = newfn
|
||||||
end
|
end
|
||||||
# @show reffn
|
# @show reffn
|
||||||
@ -98,7 +98,7 @@ function image_comparison_facts(pkg::Symbol;
|
|||||||
tol = 1e-2) # acceptable error (percent)
|
tol = 1e-2) # acceptable error (percent)
|
||||||
for i in 1:length(Plots._examples)
|
for i in 1:length(Plots._examples)
|
||||||
i in skip && continue
|
i in skip && continue
|
||||||
if only == nothing || i in only
|
if only === nothing || i in only
|
||||||
@test image_comparison_tests(pkg, i, debug=debug, sigma=sigma, tol=tol) |> success == true
|
@test image_comparison_tests(pkg, i, debug=debug, sigma=sigma, tol=tol) |> success == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user