Skip to content

Commit

Permalink
Remove a few less dangerous uses of 1:length as well
Browse files Browse the repository at this point in the history
  • Loading branch information
brenhinkeller committed May 23, 2022
1 parent 4f6cd0a commit 332af84
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ const _series_defaults = KW(
:hover => nothing, # text to display when hovering over the data points
:stride => (1, 1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride.
:connections => nothing, # tuple of arrays to specifiy connectivity of a 3d mesh
:z_order => :front, # one of :front, :back or integer in 1:length(sp.series_list)
:z_order => :front, # one of :front, :back or integer in eachindex(sp.series_list)
:permute => :none, # tuple of two symbols to be permuted
:extra_kwargs => Dict(),
)
Expand Down
2 changes: 1 addition & 1 deletion src/backends/gaston.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
if gsp.dims == 2 && z === nothing
for (n, seg) in enumerate(series_segments(series, st; check = true))
i, rng = seg.attr_index, seg.range
fr = _cycle(series[:fillrange], 1:length(x[rng]))
fr = _cycle(series[:fillrange], eachindex(x[rng]))
for sc in gaston_seriesconf!(sp, series, i, n == 1)
push!(curves, Gaston.Curve(x[rng], y[rng], nothing, fr, sc))
end
Expand Down
2 changes: 1 addition & 1 deletion src/backends/pgfplotsx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ function pgfx_colormap(v::Vector{<:Colorant})
end
function pgfx_colormap(cg::ColorGradient)
join(
map(1:length(cg)) do i
map(eachindex(cg.colors)) do i
@sprintf(
"rgb(%.8f)=(%.8f,%.8f,%.8f)",
cg.values[i],
Expand Down
2 changes: 1 addition & 1 deletion src/backends/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ end

function plotly_series_shapes(plt::Plot, series::Series, clims)
segments = series_segments(series; check = true)
plotattributes_outs = [KW() for _ in 1:length(segments)]
plotattributes_outs = [KW() for _ in eachindex(segments)]

# TODO: create a plotattributes_out for each polygon
# x, y = series[:x], series[:y]
Expand Down
2 changes: 1 addition & 1 deletion test/imgcomp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function image_comparison_facts(
sigma = [1, 1], # number of pixels to "blur"
tol = 1e-2,
) # acceptable error (percent)
for i in 1:length(Plots._examples)
for i in eachindex(Plots._examples)
i in skip && continue
if only === nothing || i in only
@test image_comparison_tests(pkg, i, debug = debug, sigma = sigma, tol = tol) |>
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ const PLOTS_IMG_TOL = parse(
# :pyplot, # FIXME: fails with system matplotlib
)
only = setdiff(
1:length(Plots._examples),
eachindex(Plots._examples),
(Plots._backend_skips[be] for be in backends)...,
)
for be in backends
Expand Down

0 comments on commit 332af84

Please sign in to comment.