remove const in pgfplotsx - 1 more left
This commit is contained in:
parent
577acbdeb6
commit
5759fd61ea
@ -179,10 +179,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
|
|||||||
x, y = sp[:legend]
|
x, y = sp[:legend]
|
||||||
push!(axis_opt["legend style"], "at={($x, $y)}")
|
push!(axis_opt["legend style"], "at={($x, $y)}")
|
||||||
else
|
else
|
||||||
push!(
|
push!(axis_opt["legend style"], pgfx_get_legend_pos(sp[:legend])...)
|
||||||
axis_opt["legend style"],
|
|
||||||
get(_pgfplotsx_legend_pos, sp[:legend], ("at" => string((1.02, 1)), "anchor" => "north west"))...
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
for letter in (:x, :y, :z)
|
for letter in (:x, :y, :z)
|
||||||
if letter != :z || RecipesPipeline.is3d(sp)
|
if letter != :z || RecipesPipeline.is3d(sp)
|
||||||
@ -596,62 +593,67 @@ function pgfx_series_coordinates!(
|
|||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
##
|
##
|
||||||
const _pgfplotsx_linestyles = KW(
|
pgfx_get_linestyle(k) = get(
|
||||||
:solid => "solid",
|
(
|
||||||
:dash => "dashed",
|
solid = "solid",
|
||||||
:dot => "dotted",
|
dash = "dashed",
|
||||||
:dashdot => "dashdotted",
|
dot = "dotted",
|
||||||
:dashdotdot => "dashdotdotted",
|
dashdot = "dashdotted",
|
||||||
|
dashdotdot = "dashdotdotted",
|
||||||
|
),
|
||||||
|
k,
|
||||||
|
"solid",
|
||||||
)
|
)
|
||||||
|
|
||||||
const _pgfplotsx_series_ids = KW()
|
const _pgfplotsx_series_ids = KW()
|
||||||
|
|
||||||
const _pgfplotsx_markers = KW(
|
pgfx_get_marker(k) = get(
|
||||||
:none => "none",
|
(
|
||||||
:cross => "+",
|
none = "none",
|
||||||
:xcross => "x",
|
cross = "+",
|
||||||
:+ => "+",
|
xcross = "x",
|
||||||
:x => "x",
|
+ = "+",
|
||||||
:utriangle => "triangle*",
|
x = "x",
|
||||||
:dtriangle => "triangle*",
|
utriangle = "triangle*",
|
||||||
:rtriangle => "triangle*",
|
dtriangle = "triangle*",
|
||||||
:ltriangle => "triangle*",
|
rtriangle = "triangle*",
|
||||||
:circle => "*",
|
ltriangle = "triangle*",
|
||||||
:rect => "square*",
|
circle = "*",
|
||||||
:star5 => "star",
|
rect = "square*",
|
||||||
:star6 => "asterisk",
|
star5 = "star",
|
||||||
:diamond => "diamond*",
|
star6 = "asterisk",
|
||||||
:pentagon => "pentagon*",
|
diamond = "diamond*",
|
||||||
:hline => "-",
|
pentagon = "pentagon*",
|
||||||
:vline => "|",
|
hline = "-",
|
||||||
|
vline = "|",
|
||||||
|
),
|
||||||
|
k,
|
||||||
|
"*",
|
||||||
)
|
)
|
||||||
|
|
||||||
const _pgfplotsx_legend_pos = KW(
|
pgfx_get_legend_pos(k) = get(
|
||||||
:top => ("at" => string((0.5, 0.98)), "anchor" => "north"),
|
(
|
||||||
:bottom => ("at" => string((0.5, 0.02)), "anchor" => "south"),
|
top = ("at" => string((0.5, 0.98)), "anchor" => "north"),
|
||||||
:left => ("at" => string((0.02, 0.5)), "anchor" => "west"),
|
bottom = ("at" => string((0.5, 0.02)), "anchor" => "south"),
|
||||||
:right => ("at" => string((0.98, 0.5)), "anchor" => "east"),
|
left = ("at" => string((0.02, 0.5)), "anchor" => "west"),
|
||||||
:bottomleft => ("at" => string((0.02, 0.02)), "anchor" => "south west"),
|
right = ("at" => string((0.98, 0.5)), "anchor" => "east"),
|
||||||
:bottomright => ("at" => string((0.98, 0.02)), "anchor" => "south east"),
|
bottomleft = ("at" => string((0.02, 0.02)), "anchor" => "south west"),
|
||||||
:topright => ("at" => string((0.98, 0.98)), "anchor" => "north east"),
|
bottomright = ("at" => string((0.98, 0.02)), "anchor" => "south east"),
|
||||||
:topleft => ("at" => string((0.02, 0.98)), "anchor" => "north west"),
|
topright = ("at" => string((0.98, 0.98)), "anchor" => "north east"),
|
||||||
:outertop => ("at" => string((0.5, 1.02)), "anchor" => "south"),
|
topleft = ("at" => string((0.02, 0.98)), "anchor" => "north west"),
|
||||||
:outerbottom => ("at" => string((0.5, -0.02)), "anchor" => "north"),
|
outertop = ("at" => string((0.5, 1.02)), "anchor" => "south"),
|
||||||
:outerleft => ("at" => string((-0.02, 0.5)), "anchor" => "east"),
|
outerbottom = ("at" => string((0.5, -0.02)), "anchor" => "north"),
|
||||||
:outerright => ("at" => string((1.02, 0.5)), "anchor" => "west"),
|
outerleft = ("at" => string((-0.02, 0.5)), "anchor" => "east"),
|
||||||
:outerbottomleft => ("at" => string((-0.02, -0.02)), "anchor" => "north east"),
|
outerright = ("at" => string((1.02, 0.5)), "anchor" => "west"),
|
||||||
:outerbottomright => ("at" => string((1.02, -0.02)), "anchor" => "north west"),
|
outerbottomleft = ("at" => string((-0.02, -0.02)), "anchor" => "north east"),
|
||||||
:outertopright => ("at" => string((1.02, 1)), "anchor" => "north west"),
|
outerbottomright = ("at" => string((1.02, -0.02)), "anchor" => "north west"),
|
||||||
:outertopleft => ("at" => string((-0.02, 1)), "anchor" => "north east"),
|
outertopright = ("at" => string((1.02, 1)), "anchor" => "north west"),
|
||||||
|
outertopleft = ("at" => string((-0.02, 1)), "anchor" => "north east"),
|
||||||
|
),
|
||||||
|
k,
|
||||||
|
("at" => string((1.02, 1)), "anchor" => "north west"),
|
||||||
)
|
)
|
||||||
|
|
||||||
const _pgfx_framestyles = [:box, :axes, :origin, :zerolines, :grid, :none]
|
|
||||||
const _pgfx_framestyle_defaults = Dict(:semi => :box)
|
|
||||||
|
|
||||||
# we use the anchors to define orientations for example to align left
|
|
||||||
# one needs to use the right edge as anchor
|
|
||||||
const _pgfx_annotation_halign =
|
|
||||||
KW(:center => "", :left => "right", :right => "left")
|
|
||||||
## --------------------------------------------------------------------------------------
|
## --------------------------------------------------------------------------------------
|
||||||
# Generates a colormap for pgfplots based on a ColorGradient
|
# Generates a colormap for pgfplots based on a ColorGradient
|
||||||
pgfx_arrow(::Nothing) = "every arrow/.append style={-}"
|
pgfx_arrow(::Nothing) = "every arrow/.append style={-}"
|
||||||
@ -698,10 +700,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function pgfx_framestyle(style::Symbol)
|
function pgfx_framestyle(style::Symbol)
|
||||||
if style in _pgfx_framestyles
|
if style in (:box, :axes, :origin, :zerolines, :grid, :none)
|
||||||
return style
|
return style
|
||||||
else
|
else
|
||||||
default_style = get(_pgfx_framestyle_defaults, style, :axes)
|
default_style = get((semi = :box,), style, :axes)
|
||||||
@warn( "Framestyle :$style is not (yet) supported by the PGFPlotsX backend. :$default_style was cosen instead.",)
|
@warn( "Framestyle :$style is not (yet) supported by the PGFPlotsX backend. :$default_style was cosen instead.",)
|
||||||
default_style
|
default_style
|
||||||
end
|
end
|
||||||
@ -727,7 +729,7 @@ function pgfx_linestyle(linewidth::Real, color, α = 1, linestyle = "solid")
|
|||||||
"color" => cstr,
|
"color" => cstr,
|
||||||
"draw opacity" => a,
|
"draw opacity" => a,
|
||||||
"line width" => linewidth,
|
"line width" => linewidth,
|
||||||
get(_pgfplotsx_linestyles, linestyle, "solid") => nothing,
|
pgfx_get_linestyle(linestyle) => nothing,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -765,10 +767,8 @@ end
|
|||||||
|
|
||||||
function pgfx_marker(plotattributes, i = 1)
|
function pgfx_marker(plotattributes, i = 1)
|
||||||
shape = _cycle(plotattributes[:markershape], i)
|
shape = _cycle(plotattributes[:markershape], i)
|
||||||
cstr = plot_color(
|
cstr =
|
||||||
get_markercolor(plotattributes, i),
|
plot_color(get_markercolor(plotattributes, i), get_markeralpha(plotattributes, i))
|
||||||
get_markeralpha(plotattributes, i),
|
|
||||||
)
|
|
||||||
a = alpha(cstr)
|
a = alpha(cstr)
|
||||||
cstr_stroke = plot_color(
|
cstr_stroke = plot_color(
|
||||||
get_markerstrokecolor(plotattributes, i),
|
get_markerstrokecolor(plotattributes, i),
|
||||||
@ -780,8 +780,7 @@ function pgfx_marker(plotattributes, i = 1)
|
|||||||
0.75 *
|
0.75 *
|
||||||
_cycle(plotattributes[:markersize], i)
|
_cycle(plotattributes[:markersize], i)
|
||||||
return PGFPlotsX.Options(
|
return PGFPlotsX.Options(
|
||||||
"mark" =>
|
"mark" => shape isa Shape ? "PlotsShape$i" : pgfx_get_marker(shape),
|
||||||
shape isa Shape ? "PlotsShape$i" : get(_pgfplotsx_markers, shape, "*"),
|
|
||||||
"mark size" => "$mark_size pt",
|
"mark size" => "$mark_size pt",
|
||||||
"mark options" => PGFPlotsX.Options(
|
"mark options" => PGFPlotsX.Options(
|
||||||
"color" => cstr_stroke,
|
"color" => cstr_stroke,
|
||||||
@ -789,7 +788,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) * 0.75 *
|
pgfx_thickness_scaling(plotattributes) *
|
||||||
|
0.75 *
|
||||||
_cycle(plotattributes[:markerstrokewidth], i),
|
_cycle(plotattributes[:markerstrokewidth], i),
|
||||||
"rotate" => if shape == :dtriangle
|
"rotate" => if shape == :dtriangle
|
||||||
180
|
180
|
||||||
@ -800,11 +800,7 @@ function pgfx_marker(plotattributes, i = 1)
|
|||||||
else
|
else
|
||||||
0
|
0
|
||||||
end,
|
end,
|
||||||
get(
|
pgfx_get_linestyle(_cycle(plotattributes[:markerstrokestyle], i)) => nothing,
|
||||||
_pgfplotsx_linestyles,
|
|
||||||
_cycle(plotattributes[:markerstrokestyle], i),
|
|
||||||
"solid",
|
|
||||||
) => nothing,
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -818,7 +814,8 @@ function pgfx_add_annotation!(o, x, y, val, thickness_scaling = 1)
|
|||||||
[
|
[
|
||||||
"\\node",
|
"\\node",
|
||||||
PGFPlotsX.Options(
|
PGFPlotsX.Options(
|
||||||
get(_pgfx_annotation_halign, val.font.halign, "") => nothing,
|
get((center = "", left = "right", right = "left"), val.font.halign, "") =>
|
||||||
|
nothing,
|
||||||
"color" => cstr,
|
"color" => cstr,
|
||||||
"draw opacity" => convert(Float16, a),
|
"draw opacity" => convert(Float16, a),
|
||||||
"rotate" => val.font.rotation,
|
"rotate" => val.font.rotation,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user