Format .jl files [skip ci] (#3829)
Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
parent
0cd81243ad
commit
5a48002d31
21
src/args.jl
21
src/args.jl
@ -848,7 +848,14 @@ add_axes_aliases(:ticks, :tick)
|
||||
add_axes_aliases(:rotation, :rot, :r)
|
||||
add_axes_aliases(:guidefontsize, :labelfontsize)
|
||||
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(
|
||||
:foreground_color_grid,
|
||||
:fg_grid,
|
||||
@ -873,7 +880,14 @@ add_axes_aliases(
|
||||
:fg_colour_minor_grid,
|
||||
: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(
|
||||
:minorgridstyle,
|
||||
:minorgrid_style,
|
||||
@ -1570,7 +1584,8 @@ function warn_on_unsupported_args(pkg::AbstractBackend, plotattributes)
|
||||
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))
|
||||
push!(already_warned, k)
|
||||
@warn(
|
||||
|
||||
@ -29,12 +29,12 @@ if PyPlot.version < v"3.4"
|
||||
@warn("""You are using Matplotlib $(PyPlot.version), which is no longer
|
||||
officialy supported by the Plots community. To ensure smooth Plots.jl
|
||||
integration update your Matplotlib library to a version >= 3.4.0
|
||||
|
||||
|
||||
If you have used Conda.jl to install PyPlot (default installation),
|
||||
upgrade your matplotlib via Conda.jl and rebuild the PyPlot.
|
||||
|
||||
If you are not sure, here are the default instructions:
|
||||
|
||||
|
||||
In Julia REPL:
|
||||
```
|
||||
import Pkg;
|
||||
@ -1271,7 +1271,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
end
|
||||
|
||||
py_set_ticks(sp, ax, ticks, letter)
|
||||
|
||||
|
||||
if axis[:ticks] == :native # It is easier to reset than to account for this
|
||||
py_set_lims(ax, sp, axis)
|
||||
pyaxis.set_major_locator(pyticker.AutoLocator())
|
||||
|
||||
@ -60,9 +60,13 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||
for ann in sp[:annotations]
|
||||
x, y, val = locate_annotation(sp, ann...)
|
||||
o = UnicodePlots.annotate!(
|
||||
o, x, y, val.str;
|
||||
o,
|
||||
x,
|
||||
y,
|
||||
val.str;
|
||||
color = up_color(val.font.color),
|
||||
halign = val.font.halign, valign = val.font.valign
|
||||
halign = val.font.halign,
|
||||
valign = val.font.valign,
|
||||
)
|
||||
end
|
||||
|
||||
@ -79,7 +83,9 @@ up_color(col) = :auto
|
||||
function addUnicodeSeries!(
|
||||
sp::Subplot{UnicodePlotsBackend},
|
||||
up::UnicodePlots.Plot,
|
||||
kw, series, addlegend::Bool,
|
||||
kw,
|
||||
series,
|
||||
addlegend::Bool,
|
||||
)
|
||||
st = series[:seriestype]
|
||||
|
||||
@ -101,7 +107,9 @@ function addUnicodeSeries!(
|
||||
cmap = [(red(c), green(c), blue(c)) for c in get(get_colorgradient(series), rng)]
|
||||
return UnicodePlots.heatmap(
|
||||
series[:z].surf;
|
||||
zlabel = sp[:colorbar_title], colormap = cmap, kw...
|
||||
zlabel = sp[:colorbar_title],
|
||||
colormap = cmap,
|
||||
kw...,
|
||||
)
|
||||
elseif st == :spy
|
||||
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)
|
||||
up = UnicodePlots.annotate!(
|
||||
up, xi, yi, str;
|
||||
color = up_color(fnt.color), halign = fnt.halign, valign = fnt.valign
|
||||
up,
|
||||
xi,
|
||||
yi,
|
||||
str;
|
||||
color = up_color(fnt.color),
|
||||
halign = fnt.halign,
|
||||
valign = fnt.valign,
|
||||
)
|
||||
end
|
||||
|
||||
@ -159,7 +172,7 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
||||
|
||||
error(
|
||||
"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
|
||||
|
||||
@ -201,7 +214,7 @@ function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
||||
end
|
||||
l_max[r] = lmax
|
||||
end
|
||||
empty = String[' '^w for w ∈ w_max]
|
||||
empty = String[' '^w for w in w_max]
|
||||
for r in 1:nr
|
||||
for n in 1:l_max[r]
|
||||
for c in 1:nc
|
||||
|
||||
@ -7,10 +7,9 @@ ismultiversion = false
|
||||
@static if !should_precompile
|
||||
# nothing
|
||||
elseif !ismultios && !ismultiversion
|
||||
@static if isfile(joinpath(
|
||||
@__DIR__,
|
||||
"../deps/SnoopCompile/precompile/precompile_Plots.jl",
|
||||
))
|
||||
@static if isfile(
|
||||
joinpath(@__DIR__, "../deps/SnoopCompile/precompile/precompile_Plots.jl"),
|
||||
)
|
||||
include("../deps/SnoopCompile/precompile/precompile_Plots.jl")
|
||||
_precompile_()
|
||||
end
|
||||
|
||||
@ -205,13 +205,14 @@ maketuple(x::Tuple{T,S}) where {T,S} = x
|
||||
for i in 2:4
|
||||
@eval begin
|
||||
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)...))
|
||||
end
|
||||
end
|
||||
|
||||
RecipesPipeline.unzip(::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{N}},AVec{<:NTuple{N,T} where {T}}},
|
||||
) where {N} = error("$N-dimensional unzip not implemented.")
|
||||
|
||||
RecipesPipeline.unzip(::Union{AVec{<:GeometryBasics.Point},AVec{<:Tuple}}) =
|
||||
error("Can't unzip points of different dimensions.")
|
||||
|
||||
@ -155,7 +155,8 @@ end
|
||||
end
|
||||
|
||||
@testset "EmptyAnim" begin
|
||||
anim = @animate for i in [] end
|
||||
anim = @animate for i in []
|
||||
end
|
||||
|
||||
@test_throws ArgumentError gif(anim)
|
||||
end
|
||||
@ -200,7 +201,6 @@ end
|
||||
Plots.process_clims(:auto)
|
||||
end
|
||||
|
||||
|
||||
@testset "Backends" begin
|
||||
@testset "UnicodePlots" begin
|
||||
@test unicodeplots() == Plots.UnicodePlotsBackend()
|
||||
|
||||
@ -73,18 +73,18 @@ end
|
||||
@test p[1][:xaxis][:ticks] == [1.25, 1.5, 1.75]
|
||||
p = plot(1:2, xlabelfontsize = 4)
|
||||
@test p[1][:xaxis][:guidefontsize] == 4
|
||||
p = plot(1:2, xgα = .07)
|
||||
@test p[1][:xaxis][:gridalpha] ≈ .07
|
||||
p = plot(1:2, xgα = 0.07)
|
||||
@test p[1][:xaxis][:gridalpha] ≈ 0.07
|
||||
p = plot(1:2, xgridls = :dashdot)
|
||||
@test p[1][:xaxis][:gridstyle] === :dashdot
|
||||
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)
|
||||
@test p[1][:xaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.,0.,0.,1.)
|
||||
p = plot(1:2, xgrid_lw = .01)
|
||||
@test p[1][:xaxis][:gridlinewidth] ≈ .01
|
||||
p = plot(1:2, xminorgrid_lw = .01)
|
||||
@test p[1][:xaxis][:minorgridlinewidth] ≈ .01
|
||||
@test p[1][:xaxis][:foreground_color_minor_grid] === RGBA{Float64}(1.0, 0.0, 0.0, 1.0)
|
||||
p = plot(1:2, xgrid_lw = 0.01)
|
||||
@test p[1][:xaxis][:gridlinewidth] ≈ 0.01
|
||||
p = plot(1:2, xminorgrid_lw = 0.01)
|
||||
@test p[1][:xaxis][:minorgridlinewidth] ≈ 0.01
|
||||
p = plot(1:2, xtickor = :out)
|
||||
@test p[1][:xaxis][:tick_direction] === :out
|
||||
end
|
||||
@ -97,24 +97,23 @@ end
|
||||
p = plot(1:2, label = "test")
|
||||
@test compare(p, :guide, "", ===)
|
||||
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])
|
||||
@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)
|
||||
@test compare(p,:guidefontsize,4, ==)
|
||||
p = plot(1:2, gα = .07)
|
||||
@test compare(p,:gridalpha,.07, ≈)
|
||||
@test compare(p, :guidefontsize, 4, ==)
|
||||
p = plot(1:2, gα = 0.07)
|
||||
@test compare(p, :gridalpha, 0.07, ≈)
|
||||
p = plot(1:2, gridls = :dashdot)
|
||||
@test compare(p,:gridstyle,:dashdot, ===)
|
||||
@test compare(p, :gridstyle, :dashdot, ===)
|
||||
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)
|
||||
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), ===)
|
||||
p = plot(1:2, grid_lw = .01)
|
||||
@test compare(p,:gridlinewidth,.01, ≈)
|
||||
p = plot(1:2, minorgrid_lw = .01)
|
||||
@test compare(p,:minorgridlinewidth,.01, ≈)
|
||||
@test compare(p, :foreground_color_minor_grid, RGBA{Float64}(1.0, 0.0, 0.0, 1.0), ===)
|
||||
p = plot(1:2, grid_lw = 0.01)
|
||||
@test compare(p, :gridlinewidth, 0.01, ≈)
|
||||
p = plot(1:2, minorgrid_lw = 0.01)
|
||||
@test compare(p, :minorgridlinewidth, 0.01, ≈)
|
||||
p = plot(1:2, tickor = :out)
|
||||
@test compare(p,:tick_direction,:out, ===)
|
||||
|
||||
@test compare(p, :tick_direction, :out, ===)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user