-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guoyongzhi
committed
Jan 18, 2021
1 parent
3832973
commit ea43e10
Showing
13 changed files
with
214 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.ipynb_checkpoints | ||
.vscode | ||
*.cov | ||
res/*/* | ||
address_compare | ||
guxiang_animation | ||
guxiang_animation | ||
/*.png | ||
test/*.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
using WordCloud | ||
wc = wordcloud( | ||
process(open(pkgdir(WordCloud)*"/res/alice.txt"), stopwords=WordCloud.stopwords_en ∪ ["said"], maxweight=1, maxnum=200), | ||
process(open("res/alice.txt"), stopwords=WordCloud.stopwords_en ∪ ["said"], maxweight=1, maxnum=300), | ||
mask = padding(shape(ellipse, 600, 500, color=(0.98, 0.97, 0.99), bgcolor=0.97), 0.1), | ||
colors = (WordCloud.colorschemes[:seaborn_dark].colors..., ), | ||
colors = :seaborn_dark, | ||
angles = -90:90, | ||
run=x->x, #turn off the useless initword! and placement! in advance | ||
) | ||
|
||
setangle!(wc, "Alice", 0) | ||
setcolor!(wc, "Alice", "purple"); | ||
initword!(wc, "Alice", 2size(wc.mask, 2)/length("Alice")) | ||
setposition!(wc, "Alice", reverse((size(wc.mask) .- size(getimage(wc, "Alice"))) .÷ 2)) | ||
setword!(wc, "Alice", "Alice in Wonderland") # replace the word 'Alice' with 'Alice in Wonderland' | ||
setangle!(wc, "Alice in Wonderland", 0) # make it horizontal | ||
setcolor!(wc, "Alice in Wonderland", "purple"); | ||
initword!(wc, "Alice in Wonderland", 2size(wc.mask, 2)/length("Alice in Wonderland")) # set a big font size | ||
setposition!(wc, 1, reverse(size(wc.mask)) .÷ 2, type=setcenter!) # center it | ||
|
||
pin(wc, "Alice") do | ||
initword!(wc) | ||
pin(wc, "Alice in Wonderland") do | ||
initword!(wc) #init inside `pin` to reset the size of other words | ||
generate!(wc) | ||
end | ||
|
||
println("save results to specifystyle.png") | ||
paint(wc, "specifystyle.png") | ||
wc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.