From a05bc80a1bc52bbb5b3ecd151f9c9a7b5ea2855b Mon Sep 17 00:00:00 2001 From: t-bltg Date: Thu, 30 Dec 2021 17:01:02 +0100 Subject: [PATCH] add width and height --- src/backends.jl | 6 ++++-- src/backends/unicodeplots.jl | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 362fa32a..782d7149 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -970,8 +970,10 @@ const _unicodeplots_marker = [ const _unicodeplots_scale = [:identity, :ln, :log2, :log10] # Additional constants -const _canvas_type = Ref(:auto) -const _border_type = Ref(:auto) +const _unicodeplots_canvas = Ref(:auto) +const _unicodeplots_border = Ref(:auto) +const _unicodeplots_width = Ref(40) +const _unicodeplots_height = Ref(15) # ------------------------------------------------------------------------------ # hdf5 diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index 982241f4..e8f0e121 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -34,16 +34,16 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend}) # create a plot window with xlim/ylim set, # but the X/Y vectors are outside the bounds - canvas_type = if (ct = _canvas_type[]) == :auto + canvas = if (up_c = _unicodeplots_canvas[]) == :auto isijulia() ? :ascii : :braille else - ct + up_c end - border_type = if (bt = _border_type[]) == :auto + border = if (up_b = _unicodeplots_border[]) == :auto isijulia() ? :ascii : :solid else - bt + up_b end kw = ( @@ -51,14 +51,16 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend}) title = texmath2unicode(sp[:title]), xlabel = texmath2unicode(xaxis[:guide]), ylabel = texmath2unicode(yaxis[:guide]), + width = _unicodeplots_width[], + height = _unicodeplots_height[], xscale = xaxis[:scale], yscale = yaxis[:scale], - border = border_type, + border = border, xlim = xlim, ylim = ylim, ) - o = UnicodePlots.Plot(x, y, _canvas_map[canvas_type]; kw...) + o = UnicodePlots.Plot(x, y, _canvas_map[canvas]; kw...) for series in series_list(sp) o = addUnicodeSeries!(sp, o, kw, series, sp[:legend_position] != :none) end