Skip to content

Commit 95785d1

Browse files
committed
Remove UnicodePlots
1 parent 46b0525 commit 95785d1

File tree

4 files changed

+3
-90
lines changed

4 files changed

+3
-90
lines changed

REQUIRE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
julia 0.6
22

3-
UnicodePlots
43
RecipesBase
54
SugarBLAS
65
LinearMaps

src/history.jl

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Base: getindex, setindex!, push!, keys
1+
using RecipesBase
2+
3+
import Base: getindex, setindex!, push!, keys
24

35
export ConvergenceHistory
46
export nprods, niters, nrests
57

6-
using UnicodePlots
7-
88
########
99
# Type #
1010
########
@@ -259,71 +259,6 @@ such objects.
259259
plotable(::VecOrMat{T}) where {T <: Real} = true
260260
plotable(::Any) = false
261261

262-
# inner plots
263-
264-
"""
265-
showplot(ch)
266-
267-
Print all plotable information inside `ConvergenceHistory` `ch`.
268-
"""
269-
function showplot(ch::ConvergenceHistory)
270-
candidates = collect(values(ch.data))
271-
plotables = convert(Vector{Bool},map(plotable, candidates))
272-
n = length(filter(identity, plotables))
273-
n > 0 || return
274-
println("\n")
275-
for (name, draw) in collect(ch.data)[plotables]
276-
restart = isa(ch, UnrestartedHistory) ? ch.iters : ch.restart
277-
drawing = plot_collection(draw, ch.iters, restart; name=string(name))
278-
println("$drawing\n\n")
279-
end
280-
end
281-
282-
"""
283-
plot_collection(x)
284-
285-
Build a `UnicodePlot.Plot` object from the plotable collection `x`.
286-
If `x` is a vector, a series will be made. In case of being a matrix an scatterplot
287-
will be returned.
288-
"""
289-
function plot_collection(vals::Vector{T}, iters::Int, gap::Int;
290-
restarts=Int(ceil(iters/gap)), color::Symbol=:blue, name::AbstractString="",
291-
title::AbstractString="", left::Int=1
292-
) where {T <: Real}
293-
maxy = round(maximum(vals),2)
294-
miny = round(minimum(vals),2)
295-
plot = lineplot([left],[miny],xlim=[left,iters],ylim=[miny,maxy],title=title,name=name)
296-
right = min(left+gap-1,iters)
297-
lineplot!(plot,collect(left:right),vals[left:right],color=color)
298-
for restart in 2:restarts
299-
left+=gap
300-
right = min(left+gap-1,iters)
301-
lineplot!(plot,collect(left:right),vals[left:right],color=color)
302-
lineplot!(plot,[left,left],[miny,maxy], color=:white)
303-
end
304-
plot
305-
end
306-
function plot_collection(vals::Matrix{T}, iters::Int, gap::Int;
307-
restarts=Int(ceil(iters/gap)), color::Symbol=:blue, name::AbstractString="",
308-
title::AbstractString="", left::Int=1
309-
) where {T <: Real}
310-
n = size(vals,2)
311-
maxy = round(maximum(vals),2)
312-
miny = round(minimum(vals),2)
313-
plot = scatterplot([left],[miny],xlim=[left,iters],ylim=[miny,maxy],title=title,name=name)
314-
for i in left:iters
315-
scatterplot!(plot,[i for j in 1:n],vec(vals[i,1:n]),color=color)
316-
end
317-
for restart in 2:restarts
318-
left+=gap
319-
lineplot!(plot,[left,left],[miny,maxy], color=:white)
320-
end
321-
plot
322-
end
323-
324-
## Recipes (See Plots.jl tutorial on recipes)
325-
326-
using RecipesBase
327262

328263
# Plot entire ConvergenceHistory. `sep` is the color of the restart separator.
329264
@recipe function chef(ch::CompleteHistory; sep = :white)

test/REQUIRE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
Plots
2-
UnicodePlots
31
LinearMaps

test/history.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
using IterativeSolvers
2-
using Plots
32

4-
#Just check it doesn't crash
53
@testset "ConvergenceHistory" begin
64

7-
srand(1234321)
8-
9-
#Use UnicodePlots backend because it is the lightest
10-
unicodeplots()
11-
12-
A = lu(rand(10, 10))[1]
13-
b = rand(10)
14-
15-
for solver in (cg, gmres, minres, lsqr, lsmr, idrs)
16-
plot(solver(A, b; log=true)[2])
17-
end
18-
19-
plot(bicgstabl(A, b, 2, log=true)[2])
20-
plot(chebyshev(A, b, 0.5, 1.5; log=true)[2])
21-
plot(powm(A; log=true)[2])
22-
plot(invpowm(A; log=true)[2])
23-
plot(svdl(A; log=true)[3])
245
end

0 commit comments

Comments
 (0)