wc object not updating width and height if using mask
Author: XuniusCreated Dec 8, 2016Updated May 24, 2026
LabelsFeature Request
Hi amueller, Thanks for the hard work. I was playing around with mask and re-coloring, and noticed that if I want to resize my coloring image to the same size as the generated text image, I had to query the mask's size rather than the wc object, e.g.
wc = WordCloud(background_color="white", max_words=2000, mask=alice_mask,
stopwords=stopwords,width=width,height=height,random_state=100)
wc.generate(text)
newshape=wc.mask.shapeAs stated in the API doc, width and height are ignored in the constructor if mask is given, but if I supply them, they will be stored in the wc obj. So I wonder will it be better to update these 2 properties in the constructor?
Source: amueller/word_cloud