atizo / PyTagCloud

Create beautiful tag clouds as images or HTML

Home Page:https://labs.atizo.com/software/#pytagcloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Evenly distributed tagset (all counts the same) cause div/0 error in defscale

mindsocket opened this issue · comments

The default scaling function has this expression:
1.0 / (maxcount - mincount)

When maxcount == mincount, things blow up. As a workaround I've used a hacky alternative that avoids this well enough for my needs...

def tagscale(count, mincount, maxcount, minsize, maxsize):
if maxcount == mincount:
return defscale(count, mincount, maxcount + 1, minsize, maxsize)
return defscale(count, mincount, maxcount, minsize, maxsize)

There's probably a better way though

Thanks for the hint. It will be fixed in 0.3.5.