add width and height

This commit is contained in:
t-bltg 2021-12-30 17:01:02 +01:00
parent e0beaaac28
commit a05bc80a1b
2 changed files with 12 additions and 8 deletions

View File

@ -970,8 +970,10 @@ const _unicodeplots_marker = [
const _unicodeplots_scale = [:identity, :ln, :log2, :log10] const _unicodeplots_scale = [:identity, :ln, :log2, :log10]
# Additional constants # Additional constants
const _canvas_type = Ref(:auto) const _unicodeplots_canvas = Ref(:auto)
const _border_type = Ref(:auto) const _unicodeplots_border = Ref(:auto)
const _unicodeplots_width = Ref(40)
const _unicodeplots_height = Ref(15)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# hdf5 # hdf5

View File

@ -34,16 +34,16 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
# create a plot window with xlim/ylim set, # create a plot window with xlim/ylim set,
# but the X/Y vectors are outside the bounds # 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 isijulia() ? :ascii : :braille
else else
ct up_c
end end
border_type = if (bt = _border_type[]) == :auto border = if (up_b = _unicodeplots_border[]) == :auto
isijulia() ? :ascii : :solid isijulia() ? :ascii : :solid
else else
bt up_b
end end
kw = ( kw = (
@ -51,14 +51,16 @@ function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
title = texmath2unicode(sp[:title]), title = texmath2unicode(sp[:title]),
xlabel = texmath2unicode(xaxis[:guide]), xlabel = texmath2unicode(xaxis[:guide]),
ylabel = texmath2unicode(yaxis[:guide]), ylabel = texmath2unicode(yaxis[:guide]),
width = _unicodeplots_width[],
height = _unicodeplots_height[],
xscale = xaxis[:scale], xscale = xaxis[:scale],
yscale = yaxis[:scale], yscale = yaxis[:scale],
border = border_type, border = border,
xlim = xlim, xlim = xlim,
ylim = ylim, 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) for series in series_list(sp)
o = addUnicodeSeries!(sp, o, kw, series, sp[:legend_position] != :none) o = addUnicodeSeries!(sp, o, kw, series, sp[:legend_position] != :none)
end end