Skip to content

Commit 93fc598

Browse files
Merge pull request #4 from soumith/master
fixed a rendering issue for long class-names
2 parents 1704b43 + 99ca75c commit 93fc598

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ConfusionMatrix.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,21 @@ function ConfusionMatrix:render(sortmode, display, block, legendwidth)
197197
win1:setcolor{r=0,g=0,b=0}
198198
win1:rectangle((#render)[2],(i-1)*block,legendwidth,block)
199199
win1:fill()
200+
201+
-- %
202+
win1:setfont(qt.QFont{serif=false, size=fontsize})
203+
local gscale = freqs[order[i]]/freqs:max()*0.9+0.1 --3/4
204+
win1:setcolor{r=gscale*0.5+0.2,g=gscale*0.5+0.2,b=gscale*0.8+0.2}
205+
win1:moveto((#render)[2]+10,i*block-block/3)
206+
win1:show(string.format('[%2.2f%% labels]',math.floor(freqs[order[i]]*10000+0.5)/100))
200207

201208
-- legend
202209
win1:setfont(qt.QFont{serif=false, size=fontsize})
203210
local gscale = diag[order[i]]*0.8+0.2
204211
win1:setcolor{r=gscale,g=gscale,b=gscale}
205-
win1:moveto((#render)[2]+10,i*block-block/3)
212+
win1:moveto(120+(#render)[2]+10,i*block-block/3)
206213
win1:show(classes[order[i]])
207214

208-
-- %
209-
win1:setfont(qt.QFont{serif=false, size=fontsize})
210-
local gscale = freqs[order[i]]/freqs:max()*0.9+0.1 --3/4
211-
win1:setcolor{r=gscale*0.5+0.2,g=gscale*0.5+0.2,b=gscale*0.8+0.2}
212-
win1:moveto(90+(#render)[2]+10,i*block-block/3)
213-
win1:show(string.format('[%2.2f%% labels]',math.floor(freqs[order[i]]*10000+0.5)/100))
214-
215215
for j in ipairs(classes) do
216216
-- scores
217217
local score = confusion[order[j]][order[i]]

0 commit comments

Comments
 (0)