Format .jl files [skip ci] (#3829)

Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2021-09-20 16:10:29 +02:00 committed by GitHub
parent 0cd81243ad
commit 5a48002d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 45 deletions

View File

@ -848,7 +848,14 @@ add_axes_aliases(:ticks, :tick)
add_axes_aliases(:rotation, :rot, :r) add_axes_aliases(:rotation, :rot, :r)
add_axes_aliases(:guidefontsize, :labelfontsize) add_axes_aliases(:guidefontsize, :labelfontsize)
add_axes_aliases(:gridalpha, :ga, :galpha, :gα, :gridopacity, :gopacity) add_axes_aliases(:gridalpha, :ga, :galpha, :gα, :gridopacity, :gopacity)
add_axes_aliases(:gridstyle, :grid_style, :gridlinestyle, :grid_linestyle, :grid_ls, :gridls) add_axes_aliases(
:gridstyle,
:grid_style,
:gridlinestyle,
:grid_linestyle,
:grid_ls,
:gridls,
)
add_axes_aliases( add_axes_aliases(
:foreground_color_grid, :foreground_color_grid,
:fg_grid, :fg_grid,
@ -873,7 +880,14 @@ add_axes_aliases(
:fg_colour_minor_grid, :fg_colour_minor_grid,
:minorgridcolor, :minorgridcolor,
) )
add_axes_aliases(:gridlinewidth, :gridwidth, :grid_linewidth, :grid_width, :gridlw, :grid_lw) add_axes_aliases(
:gridlinewidth,
:gridwidth,
:grid_linewidth,
:grid_width,
:gridlw,
:grid_lw,
)
add_axes_aliases( add_axes_aliases(
:minorgridstyle, :minorgridstyle,
:minorgrid_style, :minorgrid_style,
@ -1570,7 +1584,8 @@ function warn_on_unsupported_args(pkg::AbstractBackend, plotattributes)
end end
end end
if !isempty(_to_warn) && get(plotattributes, :warn_on_unsupported, _plot_defaults[:warn_on_unsupported]) if !isempty(_to_warn) &&
get(plotattributes, :warn_on_unsupported, _plot_defaults[:warn_on_unsupported])
for k in sort(collect(_to_warn)) for k in sort(collect(_to_warn))
push!(already_warned, k) push!(already_warned, k)
@warn( @warn(

View File

@ -29,12 +29,12 @@ if PyPlot.version < v"3.4"
@warn("""You are using Matplotlib $(PyPlot.version), which is no longer @warn("""You are using Matplotlib $(PyPlot.version), which is no longer
officialy supported by the Plots community. To ensure smooth Plots.jl officialy supported by the Plots community. To ensure smooth Plots.jl
integration update your Matplotlib library to a version >= 3.4.0 integration update your Matplotlib library to a version >= 3.4.0
If you have used Conda.jl to install PyPlot (default installation), If you have used Conda.jl to install PyPlot (default installation),
upgrade your matplotlib via Conda.jl and rebuild the PyPlot. upgrade your matplotlib via Conda.jl and rebuild the PyPlot.
If you are not sure, here are the default instructions: If you are not sure, here are the default instructions:
In Julia REPL: In Julia REPL:
``` ```
import Pkg; import Pkg;
@ -1271,7 +1271,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
end end
py_set_ticks(sp, ax, ticks, letter) py_set_ticks(sp, ax, ticks, letter)
if axis[:ticks] == :native # It is easier to reset than to account for this if axis[:ticks] == :native # It is easier to reset than to account for this
py_set_lims(ax, sp, axis) py_set_lims(ax, sp, axis)
pyaxis.set_major_locator(pyticker.AutoLocator()) pyaxis.set_major_locator(pyticker.AutoLocator())

View File

@ -60,9 +60,13 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
for ann in sp[:annotations] for ann in sp[:annotations]
x, y, val = locate_annotation(sp, ann...) x, y, val = locate_annotation(sp, ann...)
o = UnicodePlots.annotate!( o = UnicodePlots.annotate!(
o, x, y, val.str; o,
x,
y,
val.str;
color = up_color(val.font.color), color = up_color(val.font.color),
halign = val.font.halign, valign = val.font.valign halign = val.font.halign,
valign = val.font.valign,
) )
end end
@ -79,7 +83,9 @@ up_color(col) = :auto
function addUnicodeSeries!( function addUnicodeSeries!(
sp::Subplot{UnicodePlotsBackend}, sp::Subplot{UnicodePlotsBackend},
up::UnicodePlots.Plot, up::UnicodePlots.Plot,
kw, series, addlegend::Bool, kw,
series,
addlegend::Bool,
) )
st = series[:seriestype] st = series[:seriestype]
@ -101,7 +107,9 @@ function addUnicodeSeries!(
cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)] cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)]
return UnicodePlots.heatmap( return UnicodePlots.heatmap(
series[:z].surf; series[:z].surf;
zlabel = sp[:colorbar_title], colormap = cmap, kw... zlabel = sp[:colorbar_title],
colormap = cmap,
kw...,
) )
elseif st == :spy elseif st == :spy
return UnicodePlots.spy(series[:z].surf; kw...) return UnicodePlots.spy(series[:z].surf; kw...)
@ -126,8 +134,13 @@ function addUnicodeSeries!(
for (xi, yi, str, fnt) in EachAnn(series[:series_annotations], x, y) for (xi, yi, str, fnt) in EachAnn(series[:series_annotations], x, y)
up = UnicodePlots.annotate!( up = UnicodePlots.annotate!(
up, xi, yi, str; up,
color = up_color(fnt.color), halign = fnt.halign, valign = fnt.valign xi,
yi,
str;
color = up_color(fnt.color),
halign = fnt.halign,
valign = fnt.valign,
) )
end end
@ -159,7 +172,7 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
error( error(
"Can only savepng on MacOS or Linux with UnicodePlots " * "Can only savepng on MacOS or Linux with UnicodePlots " *
"(though even then I wouldn't do it)" "(though even then I wouldn't do it)",
) )
end end
@ -201,7 +214,7 @@ function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
end end
l_max[r] = lmax l_max[r] = lmax
end end
empty = String[' '^w for w w_max] empty = String[' '^w for w in w_max]
for r in 1:nr for r in 1:nr
for n in 1:l_max[r] for n in 1:l_max[r]
for c in 1:nc for c in 1:nc

View File

@ -7,10 +7,9 @@ ismultiversion = false
@static if !should_precompile @static if !should_precompile
# nothing # nothing
elseif !ismultios && !ismultiversion elseif !ismultios && !ismultiversion
@static if isfile(joinpath( @static if isfile(
@__DIR__, joinpath(@__DIR__, "../deps/SnoopCompile/precompile/precompile_Plots.jl"),
"../deps/SnoopCompile/precompile/precompile_Plots.jl", )
))
include("../deps/SnoopCompile/precompile/precompile_Plots.jl") include("../deps/SnoopCompile/precompile/precompile_Plots.jl")
_precompile_() _precompile_()
end end

View File

@ -205,13 +205,14 @@ maketuple(x::Tuple{T,S}) where {T,S} = x
for i in 2:4 for i in 2:4
@eval begin @eval begin
RecipesPipeline.unzip( RecipesPipeline.unzip(
v::Union{AVec{<:NTuple{$i,T} where T},AVec{<:GeometryBasics.Point{$i}}}, v::Union{AVec{<:NTuple{$i,T} where {T}},AVec{<:GeometryBasics.Point{$i}}},
) = $(Expr(:tuple, (:([t[$j] for t in v]) for j in 1:i)...)) ) = $(Expr(:tuple, (:([t[$j] for t in v]) for j in 1:i)...))
end end
end end
RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point{N}},AVec{<:NTuple{N,T} where T}}) where {N} = RecipesPipeline.unzip(
error("$N-dimensional unzip not implemented.") ::Union{AVec{<:GeometryBasics.Point{N}},AVec{<:NTuple{N,T} where {T}}},
) where {N} = error("$N-dimensional unzip not implemented.")
RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point},AVec{<:Tuple}}) = RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point},AVec{<:Tuple}}) =
error("Can't unzip points of different dimensions.") error("Can't unzip points of different dimensions.")

View File

@ -155,7 +155,8 @@ end
end end
@testset "EmptyAnim" begin @testset "EmptyAnim" begin
anim = @animate for i in [] end anim = @animate for i in []
end
@test_throws ArgumentError gif(anim) @test_throws ArgumentError gif(anim)
end end
@ -200,7 +201,6 @@ end
Plots.process_clims(:auto) Plots.process_clims(:auto)
end end
@testset "Backends" begin @testset "Backends" begin
@testset "UnicodePlots" begin @testset "UnicodePlots" begin
@test unicodeplots() == Plots.UnicodePlotsBackend() @test unicodeplots() == Plots.UnicodePlotsBackend()

View File

@ -73,18 +73,18 @@ end
@test p[1][:xaxis][:ticks] == [1.25, 1.5, 1.75] @test p[1][:xaxis][:ticks] == [1.25, 1.5, 1.75]
p = plot(1:2, xlabelfontsize = 4) p = plot(1:2, xlabelfontsize = 4)
@test p[1][:xaxis][:guidefontsize] == 4 @test p[1][:xaxis][:guidefontsize] == 4
p = plot(1:2, xgα = .07) p = plot(1:2, xgα = 0.07)
@test p[1][:xaxis][:gridalpha] .07 @test p[1][:xaxis][:gridalpha] 0.07
p = plot(1:2, xgridls = :dashdot) p = plot(1:2, xgridls = :dashdot)
@test p[1][:xaxis][:gridstyle] === :dashdot @test p[1][:xaxis][:gridstyle] === :dashdot
p = plot(1:2, xgridcolor = :red) p = plot(1:2, xgridcolor = :red)
@test p[1][:xaxis][:foreground_color_grid] === RGBA{Float64}(1.,0.,0.,1.) @test p[1][:xaxis][:foreground_color_grid] === RGBA{Float64}(1.0, 0.0, 0.0, 1.0)
p = plot(1:2, xminorgridcolor = :red) p = plot(1:2, xminorgridcolor = :red)
@test p[1][:xaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.,0.,0.,1.) @test p[1][:xaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.0, 0.0, 0.0, 1.0)
p = plot(1:2, xgrid_lw = .01) p = plot(1:2, xgrid_lw = 0.01)
@test p[1][:xaxis][:gridlinewidth] .01 @test p[1][:xaxis][:gridlinewidth] 0.01
p = plot(1:2, xminorgrid_lw = .01) p = plot(1:2, xminorgrid_lw = 0.01)
@test p[1][:xaxis][:minorgridlinewidth] .01 @test p[1][:xaxis][:minorgridlinewidth] 0.01
p = plot(1:2, xtickor = :out) p = plot(1:2, xtickor = :out)
@test p[1][:xaxis][:tick_direction] === :out @test p[1][:xaxis][:tick_direction] === :out
end end
@ -97,24 +97,23 @@ end
p = plot(1:2, label = "test") p = plot(1:2, label = "test")
@test compare(p, :guide, "", ===) @test compare(p, :guide, "", ===)
p = plot(1:2, lim = (0, 3)) p = plot(1:2, lim = (0, 3))
@test xlims(p) === ylims(p) === zlims(p) === (0,3) @test xlims(p) === ylims(p) === zlims(p) === (0, 3)
p = plot(1:2, tick = [1.25, 1.5, 1.75]) p = plot(1:2, tick = [1.25, 1.5, 1.75])
@test compare(p,:ticks,[1.25, 1.5, 1.75], ==) @test compare(p, :ticks, [1.25, 1.5, 1.75], ==)
p = plot(1:2, labelfontsize = 4) p = plot(1:2, labelfontsize = 4)
@test compare(p,:guidefontsize,4, ==) @test compare(p, :guidefontsize, 4, ==)
p = plot(1:2, gα = .07) p = plot(1:2, gα = 0.07)
@test compare(p,:gridalpha,.07, ) @test compare(p, :gridalpha, 0.07, )
p = plot(1:2, gridls = :dashdot) p = plot(1:2, gridls = :dashdot)
@test compare(p,:gridstyle,:dashdot, ===) @test compare(p, :gridstyle, :dashdot, ===)
p = plot(1:2, gridcolor = :red) p = plot(1:2, gridcolor = :red)
@test compare(p,:foreground_color_grid,RGBA{Float64}(1.,0.,0.,1.), ===) @test compare(p, :foreground_color_grid, RGBA{Float64}(1.0, 0.0, 0.0, 1.0), ===)
p = plot(1:2, minorgridcolor = :red) p = plot(1:2, minorgridcolor = :red)
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), ===) @test compare(p, :foreground_color_minor_grid, RGBA{Float64}(1.0, 0.0, 0.0, 1.0), ===)
p = plot(1:2, grid_lw = .01) p = plot(1:2, grid_lw = 0.01)
@test compare(p,:gridlinewidth,.01, ) @test compare(p, :gridlinewidth, 0.01, )
p = plot(1:2, minorgrid_lw = .01) p = plot(1:2, minorgrid_lw = 0.01)
@test compare(p,:minorgridlinewidth,.01, ) @test compare(p, :minorgridlinewidth, 0.01, )
p = plot(1:2, tickor = :out) p = plot(1:2, tickor = :out)
@test compare(p,:tick_direction,:out, ===) @test compare(p, :tick_direction, :out, ===)
end end