In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article "python how to generate a specific shape of the word cloud" most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "python how to generate a specific shape of the word cloud" article bar.
How did the beautiful and elegant Princess Cinderella come into being?
The above word cloud effect uses the imageio library.
Imageio means image input&output, and the library mainly provides the function of reading and writing picture data.
Implementation steps of shape-specific word cloud:
1. Use the imageio.imread function to import word cloud shape images:
It should be noted that the picture as the shape of the word cloud needs to have a white background, and any noise may not be recognized by the system. You can use matting software to manually adjust the background of the picture.
It is recommended that beginners use white background pictures with sharp color contrast and clear outline to try.
Import imageio
Mk = imageio.imread ("Picture File path and name")
2. Set the image parameters in the word cloud:
Cloud = wordcloud.WordCloud (
Mask = mk
Contour_width=1
Contour_color='white'
Scale = 15)
Parameter mask is the image imported in step 1.
The parameter scale is used to set the sharpness of the image effect. The higher the scale value, the higher the definition, and the longer the running time. When making shaped word clouds, a certain degree of clarity can make the effect better.
The parameters contour_width and contour_color are the boundary lines that set the shape of the word cloud to outline. The viewing degree of the effect varies with the picture, if there is no special need, do not use these two parameters.
The above is the content of this article on "how python generates word clouds with specific shapes". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.