Format .jl files [skip ci] (#3780)
Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
parent
09d35d7b9f
commit
8b6073c088
@ -229,7 +229,7 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
|
|||||||
if gsp.dims == 2 && z === nothing
|
if gsp.dims == 2 && z === nothing
|
||||||
for (n, seg) in enumerate(series_segments(series, st; check = true))
|
for (n, seg) in enumerate(series_segments(series, st; check = true))
|
||||||
i, rng = seg.attr_index, seg.range
|
i, rng = seg.attr_index, seg.range
|
||||||
fr =_cycle(series[:fillrange], 1:length(x[rng]))
|
fr = _cycle(series[:fillrange], 1:length(x[rng]))
|
||||||
for sc in gaston_seriesconf!(sp, series, i, n == 1)
|
for sc in gaston_seriesconf!(sp, series, i, n == 1)
|
||||||
push!(curves, Gaston.Curve(x[rng], y[rng], nothing, fr, sc))
|
push!(curves, Gaston.Curve(x[rng], y[rng], nothing, fr, sc))
|
||||||
end
|
end
|
||||||
@ -308,7 +308,10 @@ function gaston_seriesconf!(
|
|||||||
fc = gaston_color(get_fillcolor(series, i), get_fillalpha(series, i))
|
fc = gaston_color(get_fillcolor(series, i), get_fillalpha(series, i))
|
||||||
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
|
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
|
||||||
if fr !== nothing # filled curves, but not filled curves with markers
|
if fr !== nothing # filled curves, but not filled curves with markers
|
||||||
push!(curveconf, "w filledcurves fc $fc fs solid border lc $lc lw $lw dt $dt,'' w lines lc $lc lw $lw dt $dt")
|
push!(
|
||||||
|
curveconf,
|
||||||
|
"w filledcurves fc $fc fs solid border lc $lc lw $lw dt $dt,'' w lines lc $lc lw $lw dt $dt",
|
||||||
|
)
|
||||||
elseif series[:markershape] == :none # simplepath
|
elseif series[:markershape] == :none # simplepath
|
||||||
push!(curveconf, "w lines lc $lc dt $dt lw $lw")
|
push!(curveconf, "w lines lc $lc dt $dt lw $lw")
|
||||||
else
|
else
|
||||||
|
|||||||
@ -139,18 +139,7 @@ gr_set_arrowstyle(s::Symbol) = GR.setarrowstyle(
|
|||||||
gr_set_fillstyle(::Nothing) = GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
gr_set_fillstyle(::Nothing) = GR.setfillintstyle(GR.INTSTYLE_SOLID)
|
||||||
function gr_set_fillstyle(s::Symbol)
|
function gr_set_fillstyle(s::Symbol)
|
||||||
GR.setfillintstyle(GR.INTSTYLE_HATCH)
|
GR.setfillintstyle(GR.INTSTYLE_HATCH)
|
||||||
GR.setfillstyle(get(
|
GR.setfillstyle(get(((/) = 9, (\) = 10, (|) = 7, (-) = 8, (+) = 11, (x) = 6), s, 9))
|
||||||
(
|
|
||||||
(/) = 9,
|
|
||||||
(\) = 10,
|
|
||||||
(|) = 7,
|
|
||||||
(-) = 8,
|
|
||||||
(+) = 11,
|
|
||||||
(x) = 6,
|
|
||||||
),
|
|
||||||
s,
|
|
||||||
9),
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1238,7 +1238,11 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
|||||||
opt,
|
opt,
|
||||||
string(letter, "label style") => PGFPlotsX.Options(
|
string(letter, "label style") => PGFPlotsX.Options(
|
||||||
labelpos => nothing,
|
labelpos => nothing,
|
||||||
"at" => string("{(ticklabel cs:", get((left = 0, right = 1), axis[:guidefonthalign], 0.5),")}"),
|
"at" => string(
|
||||||
|
"{(ticklabel cs:",
|
||||||
|
get((left = 0, right = 1), axis[:guidefonthalign], 0.5),
|
||||||
|
")}",
|
||||||
|
),
|
||||||
"anchor" => "near ticklabel",
|
"anchor" => "near ticklabel",
|
||||||
"font" => pgfx_font(axis[:guidefontsize], pgfx_thickness_scaling(sp)),
|
"font" => pgfx_font(axis[:guidefontsize], pgfx_thickness_scaling(sp)),
|
||||||
"color" => cstr,
|
"color" => cstr,
|
||||||
@ -1300,10 +1304,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
|||||||
string("{\$", join(tick_labels, "\$,\$"), "\$}"),
|
string("{\$", join(tick_labels, "\$,\$"), "\$}"),
|
||||||
)
|
)
|
||||||
elseif tick_labels isa Vector{LaTeXString}
|
elseif tick_labels isa Vector{LaTeXString}
|
||||||
push!(
|
push!(opt, string(letter, "ticklabels") => join(tick_labels))
|
||||||
opt,
|
|
||||||
string(letter, "ticklabels") => join(tick_labels)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
elseif axis[:showaxis]
|
elseif axis[:showaxis]
|
||||||
tick_labels =
|
tick_labels =
|
||||||
|
|||||||
@ -795,7 +795,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
|
|||||||
edgecolor = py_color(fc, has_fs ? fa : la),
|
edgecolor = py_color(fc, has_fs ? fa : la),
|
||||||
facecolor = py_color(fc, has_fs ? 0 : fa),
|
facecolor = py_color(fc, has_fs ? 0 : fa),
|
||||||
hatch = py_fillstyle(fs),
|
hatch = py_fillstyle(fs),
|
||||||
linewidths = 0
|
linewidths = 0,
|
||||||
)
|
)
|
||||||
push!(handles, handle)
|
push!(handles, handle)
|
||||||
end
|
end
|
||||||
@ -1499,7 +1499,10 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
|
|||||||
line_handle = pypatches."Patch"(
|
line_handle = pypatches."Patch"(
|
||||||
edgecolor = py_color(single_color(lc), la),
|
edgecolor = py_color(single_color(lc), la),
|
||||||
facecolor = py_color(single_color(fc), has_fs ? 0 : fa),
|
facecolor = py_color(single_color(fc), has_fs ? 0 : fa),
|
||||||
linewidth = py_thickness_scale(plt, clamp(get_linewidth(series), 0, 5)),
|
linewidth = py_thickness_scale(
|
||||||
|
plt,
|
||||||
|
clamp(get_linewidth(series), 0, 5),
|
||||||
|
),
|
||||||
linestyle = py_linestyle(series[:seriestype], ls),
|
linestyle = py_linestyle(series[:seriestype], ls),
|
||||||
capstyle = "butt",
|
capstyle = "butt",
|
||||||
)
|
)
|
||||||
|
|||||||
@ -68,7 +68,14 @@ function rebuildUnicodePlot!(plt::Plot, width, height)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# add a single series
|
# add a single series
|
||||||
function addUnicodeSeries!(sp::Subplot{UnicodePlotsBackend}, o, series, addlegend::Bool, xlim, ylim)
|
function addUnicodeSeries!(
|
||||||
|
sp::Subplot{UnicodePlotsBackend},
|
||||||
|
o,
|
||||||
|
series,
|
||||||
|
addlegend::Bool,
|
||||||
|
xlim,
|
||||||
|
ylim,
|
||||||
|
)
|
||||||
attrs = series.plotattributes
|
attrs = series.plotattributes
|
||||||
st = attrs[:seriestype]
|
st = attrs[:seriestype]
|
||||||
|
|
||||||
@ -76,10 +83,13 @@ function addUnicodeSeries!(sp::Subplot{UnicodePlotsBackend}, o, series, addlegen
|
|||||||
if st == :histogram2d
|
if st == :histogram2d
|
||||||
return UnicodePlots.densityplot!(o, attrs[:x], attrs[:y])
|
return UnicodePlots.densityplot!(o, attrs[:x], attrs[:y])
|
||||||
elseif st == :heatmap
|
elseif st == :heatmap
|
||||||
rng = range(0, 1, length=length(UnicodePlots.COLOR_MAP_DATA[:viridis]))
|
rng = range(0, 1, length = length(UnicodePlots.COLOR_MAP_DATA[:viridis]))
|
||||||
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; title = sp[:title], zlabel = sp[:colorbar_title], colormap = cmap
|
series[:z].surf;
|
||||||
|
title = sp[:title],
|
||||||
|
zlabel = sp[:colorbar_title],
|
||||||
|
colormap = cmap,
|
||||||
)
|
)
|
||||||
elseif st == :spy
|
elseif st == :spy
|
||||||
return UnicodePlots.spy(series[:z].surf; title = sp[:title])
|
return UnicodePlots.spy(series[:z].surf; title = sp[:title])
|
||||||
@ -90,8 +100,8 @@ function addUnicodeSeries!(sp::Subplot{UnicodePlotsBackend}, o, series, addlegen
|
|||||||
func = UnicodePlots.lineplot!
|
func = UnicodePlots.lineplot!
|
||||||
elseif st == :scatter || attrs[:markershape] != :none
|
elseif st == :scatter || attrs[:markershape] != :none
|
||||||
func = UnicodePlots.scatterplot!
|
func = UnicodePlots.scatterplot!
|
||||||
# elseif st == :bar
|
# elseif st == :bar
|
||||||
# func = UnicodePlots.barplot!
|
# func = UnicodePlots.barplot!
|
||||||
elseif st == :shape
|
elseif st == :shape
|
||||||
func = UnicodePlots.lineplot!
|
func = UnicodePlots.lineplot!
|
||||||
else
|
else
|
||||||
@ -149,12 +159,15 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
|||||||
return
|
return
|
||||||
elseif Sys.islinux()
|
elseif Sys.islinux()
|
||||||
run(`clear`)
|
run(`clear`)
|
||||||
gui(plt); println()
|
gui(plt)
|
||||||
|
println()
|
||||||
run(`import -window $(ENV["WINDOWID"]) $fn`)
|
run(`import -window $(ENV["WINDOWID"]) $fn`)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
error("Can only savepng on MacOS or Linux with UnicodePlots (though even then I wouldn't do it)")
|
error(
|
||||||
|
"Can only savepng on MacOS or Linux with UnicodePlots (though even then I wouldn't do it)",
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|||||||
@ -15,7 +15,9 @@ using RecipesBase
|
|||||||
using JSON
|
using JSON
|
||||||
|
|
||||||
@testset "Infrastructure" begin
|
@testset "Infrastructure" begin
|
||||||
@test_nowarn JSON.Parser.parse(String(read(joinpath(dirname(pathof(Plots)), "..", ".zenodo.json"))))
|
@test_nowarn JSON.Parser.parse(
|
||||||
|
String(read(joinpath(dirname(pathof(Plots)), "..", ".zenodo.json"))),
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "Plotly standalone" begin
|
@testset "Plotly standalone" begin
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user