Guest User

Untitled

a guest
Mar 11th, 2020
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2.  
  3. from wordcloud import WordCloud
  4. import matplotlib.pyplot as plt
  5.  
  6. filename = 'chapters.html'
  7. with open(filename) as f:
  8. text = f.read()
  9.  
  10. image = WordCloud(width=1920, height=1080, max_font_size=120, colormap='Spectral').generate(text)
  11. image.to_file('/tmp/wordcloud.png')
  12. plt.imshow(image, interpolation='bilinear')
  13. plt.axis('off')
  14. plt.show()
RAW Paste Data