Skip to content

Commit 7a55bb6

Browse files
committed
Fix a bug that occurred when attempting to draw word clouds for empty (sub-)sets (issue #6)
1 parent e334dff commit 7a55bb6

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ supervenn(sets, labels)
188188
plt.show()
189189
```
190190

191+
192+
## Recent Changes
193+
194+
- 0.1.1 Fix a bug that occurred when attempting to draw word clouds for empty (sub-)sets (issue #6)
195+
- 0.1.0 Implement set artists such that set outlines can be shown (issue #4)
196+
197+
191198
## Contributing & Support
192199

193200
If you get stuck and have a question that is not covered in the documentation, please raise an issue on the [issue tracker](https://github.com/paulbrodersen/matplotlib_set_diagrams/issues).

matplotlib_set_diagrams/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
3434
"""
3535

36-
__version__ = "0.1.0"
36+
__version__ = "0.1.1"
3737
__author__ = "Paul Brodersen"
3838
__email__ = "paulbrodersen+matplotlib_set_diagrams@gmail.com"
3939

matplotlib_set_diagrams/_diagram_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def _generate_wordcloud(
670670
mask = mask,
671671
rgba = self.subset_colors[subset_id],
672672
wordcloud_kwargs = wordcloud_kwargs,
673-
) for subset_id, mask in subset_masks.items()
673+
) for subset_id, mask in subset_masks.items() if subsets[subset_id]
674674
]
675675

676676
combined_image = np.sum(subset_images, axis=0)

tests/test_diagram_classes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ def test_EulerDiagram_as_wordcloud():
145145
return fig
146146

147147

148+
@pytest.mark.mpl_image_compare
149+
def test_EulerDiagram_as_wordcloud_with_empty_subsets():
150+
sets = [
151+
{"a", "b"},
152+
{"c"}
153+
]
154+
fig, ax = plt.subplots()
155+
EulerDiagram.as_wordcloud(sets, wordcloud_kwargs=dict(random_state=42), ax=ax)
156+
return fig
157+
158+
148159
@pytest.mark.mpl_image_compare
149160
def test_VennDiagram():
150161
fig, axes = plt.subplots(1, 2, sharex=True, sharey=True)

0 commit comments

Comments
 (0)