Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
keeleliin
word_cloud_est
Commits
4fc252d9
Commit
4fc252d9
authored
Mar 16, 2017
by
Andreas Mueller
Committed by
GitHub
Mar 16, 2017
Browse files
Merge pull request #199 from amueller/relative_scaling_integer
fix relative_scaling=0 issue
parents
33b97e19
e597daa7
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/test_wordcloud.py
View file @
4fc252d9
...
...
@@ -230,3 +230,9 @@ def test_generate_from_frequencies():
result
=
wc
.
generate_from_frequencies
(
words
)
assert_true
(
isinstance
(
result
,
WordCloud
))
def
test_relative_scaling_zero
():
# non-regression test for non-integer font size
wc
=
WordCloud
(
relative_scaling
=
0
)
wc
.
generate
(
THIS
)
wordcloud/wordcloud.py
View file @
4fc252d9
...
...
@@ -407,7 +407,7 @@ class WordCloud(object):
max_font_size
=
self
.
height
)
# find font sizes
sizes
=
[
x
[
1
]
for
x
in
self
.
layout_
]
font_size
=
2
*
sizes
[
0
]
*
sizes
[
1
]
/
(
sizes
[
0
]
+
sizes
[
1
])
font_size
=
int
(
2
*
sizes
[
0
]
*
sizes
[
1
]
/
(
sizes
[
0
]
+
sizes
[
1
])
)
else
:
font_size
=
max_font_size
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment