unicodeplots size fix

This commit is contained in:
Thomas Breloff 2016-07-22 09:43:43 -04:00
parent b6fa4bcda4
commit 7a650d918b

View File

@ -38,7 +38,7 @@ end
# do all the magic here... build it all at once, since we need to know about all the series at the very beginning # 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) function rebuildUnicodePlot!(plt::Plot, width, height)
plt.o = [] plt.o = []
for sp in plt.subplots for sp in plt.subplots
@ -57,7 +57,6 @@ function rebuildUnicodePlot!(plt::Plot)
y = Float64[ylim[1]] y = Float64[ylim[1]]
# create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds # create a plot window with xlim/ylim set, but the X/Y vectors are outside the bounds
width, height = plt[:size]
canvas_type = isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas canvas_type = isijulia() ? UnicodePlots.AsciiCanvas : UnicodePlots.BrailleCanvas
o = UnicodePlots.Plot(x, y, canvas_type; o = UnicodePlots.Plot(x, y, canvas_type;
width = width, width = width,
@ -143,20 +142,21 @@ end
# we don't do very much for subplots... just stack them vertically # we don't do very much for subplots... just stack them vertically
function _update_plot_object(plt::Plot{UnicodePlotsBackend}) function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
w, h = plt[:size] w, h = plt[:size]
plt.attr[:size] = div(w, 10), div(h, 20)
plt.attr[:color_palette] = [RGB(0,0,0)] plt.attr[:color_palette] = [RGB(0,0,0)]
rebuildUnicodePlot!(plt) rebuildUnicodePlot!(plt, div(w, 10), div(h, 20))
end end
function _writemime(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend}) function _writemime(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
unicodeplots_rebuild(plt)
map(show, plt.o) map(show, plt.o)
nothing nothing
end end
function _display(plt::Plot{UnicodePlotsBackend}) function _display(plt::Plot{UnicodePlotsBackend})
unicodeplots_rebuild(plt)
map(show, plt.o) map(show, plt.o)
nothing nothing
end end