Merge branch 'master' of https://github.com/JuliaPlots/Plots.jl into wire

This commit is contained in:
t-bltg 2021-06-25 21:14:50 +02:00
commit 4ac78623b5
3 changed files with 51 additions and 86 deletions

View File

@ -1,7 +1,7 @@
name = "Plots"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
author = ["Tom Breloff (@tbreloff)"]
version = "1.16.5"
version = "1.16.6"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

View File

@ -703,61 +703,46 @@ function axis_drawing_info(sp, letter)
)
end
end
if !(ax[:ticks] in (:none, nothing, false))
if ax[:ticks] (:none, nothing, false)
f = RecipesPipeline.scale_func(oax[:scale])
invf = RecipesPipeline.inverse_scale_func(oax[:scale])
if ax[:tick_direction] !== :none
add_major_or_minor_segments(ticks, grid, segments, factor, cond) = begin
if cond
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(oamax) - f(oamin)))
t = invf(f(0) + factor * (f(oamax) - f(oamin)))
(-t, t)
else
ticks_in = ax[:tick_direction] == :out ? -1 : 1
t = invf(f(oa1) + 0.012 * (f(oa2) - f(oa1)) * ticks_in)
t = invf(f(oa1) + factor * (f(oa2) - f(oa1)) * ticks_in)
(oa1, t)
end
end
for tick in ticks[1]
if ax[:showaxis] && ax[:tick_direction] !== :none
for tick in ticks
if ax[:showaxis] && cond
push!(
tick_segments,
reverse_if((tick, tick_start), isy),
reverse_if((tick, tick_stop), isy),
)
end
if ax[:grid]
if grid
push!(
grid_segments,
segments,
reverse_if((tick, oamin), isy),
reverse_if((tick, oamax), isy),
)
end
end
end
if !(ax[:minorticks] in (:none, nothing, false)) || ax[:minorgrid]
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.006 * (f(oamax) - f(oamin)))
(-t, t)
else
t = invf(f(oa1) + 0.006 * (f(oa2) - f(oa1)) * ticks_in)
(oa1, t)
end
for tick in minor_ticks
if ax[:showaxis]
push!(
tick_segments,
reverse_if((tick, tick_start), isy),
reverse_if((tick, tick_stop), isy),
)
end
if ax[:minorgrid]
push!(
minorgrid_segments,
reverse_if((tick, oamin), isy),
reverse_if((tick, oamax), isy),
)
end
end
# add major grid segments
add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 0.012, ax[:tick_direction] !== :none)
# add minor grid segments
if ax[:minorticks] (:none, nothing, false) || ax[:minorgrid]
add_major_or_minor_segments(minor_ticks, ax[:minorgrid], minorgrid_segments, 0.006, true)
end
end
end
@ -841,73 +826,53 @@ function axis_drawing_info_3d(sp, letter)
)
end
end
# TODO this can be simplified, we do almost the same thing twice for grid and minorgrid
if !(ax[:ticks] in (:none, nothing, false))
if ax[:ticks] (:none, nothing, false)
f = RecipesPipeline.scale_func(nax[:scale])
invf = RecipesPipeline.inverse_scale_func(nax[:scale])
if ax[:tick_direction] !== :none
ga0, ga1 = sp[:framestyle] in (:origin, :zerolines) ? (namin, namax) : (na0, na1)
add_major_or_minor_segments(ticks, grid, segments, factor, cond) = begin
if cond
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.012 * (f(namax) - f(namin)))
t = invf(f(0) + factor * (f(namax) - f(namin)))
(-t, t)
else
ticks_in = ax[:tick_direction] == :out ? -1 : 1
t = invf(f(na0) + 0.012 * (f(na1) - f(na0)) * ticks_in)
t = invf(f(na0) + factor * (f(na1) - f(na0)) * ticks_in)
(na0, t)
end
end
ga0, ga1 = sp[:framestyle] in (:origin, :zerolines) ? (namin, namax) : (na0, na1)
for tick in ticks[1]
if ax[:showaxis] && ax[:tick_direction] !== :none
for tick in ticks
if ax[:showaxis] && cond
push!(
tick_segments,
sort_3d_axes(tick, tick_start, fa0, letter),
sort_3d_axes(tick, tick_stop, fa0, letter),
)
end
if ax[:grid]
if grid
push!(
grid_segments,
segments,
sort_3d_axes(tick, ga0, fa0, letter),
sort_3d_axes(tick, ga1, fa0, letter),
)
push!(
grid_segments,
segments,
sort_3d_axes(tick, ga1, fa0, letter),
sort_3d_axes(tick, ga1, fa1, letter),
)
end
end
end
if !(ax[:minorticks] in (:none, nothing, false)) || ax[:minorgrid]
tick_start, tick_stop = if sp[:framestyle] == :origin
t = invf(f(0) + 0.006 * (f(namax) - f(namin)))
(-t, t)
else
t = invf(f(na0) + 0.006 * (f(na1) - f(na0)) * ticks_in)
(na0, t)
end
for tick in minor_ticks
if ax[:showaxis] && ax[:tick_direction] !== :none
push!(
tick_segments,
sort_3d_axes(tick, tick_start, fa0, letter),
sort_3d_axes(tick, tick_stop, fa0, letter),
)
end
if ax[:minorgrid]
push!(
minorgrid_segments,
sort_3d_axes(tick, ga0, fa0, letter),
sort_3d_axes(tick, ga1, fa0, letter),
)
push!(
minorgrid_segments,
sort_3d_axes(tick, ga1, fa0, letter),
sort_3d_axes(tick, ga1, fa1, letter),
)
end
end
# add major grid segments
add_major_or_minor_segments(ticks[1], ax[:grid], grid_segments, 0.012, ax[:tick_direction] !== :none)
# add minor grid segments
if ax[:minorticks] (:none, nothing, false) || ax[:minorgrid]
add_major_or_minor_segments(minor_ticks, ax[:minorgrid], minorgrid_segments, 0.006, true)
end
end
end

View File

@ -406,7 +406,7 @@ end
# ----------------------------------------------------------------------
calc_num_subplots(layout::AbstractLayout) = 1
calc_num_subplots(layout::AbstractLayout) = get(layout.attr, :blank, false) ? 0 : 1
function calc_num_subplots(layout::GridLayout)
tot = 0
for l in layout.grid