Skip to content

Instantly share code, notes, and snippets.

View tiaplagata's full-sized avatar

Tia Plagata tiaplagata

View GitHub Profile
@tiaplagata
tiaplagata / wc_contour.py
Created January 27, 2021 21:21
generates word cloud with contour
# Function to generate word cloud with dark red contour
def generate_better_wordcloud(data, title, mask=None):
cloud = WordCloud(scale=3,
max_words=150,
colormap='RdYlGn',
mask=mask,
background_color='white',
stopwords=stopwords,
collocations=True,
contour_color='#5d0f24',
@tiaplagata
tiaplagata / make_colormap.py
Last active January 28, 2021 14:51
Use mask colors to recolor wordcloud
from wordcloud import ImageColorGenerator
#Create the mask
colosseum_mask = np.array(Image.open('/Users/tiaplagata/Downloads/colosseum.jpg'))
#Grab the mask colors
colors = ImageColorGenerator(colosseum_mask)
#Instantiate the wordcloud using color_func argument
cloud = WordCloud(mask=colosseum_mask,
@tiaplagata
tiaplagata / wc_basic_contour.py
Created January 27, 2021 21:59
generate word cloud with basic contour
# Function to generate word cloud with basic contour
def generate_better_wordcloud(data, title, mask=None):
cloud = WordCloud(scale=3,
max_words=150,
colormap='RdYlGn',
mask=mask,
background_color='white',
stopwords=stopwords,
collocations=True,
contour_color='black',