UnicodePlots: do not show blank plots (on layouts) (#4058)

This commit is contained in:
t-bltg 2022-01-22 18:26:13 +01:00 committed by GitHub
parent ab698da5a4
commit 311831ca4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ const _canvas_map = (
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend}) function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
plt.o = UnicodePlots.Plot[] plt.o = UnicodePlots.Plot[]
has_layout = prod(size(plt.layout)) > 1
for sp in plt.subplots for sp in plt.subplots
xaxis = sp[:xaxis] xaxis = sp[:xaxis]
yaxis = sp[:yaxis] yaxis = sp[:yaxis]
@ -47,7 +48,9 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
up_b up_b
end end
width, height = UnicodePlots.DEFAULT_WIDTH[], UnicodePlots.DEFAULT_HEIGHT[] # blank plots will not be shown
width = has_layout && isempty(series_list(sp)) ? 0 : UnicodePlots.DEFAULT_WIDTH[]
height = UnicodePlots.DEFAULT_HEIGHT[]
grid = xaxis[:grid] && yaxis[:grid] grid = xaxis[:grid] && yaxis[:grid]
quiver = contour = false quiver = contour = false