I read a bunch of tutorials on the correct way to generate the logarithmic distribution of tagcloud weights. Most of them group tags into stages. This seems a little silly for me, so I developed my own algorithm based on what I read so that it dynamically distributes the tag counter along the logarithmic curve between the threshold and maximum. Here's the gist of it in python:
from math import log
count = [1, 3, 5, 4, 7, 5, 10, 6]
def logdist(count, threshold=0, maxsize=1.75, minsize=.75):
countdist = []
mincount = threshold<min(count) and min(count) or threshold
maxcount = max(count)
spread = maxcount - mincount
delta = (maxsize - minsize) / float(spread)
for c in count:
logcount = log(c - (mincount - 1)) * (spread + 1) / log(spread + 1)
size = delta * logcount - (delta - minsize)
countdist.append({'count': c, 'size': round(size, 3)})
return countdist
In principle, without a logarithmic calculation of a separate account, he would create a straight line between the points (mincount, minsize) and (maxcount, maxsize).
, . Mincount - , . , mincount minsize. , , , . mincount "or 1" .
?
3 . , . , y = lnx x = 1, y = 0. , mincount. mincount , 0 .
. mincount , , , . , , -, , .
Apr 6: google , read, , , .
28 . antti.huima: , , . , , , . , - , , . ? , - , ?