diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 9e697f1b0..f5e348342 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -45,6 +45,18 @@ end # ------------------------------- +const _canvas_type = Ref(:auto) + +function _canvas_map() + KW( + :braille => UnicodePlots.BrailleCanvas, + :ascii => UnicodePlots.AsciiCanvas, + :block => UnicodePlots.BlockCanvas, + :dot => UnicodePlots.DotCanvas, + :density => UnicodePlots.DensityCanvas, + ) +end + # do all the magic here... build it all at once, since we need to know about all the series at the very beginning function rebuildUnicodePlot!(plt::Plot, width, height) @@ -66,7 +78,12 @@ function rebuildUnicodePlot!(plt::Plot, width, height) y = Float64[ylim[1]] # create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds - canvas_type = isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas + ct = _canvas_type[] + canvas_type = if ct == :auto + isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas + else + _canvas_map()[ct] + end # special handling for spy if length(sp.series_list) == 1