I am just studying Python and word cloud. But my picture is with low resolution. For example, the sample data is:
import os
import math
from PIL import Image
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator, get_single_color_func
a3='Python Python Python Matplotlib Matplotlib Seaborn Network Plot Violin Chart Pandas Datascience Wordcloud Spider Radar Parrallel Alpha Color Brewer Density Scatter Barplot Barplot Boxplot Violinplot Treemap Stacked Area Chart Chart Visualization Dataviz Donut Pie Time-Series Wordcloud Wordcloud Sankey Bubble'
and my code is:
building = np.array(Image.open("C://******/house.png"))
wordcloud = WordCloud(background_color="GhostWhite",width=800, height=800, margin=2,collocations=False,
mask=building,font_step=2).generate(a3)
plt.figure(figsize=(10,7), facecolor='k')
plt.imshow(wordcloud)
plt.axis("off")
plt.tight_layout(pad=0)
plt.show()
Here is the house picture I use in my code:
Then, here is my result:
You can see the resolution is pretty low. Actually, this is just a small sample data. When I use my real data, I have a picture that is much worse than this.
How can I improve the resolution?
According to my observation, you have to increase width=800, height=800
and
plt.figure(figsize = (16,9))
for 2k resolution or you can increase it.