Skip to content

Commit

Permalink
UnicodePlots: toggle canvas blend with extra_kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Jan 28, 2022
1 parent 46e19d9 commit 3e8db45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/backends/unicodeplots.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# https://github.com/JuliaPlots/UnicodePlots.jl

# don't warn on unsupported... there's just too many warnings !
warn_on_unsupported_args(::UnicodePlotsBackend, plotattributes) = nothing

# ------------------------------------------------------------------------------------------
const _canvas_map = (
braille = UnicodePlots.BrailleCanvas,
Expand All @@ -17,6 +14,7 @@ const _canvas_map = (
# do all the magic here... build it all at once,
# since we need to know about all the series at the very beginning
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
plt.attr[:warn_on_unsupported] = false
plt.o = UnicodePlots.Plot[]

has_layout = prod(size(plt.layout)) > 1
Expand Down Expand Up @@ -54,8 +52,10 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})

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)
quiver |= series[:arrow] isa Arrow # post-pipeline detection (:quiver -> :path)
contour |= st === :contour
if st === :histogram2d
Expand All @@ -66,14 +66,15 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
end
end
grid &= !contour && !quiver
blend &= !(quiver || contour)

kw = (
compact = true,
title = texmath2unicode(sp[:title]),
xlabel = texmath2unicode(xaxis[:guide]),
ylabel = texmath2unicode(yaxis[:guide]),
grid = grid,
blend = !(quiver || contour),
blend = blend,
height = height,
width = width,
xscale = xaxis[:scale],
Expand Down

0 comments on commit 3e8db45

Please sign in to comment.