use more extra_kwargs

This commit is contained in:
t-bltg 2022-01-28 10:45:35 +01:00
parent 3e8db4532b
commit 4a9fbe564a
2 changed files with 7 additions and 9 deletions

View File

@ -974,9 +974,6 @@ const _unicodeplots_scale = [:identity, :ln, :log2, :log10]
# Additional constants # Additional constants
const _up_colormap = Ref(:none) const _up_colormap = Ref(:none)
const _up_canvas = Ref(:auto)
const _up_border = Ref(:auto)
const _up_fix_ar = Ref(true)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# hdf5 # hdf5

View File

@ -34,13 +34,13 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
# create a plot window with xlim/ylim set, # create a plot window with xlim/ylim set,
# but the X/Y vectors are outside the bounds # but the X/Y vectors are outside the bounds
canvas = if (up_c = _up_canvas[]) == :auto canvas = if (up_c = get(sp[:extra_kwargs], :canvas, :auto)) == :auto
isijulia() ? :ascii : :braille isijulia() ? :ascii : :braille
else else
up_c up_c
end end
border = if (up_b = _up_border[]) == :auto border = if (up_b = get(sp[:extra_kwargs], :border, :auto)) == :auto
isijulia() ? :ascii : :solid isijulia() ? :ascii : :solid
else else
up_b up_b
@ -50,9 +50,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
width = has_layout && isempty(series_list(sp)) ? 0 : UnicodePlots.DEFAULT_WIDTH[] width = has_layout && isempty(series_list(sp)) ? 0 : UnicodePlots.DEFAULT_WIDTH[]
height = UnicodePlots.DEFAULT_HEIGHT[] height = UnicodePlots.DEFAULT_HEIGHT[]
blend = get(sp[:extra_kwargs], :blend, true)
grid = xaxis[:grid] && yaxis[:grid] grid = xaxis[:grid] && yaxis[:grid]
quiver = contour = false quiver = contour = false
blend = true
for series in series_list(sp) for series in series_list(sp)
st = series[:seriestype] st = series[:seriestype]
blend &= get(series[:extra_kwargs], :blend, true) blend &= get(series[:extra_kwargs], :blend, true)
@ -65,7 +65,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
grid = false grid = false
end end
end end
grid &= !contour && !quiver grid &= !(quiver || contour)
blend &= !(quiver || contour) blend &= !(quiver || contour)
kw = ( kw = (
@ -136,10 +136,11 @@ function addUnicodeSeries!(
end end
# special handling (src/interface) # special handling (src/interface)
fix_ar = get(series[:extra_kwargs], :fix_ar, true)
if st === :histogram2d if st === :histogram2d
return UnicodePlots.densityplot(x, y; kw...) return UnicodePlots.densityplot(x, y; kw...)
elseif st === :spy elseif st === :spy
return UnicodePlots.spy(series[:z].surf; fix_ar = _up_fix_ar[], kw...) return UnicodePlots.spy(series[:z].surf; fix_ar = fix_ar, kw...)
elseif st in (:contour, :heatmap) elseif st in (:contour, :heatmap)
kw = ( kw = (
kw..., kw...,
@ -158,7 +159,7 @@ function addUnicodeSeries!(
levels = series[:levels], levels = series[:levels],
) )
elseif st === :heatmap elseif st === :heatmap
return UnicodePlots.heatmap(series[:z].surf; fix_ar = _up_fix_ar[], kw...) return UnicodePlots.heatmap(series[:z].surf; fix_ar = fix_ar, kw...)
# zlim = collect(axis_limits(sp, :z)) # zlim = collect(axis_limits(sp, :z))
end end
end end