Skip to content

Commit

Permalink
Format .jl files [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jheinen authored Sep 5, 2021
1 parent b28a261 commit 6061b6a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
26 changes: 20 additions & 6 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ const _all_series_args = sort(union([_series_args; _magic_series_args]))
const _all_plot_args = _plot_args

for letter in (:x, :y, :z)
_attrsymbolcache[letter] = Dict{Symbol, Symbol}()
_attrsymbolcache[letter] = Dict{Symbol,Symbol}()
for k in keys(_axis_defaults)
# populate attribute cache
lk = Symbol(letter, k)
Expand Down Expand Up @@ -1237,8 +1237,10 @@ function processGridArg!(plotattributes::AKW, arg, letter)
plotattributes[get_attr_symbol(letter, :foreground_color_grid)] =
arg.color in (:auto, :match) ? :match : plot_color(arg.color)
)
arg.alpha === nothing || (plotattributes[get_attr_symbol(letter, :gridalpha)] = arg.alpha)
arg.style === nothing || (plotattributes[get_attr_symbol(letter, :gridstyle)] = arg.style)
arg.alpha === nothing ||
(plotattributes[get_attr_symbol(letter, :gridalpha)] = arg.alpha)
arg.style === nothing ||
(plotattributes[get_attr_symbol(letter, :gridstyle)] = arg.style)

# linealpha
elseif allAlphas(arg)
Expand All @@ -1249,7 +1251,11 @@ function processGridArg!(plotattributes::AKW, arg, letter)
plotattributes[get_attr_symbol(letter, :gridlinewidth)] = arg

# color
elseif !handleColors!(plotattributes, arg, get_attr_symbol(letter, :foreground_color_grid))
elseif !handleColors!(
plotattributes,
arg,
get_attr_symbol(letter, :foreground_color_grid),
)
@warn("Skipped grid arg $arg.")
end
end
Expand Down Expand Up @@ -1286,7 +1292,11 @@ function processMinorGridArg!(plotattributes::AKW, arg, letter)
plotattributes[get_attr_symbol(letter, :minorgrid)] = true

# color
elseif handleColors!(plotattributes, arg, get_attr_symbol(letter, :foreground_color_minor_grid))
elseif handleColors!(
plotattributes,
arg,
get_attr_symbol(letter, :foreground_color_minor_grid),
)
plotattributes[get_attr_symbol(letter, :minorgrid)] = true
else
@warn("Skipped grid arg $arg.")
Expand Down Expand Up @@ -1413,7 +1423,11 @@ function RecipesPipeline.preprocess_attributes!(plotattributes::AKW)
# handle individual axes font args
for letter in (:x, :y, :z)
for fontname in (:tickfont, :guidefont)
args = RecipesPipeline.pop_kw!(plotattributes, get_attr_symbol(letter, fontname), ())
args = RecipesPipeline.pop_kw!(
plotattributes,
get_attr_symbol(letter, fontname),
(),
)
for arg in wraptuple(args)
processFontArg!(plotattributes, get_attr_symbol(letter, fontname), arg)
end
Expand Down
9 changes: 7 additions & 2 deletions src/axes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ function process_axis_arg!(plotattributes::AKW, arg, letter = "")
elseif typeof(arg) <: Function
plotattributes[get_attr_symbol(letter, :formatter)] = arg

elseif !handleColors!(plotattributes, arg, get_attr_symbol(letter, :foreground_color_axis))
elseif !handleColors!(
plotattributes,
arg,
get_attr_symbol(letter, :foreground_color_axis),
)
@warn("Skipped $(letter)axis arg $arg")
end
end
Expand Down Expand Up @@ -463,7 +467,8 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
# TODO: need more here... gotta track the discrete reference value
# as well as any coord offset (think of boxplot shape coords... they all
# correspond to the same x-value)
plotattributes[letter], plotattributes[get_attr_symbol(letter, :(_discrete_indices))] =
plotattributes[letter],
plotattributes[get_attr_symbol(letter, :(_discrete_indices))] =
discrete_value!(axis, data)
expand_extrema!(axis, plotattributes[letter])
end
Expand Down
2 changes: 1 addition & 1 deletion src/backends/pyplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ end

for k in (:linthresh, :base, :label)
# add PyPlot specific symbols to cache
_attrsymbolcache[k] = Dict{Symbol, Symbol}()
_attrsymbolcache[k] = Dict{Symbol,Symbol}()
for letter in (:x, :y, :z, Symbol(""), :top, :bottom, :left, :right)
_attrsymbolcache[k][letter] = Symbol(k, letter)
end
Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ function mesh3d_triangles(x, y, z, cns)
end

# cache joined symbols so they can be looked up instead of constructed each time
const _attrsymbolcache = Dict{Symbol, Dict{Symbol, Symbol}}()
const _attrsymbolcache = Dict{Symbol,Dict{Symbol,Symbol}}()

get_attr_symbol(letter::Symbol, keyword::String) = get_attr_symbol(letter, Symbol(keyword))
get_attr_symbol(letter::Symbol, keyword::Symbol) = _attrsymbolcache[letter][keyword]

0 comments on commit 6061b6a

Please sign in to comment.