format file pgfplotsx.jl

This commit is contained in:
Simon Christ 2020-03-11 12:02:26 +01:00
parent dab99cd674
commit 2c4535f6f2

View File

@ -129,8 +129,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
) => nothing, ) => nothing,
"fill" => cstr, "fill" => cstr,
"fill opacity" => a, "fill opacity" => a,
"text opacity" => "text opacity" => alpha(plot_color(sp[:legendfontcolor])),
alpha(plot_color(sp[:legendfontcolor])),
"font" => pgfx_font( "font" => pgfx_font(
sp[:legendfontsize], sp[:legendfontsize],
pgfx_thickness_scaling(sp), pgfx_thickness_scaling(sp),
@ -299,7 +298,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
rng, rng,
) )
end end
if i == 1 && sp[:legend] != :none && pgfx_should_add_to_legend(series) if i == 1 &&
sp[:legend] != :none && pgfx_should_add_to_legend(series)
pgfx_filllegend!(series_opt, opt) pgfx_filllegend!(series_opt, opt)
end end
end end
@ -348,17 +348,17 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
# add to legend? # add to legend?
if sp[:legend] != :none && pgfx_should_add_to_legend(series) if sp[:legend] != :none && pgfx_should_add_to_legend(series)
leg_entry = if opt[:label] isa AVec leg_entry = if opt[:label] isa AVec
opt[:label][i] opt[:label][i]
elseif opt[:label] isa AbstractString elseif opt[:label] isa AbstractString
if i == 1 && opt[:label] != "" if i == 1 && opt[:label] != ""
opt[:label] opt[:label]
else
push!(segment_plot.options, "forget plot" => nothing)
continue
end
else else
throw(ArgumentError("Malformed label. label = $(opt[:label])")) push!(segment_plot.options, "forget plot" => nothing)
continue
end end
else
throw(ArgumentError("Malformed label. label = $(opt[:label])"))
end
leg_opt = PGFPlotsX.Options() leg_opt = PGFPlotsX.Options()
if ribbon !== nothing if ribbon !== nothing
pgfx_filllegend!(axis.contents[end - 3].options, opt) pgfx_filllegend!(axis.contents[end - 3].options, opt)
@ -541,8 +541,7 @@ function pgfx_series_coordinates!(
cs = join( cs = join(
[ [
join(["($x, $y) [$(zs[j, i])]" for (j, x) in enumerate(xs)], " ") join(["($x, $y) [$(zs[j, i])]" for (j, x) in enumerate(xs)], " ") for (i, y) in enumerate(ys)
for (i, y) in enumerate(ys)
], ],
"\n\n", "\n\n",
) )
@ -733,8 +732,8 @@ function pgfx_marker(plotattributes, i = 1)
"fill" => cstr, "fill" => cstr,
"fill opacity" => a, "fill opacity" => a,
"line width" => "line width" =>
pgfx_thickness_scaling(plotattributes) * pgfx_thickness_scaling(plotattributes) *
_cycle(plotattributes[:markerstrokewidth], i), _cycle(plotattributes[:markerstrokewidth], i),
"rotate" => if shape == :dtriangle "rotate" => if shape == :dtriangle
180 180
elseif shape == :rtriangle elseif shape == :rtriangle
@ -889,8 +888,7 @@ 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,
"font" => "font" => pgfx_font(axis[:guidefontsize], pgfx_thickness_scaling(sp)),
pgfx_font(axis[:guidefontsize], pgfx_thickness_scaling(sp)),
"color" => cstr, "color" => cstr,
"draw opacity" => α, "draw opacity" => α,
"rotate" => axis[:guidefontrotation], "rotate" => axis[:guidefontrotation],
@ -976,7 +974,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
opt, opt,
string(letter, "ticklabel style") => PGFPlotsX.Options( string(letter, "ticklabel style") => PGFPlotsX.Options(
"font" => "font" =>
pgfx_font(axis[:tickfontsize], pgfx_thickness_scaling(sp)), pgfx_font(axis[:tickfontsize], pgfx_thickness_scaling(sp)),
"color" => cstr, "color" => cstr,
"draw opacity" => α, "draw opacity" => α,
"rotate" => axis[:tickfontrotation], "rotate" => axis[:tickfontrotation],
@ -995,8 +993,7 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
# framestyle # framestyle
if framestyle in (:axes, :origin) if framestyle in (:axes, :origin)
axispos = axis[:mirror] ? "right" : axispos = axis[:mirror] ? "right" : framestyle == :axes ? "left" : "middle"
framestyle == :axes ? "left" : "middle"
if axis[:draw_arrow] if axis[:draw_arrow]
push!(opt, string("axis ", letter, " line") => axispos) push!(opt, string("axis ", letter, " line") => axispos)