Feel the logo does not give force? Python 10 minutes to create your own personal logo

Source: Internet
Author: User

Welcome to subscribe to the public number: Python from the program Ape to the programmer

The use of Word clouds believe that we are not unfamiliar with the use of simple, direct call wordcloud to the package on it. Its main function is based on the text vocabulary and vocabulary frequency generation of images, which can be intuitively see the proportion of each vocabulary. Recently just want to be a person's logo, and decided to use the word cloud to make the completion.

With PIP installation you will definitely encounter a pit that may error during installation, prompting you to install Microsoft Visual C + + 14.0, but this installation process is time-consuming.

There is another way to solve this is to download the appropriate whl file installation.

After the file is downloaded, cmd enters the whl folder where the file is located, and then enter the following command:

Wordcloud Code Usage

Once the installation is successful, we'll start making our pictures.

Above text content is collected by crawlers, crawling of data science of an article, with the text source ready you want to create a word cloud image on the line. Encountered do not know can add: 49130.8659, Code: Cauchy, Code: Cauchy. Live Learning Platform

wordcloudthe parameters that are configured are especially important for picture effects, so let wordcloud 's focus on the meaning of the parameters:

  • font_path:string Font path, you need to show what font to put the font path + suffix name, such as: Font_path = ' blackbody. TTF '

  • width:int (default=400) output canvas width, default is 400 pixels

  • height:int (default=200) output canvas height, default to 200 pixels

  • prefer_horizontal:float (default=0.90) the frequency of horizontal typesetting of words, default 0.9

  • Mask:nd-array or None (default=none) If the argument is empty, the word cloud is drawn normally. If mask is not empty, the set width height value is ignored and the shape is replaced by mask. The portions except White will not be drawn and the remainder will be used to draw the word cloud.

  • scale:float (default=1) enlarges the canvas proportionally, as set to 2, which is twice times the length and width of the original canvas.

  • min_font_size:int (default=4) the smallest font size displayed

  • font_step:int (default=1) font step, if the step is greater than 1, will speed up the operation but may result in a large error.

  • Max_words:number (default=200) The maximum number of words to display

  • Stopwords:set of strings or None sets the words that need to be masked, and if empty, uses the built-in stopwords

  • Background_color:color value (default= "Black") background color, such as background_color= ' white ', and the background color of the black.

  • Max_font_size:int or None (default=none) displays the maximum font size

  • mode:string (default= "RGB") when the parameter is "RGBA" and the Background_color is not empty, the background is transparent.

  • relative_scaling:float (default=.5) the correlation between word frequency and font size

  • color_func:callable, Default=none a function that generates a new color, and if it is empty, uses Self.color_func

  • regexp:string or None (optional) uses regular expressions to separate input text

  • Collocations:bool, whether the default=true includes two words to match

  • colormap:string or Matplotlib colormap, default= "viridis" randomly assigns a color to each word, and if you specify Color_func, the method is ignored.

Effect Show



Feel the logo does not give force? Python 10 minutes to create your own personal logo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.