remove unneccesary NaNMath calls
This commit is contained in:
parent
96181926d7
commit
77dd5a0805
@ -1382,7 +1382,7 @@ function label_scatter(d, w, ho)
|
||||
if isapprox(bbw[3], 0)
|
||||
bbw = Vec3f0(bbw[1], bbw[2], 1)
|
||||
end
|
||||
mini = NaNMath.minimum(bb)
|
||||
mini = minimum(bb)
|
||||
m = GLAbstraction.translationmatrix(-mini)
|
||||
m *= GLAbstraction.scalematrix(1 ./ bbw)
|
||||
kw[:primitive] = m * p
|
||||
|
||||
@ -341,7 +341,7 @@ end
|
||||
function gr_set_line(lw, style, c) #, a)
|
||||
GR.setlinetype(gr_linetype[style])
|
||||
w, h = gr_plot_size
|
||||
GR.setlinewidth(NaNMath.max(0, lw / ((w + h) * 0.001)))
|
||||
GR.setlinewidth(max(0, lw / ((w + h) * 0.001)))
|
||||
gr_set_linecolor(c) #, a)
|
||||
end
|
||||
|
||||
@ -394,7 +394,7 @@ function gr_viewport_from_bbox(sp::Subplot{GRBackend}, bb::BoundingBox, w, h, vi
|
||||
viewport[4] = viewport_canvas[4] * (1.0 - top(bb) / h)
|
||||
if is3d(sp)
|
||||
vp = viewport[:]
|
||||
extent = NaNMath.min(vp[2] - vp[1], vp[4] - vp[3])
|
||||
extent = min(vp[2] - vp[1], vp[4] - vp[3])
|
||||
viewport[1] = 0.5 * (vp[1] + vp[2] - extent)
|
||||
viewport[2] = 0.5 * (vp[1] + vp[2] + extent)
|
||||
viewport[3] = 0.5 * (vp[3] + vp[4] - extent)
|
||||
@ -824,7 +824,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
||||
# create the colorbar of contour levels
|
||||
if sp[:colorbar] != :none
|
||||
gr_set_viewport_cmap(sp)
|
||||
l = round(Int32, 1000 + (h - NaNMath.minimum(h)) / (NaNMath.maximum(h) - NaNMath.minimum(h)) * 255) #much in doubt whether to use the NaNMath minimum here
|
||||
l = round(Int32, 1000 + (h - NaNMath.minimum(h)) / (NaNMath.maximum(h) - NaNMath.minimum(h)) * 255)
|
||||
GR.setwindow(xmin, xmax, zmin, zmax)
|
||||
GR.cellarray(xmin, xmax, zmax, zmin, 1, length(l), l)
|
||||
ztick = 0.5 * GR.tick(zmin, zmax)
|
||||
|
||||
@ -705,11 +705,11 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
||||
# contours on the axis planes
|
||||
if series[:contours]
|
||||
for (zdir,mat) in (("x",x), ("y",y), ("z",z))
|
||||
offset = (zdir == "y" ? _maximum : _minimum)(mat)
|
||||
offset = (zdir == "y" ? NaNMath.maximum : NaNMath.minimum)(mat)
|
||||
handle = ax[:contourf](x, y, z, levelargs...;
|
||||
zdir = zdir,
|
||||
cmap = py_fillcolormap(series),
|
||||
offset = (zdir == "y" ? _maximum : _minimum)(mat) # where to draw the contour plane
|
||||
offset = (zdir == "y" ? NaNMath.maximum : NaNMath.minimum)(mat) # where to draw the contour plane
|
||||
)
|
||||
push!(handles, handle)
|
||||
needs_colorbar = true
|
||||
@ -1096,10 +1096,10 @@ function _update_min_padding!(sp::Subplot{PyPlotBackend})
|
||||
bottompad = 0mm
|
||||
for bb in (py_bbox_axis(ax, "x"), py_bbox_axis(ax, "y"), py_bbox_title(ax))
|
||||
if ispositive(width(bb)) && ispositive(height(bb))
|
||||
leftpad = NaNMath.max(leftpad, left(plotbb) - left(bb))
|
||||
toppad = NaNMath.max(toppad, top(plotbb) - top(bb))
|
||||
rightpad = NaNMath.max(rightpad, right(bb) - right(plotbb))
|
||||
bottompad = NaNMath.max(bottompad, bottom(bb) - bottom(plotbb))
|
||||
leftpad = max(leftpad, left(plotbb) - left(bb))
|
||||
toppad = max(toppad, top(plotbb) - top(bb))
|
||||
rightpad = max(rightpad, right(bb) - right(plotbb))
|
||||
bottompad = max(bottompad, bottom(bb) - bottom(plotbb))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -646,7 +646,7 @@ function (bc::BezierCurve)(t::Real)
|
||||
end
|
||||
|
||||
# mean(x::Real, y::Real) = 0.5*(x+y) #commented out as I cannot see this used anywhere and it overwrites a Base method with different functionality
|
||||
NaNMath.mean{N,T<:Real}(ps::FixedSizeArrays.Vec{N,T}...) = NaNMath.sum(ps) / length(ps)
|
||||
# mean{N,T<:Real}(ps::FixedSizeArrays.Vec{N,T}...) = sum(ps) / length(ps) # I also could not see this used anywhere, and it's type piracy - implementing a NaNMath version for this would just involve converting to a standard array
|
||||
|
||||
@deprecate curve_points coords
|
||||
|
||||
|
||||
@ -55,10 +55,10 @@ function Base.:+(bb1::BoundingBox, bb2::BoundingBox)
|
||||
ispositive(width(bb2)) || return bb1
|
||||
ispositive(height(bb2)) || return bb1
|
||||
|
||||
l = NaNMath.min(left(bb1), left(bb2))
|
||||
t = NaNMath.min(top(bb1), top(bb2))
|
||||
r = NaNMath.max(right(bb1), right(bb2))
|
||||
b = NaNMath.max(bottom(bb1), bottom(bb2))
|
||||
l = min(left(bb1), left(bb2))
|
||||
t = min(top(bb1), top(bb2))
|
||||
r = max(right(bb1), right(bb2))
|
||||
b = max(bottom(bb1), bottom(bb2))
|
||||
BoundingBox(l, t, r-l, b-t)
|
||||
end
|
||||
|
||||
|
||||
@ -548,7 +548,7 @@ Plots.@deps stepbins path
|
||||
|
||||
|
||||
function _auto_binning_nbins{N}(vs::NTuple{N,AbstractVector}, dim::Integer; mode::Symbol = :auto)
|
||||
_cl(x) = NaNMath.max(ceil(Int, x), 1)
|
||||
_cl(x) = max(ceil(Int, x), 1)
|
||||
_iqr(v) = quantile(v, 0.75) - quantile(v, 0.25)
|
||||
_span(v) = NaNMath.maximum(v) - NaNMath.minimum(v)
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ function binData(data, nbins)
|
||||
lo, hi = NaNMath.extrema(data)
|
||||
edges = collect(linspace(lo, hi, nbins+1))
|
||||
midpoints = calcMidpoints(edges)
|
||||
buckets = Int[NaNMath.max(2, NaNMath.min(searchsortedfirst(edges, x), length(edges)))-1 for x in data]
|
||||
buckets = Int[max(2, min(searchsortedfirst(edges, x), length(edges)))-1 for x in data]
|
||||
counts = zeros(Int, length(midpoints))
|
||||
for b in buckets
|
||||
counts[b] += 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user