dimanche 25 mai 2014

python - création d'un wordcloud avec matplotlib - Stack Overflow


Im trying to create a wordcloud with Matplotlib. Essentially I am able to put text at arbitrary locations in my grid, but need to work out a way of preventing them from colliding. In relation to this I am stuck on two questions:



  1. What is the unit of fontsize?


  2. How do I transfer the "fontsize" of the text to units in my figure, so I can mark them as used? That is, how do I know how much space each letter will take up in my grid? Ideally I would not have to mark out a whole rectangle around each word, but only the pixels they actually use as available for other words.





I'm not sure about how to do it with matplotlib but I have used this in the past: http://peekaboo-vision.blogspot.co.uk/2012/11/a-wordcloud-in-python.html



Im trying to create a wordcloud with Matplotlib. Essentially I am able to put text at arbitrary locations in my grid, but need to work out a way of preventing them from colliding. In relation to this I am stuck on two questions:



  1. What is the unit of fontsize?


  2. How do I transfer the "fontsize" of the text to units in my figure, so I can mark them as used? That is, how do I know how much space each letter will take up in my grid? Ideally I would not have to mark out a whole rectangle around each word, but only the pixels they actually use as available for other words.




I'm not sure about how to do it with matplotlib but I have used this in the past: http://peekaboo-vision.blogspot.co.uk/2012/11/a-wordcloud-in-python.html


0 commentaires:

Enregistrer un commentaire