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

Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2021-08-29 10:53:46 +02:00 committed by GitHub
parent 09d35d7b9f
commit 8b6073c088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 30 deletions

View File

@ -229,7 +229,7 @@ function gaston_add_series(plt::Plot{GastonBackend}, series::Series)
if gsp.dims == 2 && z === nothing
for (n, seg) in enumerate(series_segments(series, st; check = true))
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)
push!(curves, Gaston.Curve(x[rng], y[rng], nothing, fr, sc))
end
@ -303,12 +303,15 @@ function gaston_seriesconf!(
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
pt, ps, mc = gaston_mk_ms_mc(series, clims, i)
push!(curveconf, "w points pt $pt ps $ps lc $mc")
elseif st (:path, :straightline, :path3d)
elseif st (:path, :straightline, :path3d)
fr = series[:fillrange]
fc = gaston_color(get_fillcolor(series, i), get_fillalpha(series, i))
lc, dt, lw = gaston_lc_ls_lw(series, clims, i)
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
push!(curveconf, "w lines lc $lc dt $dt lw $lw")
else

View File

@ -139,18 +139,7 @@ gr_set_arrowstyle(s::Symbol) = GR.setarrowstyle(
gr_set_fillstyle(::Nothing) = GR.setfillintstyle(GR.INTSTYLE_SOLID)
function gr_set_fillstyle(s::Symbol)
GR.setfillintstyle(GR.INTSTYLE_HATCH)
GR.setfillstyle(get(
(
(/) = 9,
(\) = 10,
(|) = 7,
(-) = 8,
(+) = 11,
(x) = 6,
),
s,
9),
)
GR.setfillstyle(get(((/) = 9, (\) = 10, (|) = 7, (-) = 8, (+) = 11, (x) = 6), s, 9))
end
# --------------------------------------------------------------------------------------

View File

@ -1238,7 +1238,11 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
opt,
string(letter, "label style") => PGFPlotsX.Options(
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",
"font" => pgfx_font(axis[:guidefontsize], pgfx_thickness_scaling(sp)),
"color" => cstr,
@ -1300,10 +1304,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
string("{\$", join(tick_labels, "\$,\$"), "\$}"),
)
elseif tick_labels isa Vector{LaTeXString}
push!(
opt,
string(letter, "ticklabels") => join(tick_labels)
)
push!(opt, string(letter, "ticklabels") => join(tick_labels))
end
elseif axis[:showaxis]
tick_labels =

View File

@ -795,7 +795,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
edgecolor = py_color(fc, has_fs ? fa : la),
facecolor = py_color(fc, has_fs ? 0 : fa),
hatch = py_fillstyle(fs),
linewidths = 0
linewidths = 0,
)
push!(handles, handle)
end
@ -1499,7 +1499,10 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
line_handle = pypatches."Patch"(
edgecolor = py_color(single_color(lc), la),
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),
capstyle = "butt",
)

View File

@ -68,7 +68,14 @@ function rebuildUnicodePlot!(plt::Plot, width, height)
end
# 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
st = attrs[:seriestype]
@ -76,10 +83,13 @@ function addUnicodeSeries!(sp::Subplot{UnicodePlotsBackend}, o, series, addlegen
if st == :histogram2d
return UnicodePlots.densityplot!(o, attrs[:x], attrs[:y])
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)]
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
return UnicodePlots.spy(series[:z].surf; title = sp[:title])
@ -90,8 +100,8 @@ function addUnicodeSeries!(sp::Subplot{UnicodePlotsBackend}, o, series, addlegen
func = UnicodePlots.lineplot!
elseif st == :scatter || attrs[:markershape] != :none
func = UnicodePlots.scatterplot!
# elseif st == :bar
# func = UnicodePlots.barplot!
# elseif st == :bar
# func = UnicodePlots.barplot!
elseif st == :shape
func = UnicodePlots.lineplot!
else
@ -149,12 +159,15 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
return
elseif Sys.islinux()
run(`clear`)
gui(plt); println()
gui(plt)
println()
run(`import -window $(ENV["WINDOWID"]) $fn`)
return
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
# -------------------------------

View File

@ -15,7 +15,9 @@ using RecipesBase
using JSON
@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
@testset "Plotly standalone" begin