More memoizing
This commit is contained in:
parent
b899e71730
commit
5250d63a00
12
src/axes.jl
12
src/axes.jl
@ -297,7 +297,7 @@ for l in (:x, :y, :z)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# get_ticks from axis symbol :x, :y, or :z
|
# get_ticks from axis symbol :x, :y, or :z
|
||||||
get_ticks(sp::Subplot, s::Symbol) = get_ticks(sp, sp[Symbol(s, :axis)])
|
get_ticks(sp::Subplot, s::Symbol) = get_ticks(sp, sp[get_axis_attr(s, :axis)])
|
||||||
get_ticks(p::Plot, s::Symbol) = [get_ticks(sp, s) for sp in p.subplots]
|
get_ticks(p::Plot, s::Symbol) = [get_ticks(sp, s) for sp in p.subplots]
|
||||||
|
|
||||||
function get_ticks(ticks::Symbol, cvals::T, dvals, args...) where {T}
|
function get_ticks(ticks::Symbol, cvals::T, dvals, args...) where {T}
|
||||||
@ -393,7 +393,7 @@ end
|
|||||||
|
|
||||||
function reset_extrema!(sp::Subplot)
|
function reset_extrema!(sp::Subplot)
|
||||||
for asym in (:x, :y, :z)
|
for asym in (:x, :y, :z)
|
||||||
sp[Symbol(asym, :axis)][:extrema] = Extrema()
|
sp[get_axis_attr(asym, :axis)][:extrema] = Extrema()
|
||||||
end
|
end
|
||||||
for series in sp.series_list
|
for series in sp.series_list
|
||||||
expand_extrema!(sp, series.plotattributes)
|
expand_extrema!(sp, series.plotattributes)
|
||||||
@ -502,7 +502,7 @@ function expand_extrema!(sp::Subplot, plotattributes::AKW)
|
|||||||
plotattributes[:bar_width] =
|
plotattributes[:bar_width] =
|
||||||
_bar_width * ignorenan_minimum(filter(x -> x > 0, diff(sort(data))))
|
_bar_width * ignorenan_minimum(filter(x -> x > 0, diff(sort(data))))
|
||||||
end
|
end
|
||||||
axis = sp.attr[Symbol(dsym, :axis)]
|
axis = sp.attr[get_axis_attr(dsym, :axis)]
|
||||||
expand_extrema!(axis, ignorenan_maximum(data) + 0.5maximum(bw))
|
expand_extrema!(axis, ignorenan_maximum(data) + 0.5maximum(bw))
|
||||||
expand_extrema!(axis, ignorenan_minimum(data) - 0.5minimum(bw))
|
expand_extrema!(axis, ignorenan_minimum(data) - 0.5minimum(bw))
|
||||||
end
|
end
|
||||||
@ -727,7 +727,7 @@ function axis_drawing_info(sp, letter)
|
|||||||
asym = get_axis_attr(letter, :axis)
|
asym = get_axis_attr(letter, :axis)
|
||||||
isy = letter === :y
|
isy = letter === :y
|
||||||
oletter = isy ? :x : :y
|
oletter = isy ? :x : :y
|
||||||
oasym = Symbol(oletter, :axis)
|
oasym = get_axis_attr(oletter, :axis)
|
||||||
|
|
||||||
# get axis objects, ticks and minor ticks
|
# get axis objects, ticks and minor ticks
|
||||||
ax, oax = sp[asym], sp[oasym]
|
ax, oax = sp[asym], sp[oasym]
|
||||||
@ -857,8 +857,8 @@ function axis_drawing_info_3d(sp, letter)
|
|||||||
far_letter = letter in (:x, :y) ? :z : :x
|
far_letter = letter in (:x, :y) ? :z : :x
|
||||||
|
|
||||||
ax = sp[get_axis_attr(letter, :axis)]
|
ax = sp[get_axis_attr(letter, :axis)]
|
||||||
nax = sp[Symbol(near_letter, :axis)]
|
nax = sp[get_axis_attr(near_letter, :axis)]
|
||||||
fax = sp[Symbol(far_letter, :axis)]
|
fax = sp[get_axis_attr(far_letter, :axis)]
|
||||||
|
|
||||||
amin, amax = axis_limits(sp, letter)
|
amin, amax = axis_limits(sp, letter)
|
||||||
namin, namax = axis_limits(sp, near_letter)
|
namin, namax = axis_limits(sp, near_letter)
|
||||||
|
|||||||
@ -1567,7 +1567,7 @@ function gr_label_ticks(sp, letter, ticks)
|
|||||||
axis = sp[get_axis_attr(letter, :axis)]
|
axis = sp[get_axis_attr(letter, :axis)]
|
||||||
isy = letter === :y
|
isy = letter === :y
|
||||||
oletter = isy ? :x : :y
|
oletter = isy ? :x : :y
|
||||||
oaxis = sp[Symbol(oletter, :axis)]
|
oaxis = sp[get_axis_attr(oletter, :axis)]
|
||||||
oamin, oamax = axis_limits(sp, oletter)
|
oamin, oamax = axis_limits(sp, oletter)
|
||||||
gr_set_tickfont(sp, letter)
|
gr_set_tickfont(sp, letter)
|
||||||
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
out_factor = ifelse(axis[:tick_direction] === :out, 1.5, 1)
|
||||||
@ -1589,8 +1589,8 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
far_letter = letter in (:x, :y) ? :z : :x
|
far_letter = letter in (:x, :y) ? :z : :x
|
||||||
|
|
||||||
ax = sp[get_axis_attr(letter, :axis)]
|
ax = sp[get_axis_attr(letter, :axis)]
|
||||||
nax = sp[Symbol(near_letter, :axis)]
|
nax = sp[get_axis_attr(near_letter, :axis)]
|
||||||
fax = sp[Symbol(far_letter, :axis)]
|
fax = sp[get_axis_attr(far_letter, :axis)]
|
||||||
|
|
||||||
amin, amax = axis_limits(sp, letter)
|
amin, amax = axis_limits(sp, letter)
|
||||||
namin, namax = axis_limits(sp, near_letter)
|
namin, namax = axis_limits(sp, near_letter)
|
||||||
@ -1600,7 +1600,7 @@ function gr_label_ticks_3d(sp, letter, ticks)
|
|||||||
# find out which axes we are dealing with
|
# find out which axes we are dealing with
|
||||||
i = findfirst(==(letter), (:x, :y, :z))
|
i = findfirst(==(letter), (:x, :y, :z))
|
||||||
letters = axes_shift((:x, :y, :z), 1 - i)
|
letters = axes_shift((:x, :y, :z), 1 - i)
|
||||||
asyms = Symbol.(letters, :axis)
|
asyms = get_axis_attr.(letters, :axis)
|
||||||
|
|
||||||
# get axis objects, ticks and minor ticks
|
# get axis objects, ticks and minor ticks
|
||||||
# regardless of the `letter` we now use the convention that `x` in variable names refer to
|
# regardless of the `letter` we now use the convention that `x` in variable names refer to
|
||||||
|
|||||||
@ -922,7 +922,7 @@ end
|
|||||||
|
|
||||||
function py_set_axis_colors(sp, ax, a::Axis)
|
function py_set_axis_colors(sp, ax, a::Axis)
|
||||||
py_set_spine_color(ax.spines, py_color(a[:foreground_color_border]))
|
py_set_spine_color(ax.spines, py_color(a[:foreground_color_border]))
|
||||||
axissym = Symbol(a[:letter], :axis)
|
axissym = get_axis_attr(a[:letter], :axis)
|
||||||
if PyPlot.PyCall.hasproperty(ax, axissym)
|
if PyPlot.PyCall.hasproperty(ax, axissym)
|
||||||
tickcolor =
|
tickcolor =
|
||||||
sp[:framestyle] in (:zerolines, :grid) ?
|
sp[:framestyle] in (:zerolines, :grid) ?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user