Skip to content

Commit

Permalink
Correct totalwidth to include the bigger first column width
Browse files Browse the repository at this point in the history
  • Loading branch information
Roeya committed Aug 14, 2023
1 parent 9ad78a3 commit 8a182dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/measures/confusion_matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ splitw(w::Int) = (sp1 = div(w, 2); sp2 = w - sp1; (sp1, sp2))

function Base.show(stream::IO, m::MIME"text/plain", cm::ConfusionMatrixObject{C}
) where C
mincw = ceil(Int, 12/C)
width = displaysize(stream)[2]
mincw = ceil(Int, 12/C)
cw = max(length(string(maximum(cm.mat))),maximum(length.(cm.labels)),mincw)
firstcw = max(length(string(maximum(cm.mat))),maximum(length.(cm.labels)),9)
textlim = 9
totalwidth = cw * (C+1) + C + 2
totalwidth = firstcw + cw * C + C + 2
width < totalwidth && (show(stream, m, cm.mat); return)

iob = IOBuffer()
Expand Down

0 comments on commit 8a182dc

Please sign in to comment.