amueller / word_cloud

A little word cloud generator in Python
https://amueller.github.io/word_cloud
MIT License
10.19k stars 2.32k forks source link

Add SVG contour support to WordCloud class #759

Open sans-dev opened 10 months ago

sans-dev commented 10 months ago

This pull request introduces the ability to generate SVG contour outlines in the WordCloud library. This feature enhances the visual representation of word clouds by providing an option to include contour outlines around the words.

Changes include:

  1. Modification in wordcloud.py: The to_svg function in wordcloud.py has been updated to include the contour outlines if the contour attribute is set. The contour is converted into an SVG path command and added to the SVG output.

  2. New test function in test_wordcloud.py: A new test function, test_svg_contour, has been added to test_wordcloud.py. This function tests whether the SVG output includes the contour path when the contour attribute is set.

These changes ensure that users can now generate word clouds with contour outlines in SVG format, providing more flexibility in the visual representation of word clouds. The added test ensures that the new feature works as expected.

Please review the changes and let me know if any adjustments are required.

Fixes #694