python3 2 和 Python 3 有哪些主要区别
番茄系统家园 · 2021-07-19 01:25:49

*附上源文件中对这一函数的各个参数的解释
----------
(),()(default200)Heightofthecanvas.prefer_horizontal:float(default0.90)Theratiooftimestotryhorizontalfittingasopposedtovertical.Ifprefer_horizontal1,thealgorithmwilltryrotatingthewordifitdoesntfit.(Thereiscurrentlynobuilt-inwaytogetonlyverticalwords.)mask:nd-arrayorNone(defaultNone)IfnotNone,givesabinarymaskonwheretodrawwords.IfmaskisnotNone,widthandheightwillbeignoredandtheshapeofmaskwillbeusedinstead.Allwhite(#FFor#FFFFFF)entrieswillbeconsiderdmaskedoutwhileotherentrieswillbefreetodrawon.[Thischangedinthemostrecentversion!]scale:float(default1)Scalingbetweencomputationanddrawing.Forlargeword-cloudimages,usingscaleinsteadoflargercanvassizeissignificantlyfaster,butmightleadtoacoarserfitforthewords.min_font_size:int(default4)Smallestfontsizetouse.Willstopwhenthereisnomoreroominthissize.font_step:int(default1)Stepsizeforthefont.font_step1mightspeedupcomputationbutgiveaworsefit.max_words:number(default200)Themaximumnumberofwords.stopwords:setofstringsorNoneThewordsthatwillbeeliminated.IfNone,thebuild-inSTOPWORDSlistwillbeused.background_color:colorvalue(defaultblack)Backgroundcolorforthewordcloudimage.max_font_size:intorNone(defaultNone)Maximumfontsizeforthelargestword.IfNone,heightoftheimageisused.mode:string(defaultRGB)TransparentbackgroundwillbegeneratedwhenmodeisRGBAandbackground_colorisNone.relative_scaling:float(default.5)Importanceofrelativewordfrequenciesforfont-size.Withrelative_scaling0,onlyword-ranksareconsidered.Withrelative_scaling1,awordthatistwiceasfrequentwillhavetwicethesize.Ifyouwanttoconsiderthewordfrequenciesandnotonlytheirrank,relative_scalingaround.5oftenlooksgood...versionchanged:2.0Defaultisnow0.5.color_func:callable,defaultNoneCallablewithparametersword,font_size,position,orientation,font_path,random_statethatreturnsaPILcolorforeachword.Overwritescolormap.Seecolormapforspecifyingamatplotlibcolormapinstead.regexp:stringorNone(optional)Regularexpressiontosplittheinputtextintotokensinprocess_text.IfNoneisspecified,r\w[\w]isused.collocations:bool,defaultTrueWhethertoincludecollocations(bigrams)oftwowords...versionadded:2.0colormap:stringormatplotlibcolormap,defaultviridisMatplotlibcolormaptorandomlydrawcolorsfromforeachword.Ignoredifcolor_funcisspecified...versionadded:2.0normalize_plurals:bool,defaultTrueWhethertoremovetrailingsfromwords.IfTrueandawordappearswithandwithoutatrailings,theonewithtrailingsisremovedanditscountsareaddedtotheversionwithouttrailings--unlessthewordendswithss.Attributes----------words_:dictofstringtofloatWordtokenswithassociatedfrequency...versionchanged:2.0words_isnowadictionarylayout_:listoftuples(string,int,(int,int),int,color))Encodesthefittedwordcloud.Encodesforeachwordthestring,fontsize,position,orientationandcolor.Notes-----Largercanvaseswithmakethecodesignificantlyslower.Ifyouneedalargewordcloud,tryalowercanvassize,andsetthescaleparameter.Thealgorithmmightgivemoreweighttotherankingofthewordsthantheiractualfrequencies,dependingonthemax_font_sizeandthescalingheuristic.
https://github.com/amueller/word_cloud/
zhuan:http://blog.csdn.net/heyuexianzi/article/details/76851377?locationNum6fps1
免责声明: 凡标注转载/编译字样内容并非本站原创,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责。如果你觉得本文好,欢迎推荐给朋友阅读;本文链接: https://m.nndssk.com/post/15178.html。

