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
d9206a41
Commit
d9206a41
authored
Apr 29, 2015
by
Andreas Mueller
Browse files
pass word, not word frequency to color_func in recolor.
parent
eaea49cb
Changes
2
Show whitespace changes
Inline
Side-by-side
wordcloud/color_from_image.py
View file @
d9206a41
...
@@ -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
...
...
wordcloud/wordcloud.py
View file @
d9206a41
...
@@ -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
):
...
...
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