Skip to content

Commit

Permalink
update example pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yong-zhi committed Mar 27, 2021
1 parent b09a638 commit 3a6586f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WordCloud"
uuid = "6385f0a0-cb03-45b6-9089-4e0acc74b26b"
authors = ["guoyongzhi <[email protected]>"]
version = "0.6.0"
version = "0.6.1"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
10 changes: 7 additions & 3 deletions examples/pattern.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#md# The elements in the output image don't have to be text, and shapes are OK
#md# The [engine](https://github.com/guo-yong-zhi/Stuffing.jl)) is designed for general purpose, so the outputs don't have to be text, and shapes are OK
using WordCloud

sc = WordCloud.randomscheme()
Expand All @@ -12,11 +12,15 @@ wc = wordcloud(
#md# * style arguments like `colors`, `angles` and `density` have no effect
#md#
#md# And, you should manually initialize images for the placeholders, instead of calling `initimages!`

dens = 0.6
sz = 3expm1.(rand(l)) .+ 1
sz ./= (sum* (sz ./ 2).^2 ./ dens) / prod(size(wc.mask))) # set a proper size according to the density
## svg version
#shapes = [shape(ellipse, repeat([floor(20expm1(rand())+5)],2)..., color=rand(sc)) for i in 1:l]
#shapes = [shape(ellipse, round(sz[i]), round(sz[i]), color=rand(sc)) for i in 1:l]
#setsvgimages!(wc, :, shapes)
## bitmap version
shapes = WordCloud.svg2bitmap.([shape(ellipse, repeat([floor(15expm1(rand())+5)],2)..., color=rand(sc)) for i in 1:l])
shapes = WordCloud.svg2bitmap.([shape(ellipse, round(sz[i]), round(sz[i]), color=rand(sc)) for i in 1:l])
setimages!(wc, :, shapes)

setstate!(wc, :initimages!) #set the state flag after manual initialization
Expand Down
2 changes: 1 addition & 1 deletion examples/specifiedstyle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ wc = wordcloud(
setwords!(wc, "Alice", "Alice in Wonderland") # replace the word 'Alice' with 'Alice in Wonderland'
setangles!(wc, "Alice in Wonderland", 0) # make it horizontal
setcolors!(wc, "Alice in Wonderland", "purple");
setfontsizes!(wc, "Alice in Wonderland", 2.1size(wc.mask, 2)/length("Alice in Wonderland")) # set a big font size
setfontsizes!(wc, "Alice in Wonderland", 2.05size(wc.mask, 2)/length("Alice in Wonderland")) # set a big font size
initimage!(wc, "Alice in Wonderland") # init it after adjust it's style
setpositions!(wc, "Alice in Wonderland", reverse(size(wc.mask)) 2, type=setcenter!) # center it

Expand Down

2 comments on commit 3a6586f

@guo-yong-zhi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/32950

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.1 -m "<description of version>" 3a6586f8cd730de3e2f31c0f6271a60be677d197
git push origin v0.6.1

Please sign in to comment.