pgfplots: remove axis arrows and implement origin and zerolines framestyles

This commit is contained in:
Daniel Schwabeneder 2017-10-04 13:40:56 +02:00
parent ff751ca423
commit e3b0f7cd94

View File

@ -108,8 +108,8 @@ const _pgf_annotation_halign = KW(
:right => "left" :right => "left"
) )
const _pgf_framestyles = [:box, :axes, :grid, :none] const _pgf_framestyles = [:box, :axes, :origin, :zerolines, :grid, :none]
const _pgf_framestyle_defaults = Dict(:semi => :box, :origin => :axes, :zerolines => :axes) const _pgf_framestyle_defaults = Dict(:semi => :box)
function pgf_framestyle(style::Symbol) function pgf_framestyle(style::Symbol)
if style in _pgf_framestyles if style in _pgf_framestyles
return style return style
@ -308,14 +308,22 @@ function pgf_axis(sp::Subplot, letter)
end end
# framestyle # framestyle
if sp[:framestyle] == :axes if framestyle in (:axes, :origin)
push!(style, "axis lines = left") axispos = framestyle == :axes ? "left" : "middle"
# the * after lines disables the arrows at the axes
push!(style, string("axis lines* = ", axispos))
end
if framestyle == :zerolines
push!(style, string("extra ", letter, " ticks = 0"))
push!(style, string("extra ", letter, " tick labels = "))
push!(style, string("extra ", letter, " tick style = {grid = major, major grid style = {color = black, draw opacity=1.0, line width=0.5), solid}}"))
end end
if !axis[:showaxis] if !axis[:showaxis]
push!(style, "separate axis lines") push!(style, "separate axis lines")
end end
if !axis[:showaxis] || framestyle in (:grid, :none) if !axis[:showaxis] || framestyle in (:zerolines, :grid, :none)
push!(style, string(letter, " axis line style = {draw opacity = 0}")) push!(style, string(letter, " axis line style = {draw opacity = 0}"))
end end