Commit 0eb94e4f authored by Andreas Mueller's avatar Andreas Mueller

fix grey_color_func to use random_state

parent c6d022df
examples/a_new_hope.png

237 KB | W: | H:

examples/a_new_hope.png

250 KB | W: | H:

examples/a_new_hope.png
examples/a_new_hope.png
examples/a_new_hope.png
examples/a_new_hope.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -9,13 +9,14 @@ import numpy as np
from PIL import Image
from os import path
import matplotlib.pyplot as plt
import random
from wordcloud import WordCloud, STOPWORDS
def grey_color_func(word, font_size, position, orientation, random_state=None, **kwargs):
return "hsl(0, 0%%, %d%%)" % random.randint(60, 100)
if random_state is None:
random_state = np.random.RandomState()
return "hsl(0, 0%%, %d%%)" % random_state.randint(60, 100)
d = path.dirname(__file__)
......
......@@ -23,7 +23,6 @@ import numpy as np
from PIL import Image
from os import path
import matplotlib.pyplot as plt
import random
from itertools import tee
from collections import defaultdict
import re
......@@ -53,7 +52,9 @@ def score(bigram, counts, n_words):
def grey_color_func(word, font_size, position, orientation, random_state=None, **kwargs):
return "hsl(0, 0%%, %d%%)" % random.randint(60, 100)
if random_state is None:
random_state = np.random.RandomState()
return "hsl(0, 0%%, %d%%)" % random_state.randint(60, 100)
def pairwise(iterable):
......
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