add origin framestyle
This commit is contained in:
parent
de32b02c75
commit
41877e362a
@ -181,13 +181,14 @@ function hasgrid(arg::Symbol, letter)
|
||||
end
|
||||
hasgrid(arg::AbstractString, letter) = hasgrid(Symbol(arg), letter)
|
||||
|
||||
const _allFramestyles = [:box, :semi, :axes, :grid, :none]
|
||||
const _allFramestyles = [:box, :semi, :axes, :origin, :grid, :none]
|
||||
const _framestyleAliases = Dict{Symbol, Symbol}(
|
||||
:frame => :box,
|
||||
:border => :box,
|
||||
:on => :box,
|
||||
:transparent => :semi,
|
||||
:semitransparent => :semi,
|
||||
:zeroline => :origin,
|
||||
)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -515,7 +515,8 @@ function axis_drawing_info(sp::Subplot)
|
||||
|
||||
if !(sp[:framestyle] == :none)
|
||||
# xaxis
|
||||
sp[:framestyle] == :grid || push!(xaxis_segs, (xmin,ymin), (xmax,ymin)) # bottom spine / xaxis
|
||||
sp[:framestyle] in (:grid, :origin) || push!(xaxis_segs, (xmin,ymin), (xmax,ymin)) # bottom spine / xaxis
|
||||
sp[:framestyle] == :origin && push!(xaxis_segs, (xmin, 0.0), (xmax, 0.0))
|
||||
sp[:framestyle] in (:semi, :box) && push!(xborder_segs, (xmin,ymax), (xmax,ymax)) # top spine
|
||||
if !(xaxis[:ticks] in (nothing, false))
|
||||
f = scalefunc(yaxis[:scale])
|
||||
@ -531,7 +532,8 @@ function axis_drawing_info(sp::Subplot)
|
||||
end
|
||||
|
||||
# yaxis
|
||||
sp[:framestyle] == :grid || push!(yaxis_segs, (xmin,ymin), (xmin,ymax)) # left spine / yaxis
|
||||
sp[:framestyle] in (:grid, :origin) || push!(yaxis_segs, (xmin,ymin), (xmin,ymax)) # left spine / yaxis
|
||||
sp[:framestyle] == :origin && push!(yaxis_segs, (0.0, ymin), (0.0, ymax))
|
||||
sp[:framestyle] in (:semi, :box) && push!(yborder_segs, (xmax,ymin), (xmax,ymax)) # right spine
|
||||
if !(yaxis[:ticks] in (nothing, false))
|
||||
f = scalefunc(xaxis[:scale])
|
||||
|
||||
@ -1099,9 +1099,13 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
ax[:spines]["top"][:set_alpha](intensity)
|
||||
ax[:spines]["right"][:set_linewidth](intensity)
|
||||
ax[:spines]["top"][:set_linewidth](intensity)
|
||||
elseif sp[:framestyle] == :axes
|
||||
elseif sp[:framestyle] in (:axes, :origin)
|
||||
ax[:spines]["right"][:set_visible](false)
|
||||
ax[:spines]["top"][:set_visible](false)
|
||||
if sp[:framestyle] == :origin
|
||||
ax[:spines]["left"][:set_position]("zero")
|
||||
ax[:spines]["bottom"][:set_position]("zero")
|
||||
end
|
||||
elseif sp[:framestyle] in (:grid, :none)
|
||||
for (loc, spine) in ax[:spines]
|
||||
spine[:set_visible](false)
|
||||
|
||||
@ -364,6 +364,11 @@ function _expand_subplot_extrema(sp::Subplot, d::KW, st::Symbol)
|
||||
elseif !(st in (:pie, :histogram, :bins2d, :histogram2d))
|
||||
expand_extrema!(sp, d)
|
||||
end
|
||||
# expand for zerolines (axes through origin)
|
||||
if sp[:framestyle] == :origin
|
||||
expand_extrema!(sp[:xaxis], 0.0)
|
||||
expand_extrema!(sp[:yaxis], 0.0)
|
||||
end
|
||||
end
|
||||
|
||||
function _add_the_series(plt, sp, d)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user