I'm trying to create a word cloud based on a string and then importing it into a report document. I am using python-docx, matplotlib, and word cloud. This is a brief summary of my
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from docx import Document
from docx.shared import Inches
document = Document()
document.add_heading("Auto Generated Report")
text = "kd sa gf sdf gd python auomation get set python dfs aslkdf asdfij fdifh fdosfj dsfoj "
cloud = WordCloud().generate(text)
plt.title('Summarization of responses on possible improvements of CS course.')
plt.savefig('N.png')
document.add_picture('N.png', width=Inches(5))
document.save("Report")
However, instead of displaying a word cloud, the report just shows a blank graph.
Supplemental to @Andy's answer, cloud.to_file('N.png')
is how you save the word cloud image into your local disk so that you can import later. You can find a good reference here.