UnicodePlots: rm forced width/height (arbitrary)
This commit is contained in:
parent
7b77527f80
commit
cc1f662b3a
@ -17,8 +17,8 @@ _canvas_map() = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 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{UnicodePlotsBackend}, width, height)
|
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
||||||
plt.o = []
|
plt.o = UnicodePlots.Plot[]
|
||||||
|
|
||||||
for sp in plt.subplots
|
for sp in plt.subplots
|
||||||
xaxis = sp[:xaxis]
|
xaxis = sp[:xaxis]
|
||||||
@ -47,8 +47,6 @@ function rebuildUnicodePlot!(plt::Plot{UnicodePlotsBackend}, width, height)
|
|||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
canvas_type;
|
canvas_type;
|
||||||
width = width,
|
|
||||||
height = height,
|
|
||||||
title = sp[:title],
|
title = sp[:title],
|
||||||
xlim = xlim,
|
xlim = xlim,
|
||||||
ylim = ylim,
|
ylim = ylim,
|
||||||
@ -61,8 +59,7 @@ function rebuildUnicodePlot!(plt::Plot{UnicodePlotsBackend}, width, height)
|
|||||||
o = addUnicodeSeries!(sp, o, series, sp[:legend] != :none, xlim, ylim)
|
o = addUnicodeSeries!(sp, o, series, sp[:legend] != :none, xlim, ylim)
|
||||||
end
|
end
|
||||||
|
|
||||||
# save the object
|
push!(plt.o, o) # save the object
|
||||||
push!(plt.o, o)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -147,7 +144,7 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
|||||||
|
|
||||||
# BEGIN HACK
|
# BEGIN HACK
|
||||||
|
|
||||||
# wait while the plot gets drawndisplay
|
# wait while the plot gets drawn
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
|
|
||||||
# use osx screen capture when my terminal is maximized and cursor starts at the bottom (I know, right?)
|
# use osx screen capture when my terminal is maximized and cursor starts at the bottom (I know, right?)
|
||||||
@ -159,7 +156,6 @@ function png(plt::Plot{UnicodePlotsBackend}, fn::AbstractString)
|
|||||||
elseif Sys.islinux()
|
elseif Sys.islinux()
|
||||||
run(`clear`)
|
run(`clear`)
|
||||||
gui(plt)
|
gui(plt)
|
||||||
println()
|
|
||||||
run(`import -window $(ENV["WINDOWID"]) $fn`)
|
run(`import -window $(ENV["WINDOWID"]) $fn`)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -171,14 +167,6 @@ end
|
|||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
# we don't do very much for subplots... just stack them vertically
|
|
||||||
|
|
||||||
function unicodeplots_rebuild(plt::Plot{UnicodePlotsBackend})
|
|
||||||
w, h = plt[:size]
|
|
||||||
plt.attr[:color_palette] = [RGB(0, 0, 0)]
|
|
||||||
rebuildUnicodePlot!(plt, div(w, 10), div(h, 20))
|
|
||||||
end
|
|
||||||
|
|
||||||
function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
||||||
unicodeplots_rebuild(plt)
|
unicodeplots_rebuild(plt)
|
||||||
foreach(x -> show(io, x), plt.o)
|
foreach(x -> show(io, x), plt.o)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user