Skip to content

Commit ebfb969

Browse files
committed
cleanup
1 parent b2f4c10 commit ebfb969

File tree

16 files changed

+43
-42
lines changed

16 files changed

+43
-42
lines changed

GraphRecipes/src/misc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
function add_ast(adjlist, names, depthdict, depthlists, nodetypes, ex::Expr, parent_idx)
55
idx = length(names) + 1
6-
iscall = ex.head == :call
6+
iscall = ex.head :call
77
push!(names, iscall ? string(ex.args[1]) : string(ex.head))
88
push!(nodetypes, iscall ? :call : :expr)
99
l = Int[]
@@ -53,7 +53,7 @@ end
5353
method := :buchheim
5454
root --> :top
5555

56-
# markercolor --> Symbol[(nt == :call ? :pink : nt == :leaf ? :white : :lightgreen) for nt in nodetypes]
56+
# markercolor --> Symbol[(nt :call ? :pink : nt :leaf ? :white : :lightgreen) for nt in nodetypes]
5757

5858
# # compute the y-values from the depthdict dict
5959
# n = length(depthlists)-1

PlotsBase/ext/GastonExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ function gaston_parse_axes_attrs(
577577
end
578578
push!(axesconf, "set $(letter)$(I)range [$lo:$hi]")
579579

580-
offset = if dims == 2 && letter == :y
580+
offset = if dims == 2 && letter :y
581581
# ticks appear too close to the border, offset them by 1 character
582582
"offset " * string(axis[:mirror] ? 1 : -1)
583583
else

PlotsBase/ext/ImageInTerminalExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module ImageInTerminalExt
33
import ImageInTerminal
44
import PlotsBase
55

6-
if ImageInTerminal.ENCODER_BACKEND[] == :Sixel
6+
if ImageInTerminal.ENCODER_BACKEND[] :Sixel
77
get!(ENV, "GKSwstype", "nul") # disable `gr` output, we display in the terminal instead
88
for be in (
99
PlotsBase.GRBackend,

PlotsBase/src/Axes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function PlotsBase.attr!(axis::Axis, args...; kw...)
348348
end
349349

350350
function get_guide(axis::Axis)
351-
if isnothing(axis[:unit]) || axis[:unitformat] == :nounit
351+
if isnothing(axis[:unit]) || axis[:unitformat] :nounit
352352
return axis[:guide]
353353
else
354354
ustr = if PlotsBase.backend_name() :pgfplotsx

PlotsBase/src/Colorbars.jl

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
module Colorbars
22

3-
export colorbar_style, get_clims, update_clims, hascolorbar
3+
export colorbar_style, update_clims, hascolorbar
44
export get_colorbar_ticks, _update_subplot_colorbars
55

6-
import ..Commons: Commons, NaNMath, ignorenan_extrema, get_clims
6+
import ..Commons
77
import ..Surfaces
8+
import ..NaNMath
9+
import ..Ticks
810

911
using ..Subplots: Subplot, series_list
10-
using ..Ticks: _transform_ticks
1112
using ..DataSeries
12-
using ..Ticks
1313

14-
# these functions return an operator for use in `get_clims(::Seres, op)`
15-
process_clims(lims::Tuple{<:Number, <:Number}) =
16-
(zlims -> ifelse.(isfinite.(lims), lims, zlims)) ignorenan_extrema
17-
process_clims(s::Union{Symbol, Nothing, Missing}) = ignorenan_extrema
18-
# don't specialize on ::Function otherwise python functions won't work
19-
process_clims(f) = f
20-
get_clims(series::Series)::Tuple{Float64, Float64} =
14+
Commons.get_clims(series::Series)::Tuple{Float64, Float64} =
2115
haskey(series.plotattributes, :clims_calculated) ?
2216
series[:clims_calculated]::Tuple{Float64, Float64} : update_clims(series)
2317

24-
get_clims(sp::Subplot)::Tuple{Float64, Float64} =
18+
Commons.get_clims(sp::Subplot)::Tuple{Float64, Float64} =
2519
haskey(sp.attr, :clims_calculated) ? sp[:clims_calculated] : update_clims(sp)
2620

27-
get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} =
28-
series[:colorbar_entry] ? get_clims(sp) : get_clims(series)
21+
Commons.get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} =
22+
series[:colorbar_entry] ? Commons.get_clims(sp) : Commons.get_clims(series)
23+
24+
# these functions return an operator for use in `update_clims`
25+
process_clims(lims::Tuple{<:Number, <:Number}) =
26+
(zlims -> ifelse.(isfinite.(lims), lims, zlims)) Commons.ignorenan_extrema
27+
process_clims(s::Union{Symbol, Nothing, Missing}) = Commons.ignorenan_extrema
28+
# don't specialize on ::Function otherwise python functions won't work
29+
process_clims(f) = f
2930

3031
function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64}
3132
zmin, zmax = Inf, -Inf
@@ -52,7 +53,7 @@ function update_clims(
5253
series::Series,
5354
op = process_clims(sp[:clims]),
5455
)::Tuple{Float64, Float64}
55-
zmin, zmax = get_clims(sp)
56+
zmin, zmax = Commons.get_clims(sp)
5657
old_zmin, old_zmax = zmin, zmax
5758
if series[:colorbar_entry]::Bool
5859
zmin, zmax = _update_clims(zmin, zmax, update_clims(series, op)...)
@@ -71,7 +72,7 @@ Finds the limits for the colorbar by taking the "z-values" for the series and pa
7172
which must return the tuple `(zmin, zmax)`. The default op is the extrema of the finite
7273
values of the input. The value is stored as a series property, which is retrieved by `get_clims`.
7374
"""
74-
function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64}
75+
function update_clims(series::Series, op = Commons.ignorenan_extrema)::Tuple{Float64, Float64}
7576
zmin, zmax = Inf, -Inf
7677

7778
# keeping this unrolled has higher performance
@@ -127,10 +128,10 @@ hascolorbar(sp::Subplot) =
127128

128129
function get_colorbar_ticks(sp::Subplot; update = true, formatter = sp[:colorbar_formatter])
129130
if update || !haskey(sp.attr, :colorbar_optimized_ticks)
130-
ticks = _transform_ticks(sp[:colorbar_ticks], sp[:colorbar_title])
131+
ticks = Ticks._transform_ticks(sp[:colorbar_ticks], sp[:colorbar_title])
131132
cvals = sp[:colorbar_continuous_values]
132133
dvals = sp[:colorbar_discrete_values]
133-
clims = get_clims(sp)
134+
clims = Commons.get_clims(sp)
134135
scale = sp[:colorbar_scale]
135136
sp.attr[:colorbar_optimized_ticks] =
136137
Commons.get_ticks(ticks, cvals, dvals, clims, scale, formatter)

PlotsBase/src/Plots.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function _update_subplot_attrs(
245245
# grab those args which apply to this subplot
246246
for k in keys(Commons._subplot_defaults)
247247
# We don't apply annotations to the plot-title sub-plot
248-
if k == :annotations && get(plt.attr, :plot_titleindex, 0) == subplot_index
248+
if k :annotations && get(plt.attr, :plot_titleindex, 0) == subplot_index
249249
continue
250250
end
251251
PlotsBase.slice_arg!(plotattributes_in, sp.attr, k, subplot_index, remove_pair)

PlotsBase/src/animation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function _animate(forloop::Expr, args...; type::Symbol = :none)
223223
error("Can only specify one filterexpression (one of 'when' or 'every')")
224224

225225
filterexpr = # when every
226-
arg == :when ? args[i + 1] : :(mod1($countersym, $(args[i + 1])) == 1)
226+
arg :when ? args[i + 1] : :(mod1($countersym, $(args[i + 1])) == 1)
227227

228228
i += 1
229229
elseif arg isa Expr && arg.head == Symbol("=")

PlotsBase/test/test_args.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ end
121121
ts = range(DateTime(today()), step = Hour(1), length = 24)
122122
p1 = plot(ts, 100randn(24))
123123
vline!(p1, [now()])
124-
@test p1[1][:yaxis][:formatter] == :auto
124+
@test p1[1][:yaxis][:formatter] :auto
125125
@test p1[1][:xaxis][:formatter] == PlotsBase.datetimeformatter
126126
p2 = plot(rand(4) .* 10^6, rand(4) .* 10^6, xformatter = :plain, yformatter = :plain)
127127
vline!(p2, [10^6])
128-
@test p2[1][:yaxis][:formatter] == :plain
129-
@test p2[1][:xaxis][:formatter] == :plain
128+
@test p2[1][:yaxis][:formatter] :plain
129+
@test p2[1][:xaxis][:formatter] :plain
130130
p3 = plot(rand(4) .* 10^6, rand(4) .* 10^6, yformatter = :plain)
131131
vline!(p3, [10^6], xformatter = :plain)
132-
@test p3[1][:yaxis][:formatter] == :plain
133-
@test p3[1][:xaxis][:formatter] == :plain
132+
@test p3[1][:yaxis][:formatter] :plain
133+
@test p3[1][:xaxis][:formatter] :plain
134134
end

PlotsBase/test/test_recipes.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ with(:gr) do
117117
plot!(p, x, y; linestyle = :dash)
118118
yerror!(p, x, y; yerror, linestyle = :dot)
119119
@test length(p.series_list) == 3
120-
@test p[1][1][:linestyle] == :solid
121-
@test p[1][2][:linestyle] == :dash
122-
@test p[1][3][:linestyle] == :dot
120+
@test p[1][1][:linestyle] :solid
121+
@test p[1][2][:linestyle] :dash
122+
@test p[1][3][:linestyle] :dot
123123
end
124124

125125
@testset "parametric" begin

PlotsBase/test/test_unitful.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ end
200200
@testset "More plots" begin
201201
@testset "data as $dtype" for dtype in
202202
[:Vectors, :Matrices, Symbol("Vectors of vectors")]
203-
if dtype == :Vectors
203+
if dtype :Vectors
204204
x, y, z = randn(10), randn(10), randn(10)
205-
elseif dtype == :Matrices
205+
elseif dtype :Matrices
206206
x, y, z = randn(10, 2), randn(10, 2), randn(10, 2)
207207
else
208208
x, y, z = [rand(10), rand(20)], [rand(10), rand(20)], [rand(10), rand(20)]

0 commit comments

Comments
 (0)