How to fit/scale a word-cloud to a graph?

Viewed 33

After running the code below I have that the produced wordcloud is considerably smaller in relationship to the whole graph. I attach a picture. How can I make it fit or in other words, cancel the white borders around the cloud? Thanks !

> set.seed(100)
> 
> png(file=paste( path to save file)) 
> 
> textplot_wordcloud(dfm_inaug, rotation = 0.0, min_size = 0.5, max_size
> = 3, color = c("skyblue3",  "darkblue"))
> 
> dev.off()

enter image description here

1 Answers

You could probably input the picture into PIL (python image library) and use the .crop() function to crop the white border.

from PIL import Image
with Image.open("yourpicture.jpg") as im:
    (left, upper, right, lower) = (20, 20, 100, 100)
    im_crop = im.crop((left, upper, right, lower))

However, you would also need to move the image into a python editor.

If it doesn't work, you could try different functions under the Image module.

Related