# \[ANN\] WordCloud.jl - a word cloud generator in julia

**URL:** https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587
**Category:** Package Announcements
**Tags:** package, announcement, graphics, visualization
**Created:** [January 19, 2021, 7:31am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587 "2021-01-19T07:31:26Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [January 19, 2021, 7:31am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/1 "2021-01-19T07:31:26Z")

</div>

Hi, I’m very happy to announce my first julia package [**WordCloud.jl**](https://github.com/guo-yong-zhi/WordCloud) here. [Word cloud](https://en.wikipedia.org/wiki/Tag_cloud) (tag cloud or wordle) is a novelty visual representation of text data. The importance of each word is shown with font size or color. **WordCloud.jl** has the following highlights:

- **Flexible** Any mask, any color, any angle, adjustable filling rate. You can specify the initial position of some words. Or you can pin some words and adjust others, etc.
- **Fast** 100% in Julia and efficient implementation based on Quadtree & gradient optimization. The advantage is more obvious when generating large images.
- **Exact** Words with the same weight have the exact same size. The algorithm will never scale the word to fit the blank.

# A example

```julia
using WordCloud
wc = wordcloud(
    process(open(pkgdir(WordCloud)*"/res/alice.txt"), stopwords=WordCloud.stopwords_en ∪ ["said"]), 
    mask = loadmask(pkgdir(WordCloud)*"/res/alice_mask.png", color="#faeef8"),
    colors = :Set1_5,
    angles = (0, 90),
    fillingrate = 0.7) |> generate!
paint(wc, "alice.png", ratio=0.5, background=outline(wc.mask, color="purple", linewidth=1))

```

 ![alice](https://global.discourse-cdn.com/julialang/original/3X/e/9/e9fbf242d03d95dcce3c65acb059c0208fc8f7a5.png)

You can install **WordCloud.jl** with command `import Pkg; Pkg.add("WordCloud")`, and see `showexample` and `runexample` for more examples.

I am looking forward to your valuable suggestions. Thank you.

---

<div class="post-metadata">

### Author: ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)
#### Post date: [January 19, 2021, 7:52am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/2 "2021-01-19T07:52:01Z")

</div>

Beautiful

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [January 19, 2021, 7:59am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/3 "2021-01-19T07:59:35Z")

</div>

![guxiang](https://global.discourse-cdn.com/julialang/original/3X/f/6/f6a7542686d7c6db76e67b5f1e3c8bbc7e5f4765.gif)  
Aha, I can reply to bypass the limit of one image.

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [January 19, 2021, 8:00am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/4 "2021-01-19T08:00:11Z")

</div>

![specifystyle](https://global.discourse-cdn.com/julialang/original/3X/0/5/056ebda33bcb55a95cc8aa586ea2dbf13c261bbd.jpeg)

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [January 19, 2021, 11:15am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/5 "2021-01-19T11:15:43Z")

</div>

Really cool! 🎉 The fact that it is 100% Julia is awesome :julia: 😉

---

<div class="post-metadata">

### Author: ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)
#### Post date: [January 19, 2021, 11:19am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/6 "2021-01-19T11:19:22Z")

</div>

Is there a way to export SVGs, ideally with clickable links?

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [January 19, 2021, 1:03pm UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/7 "2021-01-19T13:03:08Z")

</div>

Not yet, but relevant information can be obtained through `getposition(wc)`, `getangle(wc)`, `getweight(wc)` and `getword(wc)` 🙂

---

<div class="post-metadata">

### Author: ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)
#### Post date: [January 19, 2021, 1:10pm UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/8 "2021-01-19T13:10:24Z")

</div>

Haha what a nice coincidence! I was just looking for a tool to make a word cloud for a presentation I will give in two weeks, and this is a nice timely surprise!

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [January 19, 2021, 1:21pm UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/9 "2021-01-19T13:21:36Z")

</div>

Ha ha, I hope it can help you 😆

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [February 1, 2021, 9:41am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/10 "2021-02-01T09:41:37Z")

</div>

SVG exporting is supported at [v0.4.0](https://github.com/guo-yong-zhi/WordCloud/tree/v0.4.0)✌ You just need to `paint(wc, "filename.svg")` or `paintsvg(wc)`. While, this feature depends on [Luxor v2.8.0](https://github.com/JuliaGraphics/Luxor.jl) which may be released after Julia 1.6. Therefore, it’s not currently available via Pkg’s update.

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [February 1, 2021, 11:36am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/11 "2021-02-01T11:36:00Z")

</div>

[https://github.com/JuliaGraphics/Luxor.jl/issues/140](https://github.com/JuliaGraphics/Luxor.jl/issues/140)

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [February 2, 2021, 6:43am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/12 "2021-02-02T06:43:02Z")

</div>

I’m looking forward to it. Thank you for your great work.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 2, 2021, 9:31am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/13 "2021-02-02T09:31:22Z")

</div>

Very good stuff. Would it be possible for someone to generate a word cloud for the Julia discourse repository?

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [February 2, 2021, 9:54am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/14 "2021-02-02T09:54:38Z")

</div>

We need `.txt` or `.html` files as inputs. Running _`showexample(:juliadoc)`_ in v0.4.0 can show the way to generate word cloud from julia’s html docs. Moreover, _`showexample(:fromweb)`_ shows a example that generates a word cloud from online web page.

---

<div class="post-metadata">

### Author: ![Wind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wind/32/25959_2.png) [@Wind](https://discourse.julialang.org/u/Wind)
#### Post date: [June 11, 2021, 3:14am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/15 "2021-06-11T03:14:10Z")

</div>

Awesome Julia! I think this generator is more powerful than many other popular generators in other language ecosystems. Isn’t it?

---

<div class="post-metadata">

### Author: ![mantzaris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mantzaris/32/3852_2.png) [@mantzaris](https://discourse.julialang.org/u/mantzaris)
#### Post date: [July 6, 2021, 9:58pm UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/17 "2021-07-06T21:58:18Z")

</div>

I have been using it and the functionality is great, wish there were some docs for it though as it appears there are quite a few options to choose from.

@guoyongzhi Thanks for the library, been using it and it is great! For the example in [GitHub - guo-yong-zhi/WordCloud-Gallery: A Gallery for WordCloud.jl](https://github.com/guo-yong-zhi/WordCloud-Gallery#pattern) I get an error ```UndefVarError: randommaskcolor not defined

```nohighlight

```

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [July 7, 2021, 8:22am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/18 "2021-07-07T08:22:34Z")

</div>

I updated the gallery before the releasing of the new version of the WordCloud.jl itself, which led to some inconsistencies. I apologize for that. It should work fine now with the [WordCloud.jl v0.7.0](https://github.com/guo-yong-zhi/WordCloud.jl). Please update it.  
As for the documentation, it’s a bit hard for a non-native English speaker like me. I am help wanted.  
p.s. There used to be an auto-generated docstrings in the [Julia Hub](https://juliahub.com/docs/WordCloud/), but it gone later, leaving only Readme. I don’t know why.

---

<div class="post-metadata">

### Author: ![Wind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wind/32/25959_2.png) [@Wind](https://discourse.julialang.org/u/Wind)
#### Post date: [March 28, 2022, 5:11am UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/19 "2022-03-28T05:11:51Z")

</div>

I tried [the online generator](https://mybinder.org/v2/gh/guo-yong-zhi/pluto-on-jupyterlab/HEAD?urlpath=pluto/open?url=https%3A%2F%2Fraw.githubusercontent.com%2Fguo-yong-zhi%2FWordCloud.jl%2Fmaster%2Fplutoapp.jl) in the repo’s README, but got a mystic pattern like bellow. How should I use it correctly?

 ![cloud](https://global.discourse-cdn.com/julialang/original/3X/7/7/77a76a7ac1c0cf90e434bccfd11235043691e5e1.jpeg)

---

<div class="post-metadata">

### Author: ![guoyongzhi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guoyongzhi/32/28306_2.png) [@guoyongzhi](https://discourse.julialang.org/u/guoyongzhi)
#### Post date: [April 6, 2022, 2:34pm UTC](https://discourse.julialang.org/t/ann-wordcloud-jl-a-word-cloud-generator-in-julia/53587/20 "2022-04-06T14:34:06Z")

</div>

I don’t know why `Pango` choose that odd font when the random set font is unavailable. You can set a proper font in the `fonts` textbox or just set it to empty.
