Commit d9206a41 authored by Andreas Mueller's avatar Andreas Mueller
Browse files

pass word, not word frequency to color_func in recolor.

parent eaea49cb
...@@ -19,7 +19,7 @@ class ImageColorGenerator(object): ...@@ -19,7 +19,7 @@ class ImageColorGenerator(object):
transposed_font = ImageFont.TransposedFont(font, transposed_font = ImageFont.TransposedFont(font,
orientation=orientation) orientation=orientation)
# get size of resulting text # get size of resulting text
box_size = transposed_font.getsize(word[0]) box_size = transposed_font.getsize(word)
x = position[0] x = position[0]
y = position[1] y = position[1]
# cut out patch under word box # cut out patch under word box
......
...@@ -411,11 +411,11 @@ class WordCloud(object): ...@@ -411,11 +411,11 @@ class WordCloud(object):
if color_func is None: if color_func is None:
color_func = self.color_func color_func = self.color_func
self.layout_ = [(word, font_size, position, orientation, self.layout_ = [(word_freq, font_size, position, orientation,
color_func(word=word, font_size=font_size, color_func(word=word_freq[0], font_size=font_size,
position=position, orientation=orientation, position=position, orientation=orientation,
random_state=random_state, font_path=self.font_path)) random_state=random_state, font_path=self.font_path))
for word, font_size, position, orientation, _ in self.layout_] for word_freq, font_size, position, orientation, _ in self.layout_]
return self return self
def to_file(self, filename): def to_file(self, filename):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment