From d8718232f2c920c7b694514d8be411f88917ef40 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 30 Jul 2007 19:47:15 +0000 Subject: [PATCH] Make module cloud sizes relative to the smallest number that's present, not 0. --- sphinx/web/application.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sphinx/web/application.py b/sphinx/web/application.py index ecb24088c..d6263b229 100644 --- a/sphinx/web/application.py +++ b/sphinx/web/application.py @@ -339,11 +339,13 @@ class DocumentationApplication(object): """ most_frequent = heapq.nlargest(30, self.freqmodules.iteritems(), lambda x: x[1]) - most_frequent = [{ - 'name': x[0], - 'size': 100 + math.log(x[1] or 1) * 20, - 'count': x[1] - } for x in sorted(most_frequent)] + if most_frequent: + base_count = most_frequent[0][1] + most_frequent = [{ + 'name': x[0], + 'size': 100 + math.log((x[1] - base_count) + 1) * 20, + 'count': x[1] + } for x in sorted(most_frequent)] showpf = None newpf = req.args.get('pf')