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
const _up_colormap = Ref(:none)
const _up_canvas = Ref(:auto)
const _up_border = Ref(:auto)
const _up_fix_ar = Ref(true)
# ------------------------------------------------------------------------------
# hdf5

View File

@ -34,13 +34,13 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
# create a plot window with xlim/ylim set,
# 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
else
up_c
end
border = if (up_b = _up_border[]) == :auto
border = if (up_b = get(sp[:extra_kwargs], :border, :auto)) == :auto
isijulia() ? :ascii : :solid
else
up_b
@ -50,9 +50,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
width = has_layout && isempty(series_list(sp)) ? 0 : UnicodePlots.DEFAULT_WIDTH[]
height = UnicodePlots.DEFAULT_HEIGHT[]
blend = get(sp[:extra_kwargs], :blend, true)
grid = xaxis[:grid] && yaxis[:grid]
quiver = contour = false
blend = true
for series in series_list(sp)
st = series[:seriestype]
blend &= get(series[:extra_kwargs], :blend, true)
@ -65,7 +65,7 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
grid = false
end
end
grid &= !contour && !quiver
grid &= !(quiver || contour)
blend &= !(quiver || contour)
kw = (
@ -136,10 +136,11 @@ function addUnicodeSeries!(
end
# special handling (src/interface)
fix_ar = get(series[:extra_kwargs], :fix_ar, true)
if st === :histogram2d
return UnicodePlots.densityplot(x, y; kw...)
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)
kw = (
kw...,
@ -158,7 +159,7 @@ function addUnicodeSeries!(
levels = series[:levels],
)
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))
end
end