From a4db7a4189ce11f18c4dce6c06274f5222b0bcdd Mon Sep 17 00:00:00 2001
From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
Date: Thu, 13 Feb 2025 09:39:43 -0500
Subject: [PATCH] Fix polygon plots in docs
---
docs/_static/tutorials/shapes_uml.svg | 16 ++++++++--------
src/data_morph/shapes/factory.py | 2 +-
src/data_morph/shapes/lines/diamond.py | 2 +-
src/data_morph/shapes/lines/rectangle.py | 2 +-
src/data_morph/shapes/lines/star.py | 2 +-
tests/shapes/test_polygons.py | 10 +++++-----
6 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/docs/_static/tutorials/shapes_uml.svg b/docs/_static/tutorials/shapes_uml.svg
index 71ecff2c..9f318aa2 100644
--- a/docs/_static/tutorials/shapes_uml.svg
+++ b/docs/_static/tutorials/shapes_uml.svg
@@ -80,18 +80,18 @@
-
+
-data_morph.shapes.polygons.Diamond
+data_morph.shapes.lines.diamond.Diamond
Diamond
-
+
-data_morph.shapes.polygons.Diamond->data_morph.shapes.bases.line_collection.LineCollection
+data_morph.shapes.lines.diamond.Diamond->data_morph.shapes.bases.line_collection.LineCollection
@@ -110,18 +110,18 @@
-
+
-data_morph.shapes.polygons.Star
+data_morph.shapes.lines.star.Star
Star
-
+
-data_morph.shapes.polygons.Star->data_morph.shapes.bases.line_collection.LineCollection
+data_morph.shapes.lines.star.Star->data_morph.shapes.bases.line_collection.LineCollection
diff --git a/src/data_morph/shapes/factory.py b/src/data_morph/shapes/factory.py
index 47d1ae5b..0c7a9b9c 100644
--- a/src/data_morph/shapes/factory.py
+++ b/src/data_morph/shapes/factory.py
@@ -144,7 +144,7 @@ def plot_available_shapes(self) -> Axes:
num_rows,
num_cols,
layout='constrained',
- figsize=(12, 2 * num_rows),
+ figsize=(2 * num_cols, 2 * num_rows),
)
fig.get_layout_engine().set(w_pad=0.2, h_pad=0.2)
diff --git a/src/data_morph/shapes/lines/diamond.py b/src/data_morph/shapes/lines/diamond.py
index 5ce50c89..1c74c1aa 100644
--- a/src/data_morph/shapes/lines/diamond.py
+++ b/src/data_morph/shapes/lines/diamond.py
@@ -15,7 +15,7 @@ class Diamond(LineCollection):
import matplotlib.pyplot as plt
from data_morph.data.loader import DataLoader
- from data_morph.shapes.polygons import Diamond
+ from data_morph.shapes.lines import Diamond
_ = Diamond(DataLoader.load_dataset('panda')).plot()
diff --git a/src/data_morph/shapes/lines/rectangle.py b/src/data_morph/shapes/lines/rectangle.py
index 8f38f43d..d646190d 100644
--- a/src/data_morph/shapes/lines/rectangle.py
+++ b/src/data_morph/shapes/lines/rectangle.py
@@ -15,7 +15,7 @@ class Rectangle(LineCollection):
import matplotlib.pyplot as plt
from data_morph.data.loader import DataLoader
- from data_morph.shapes.polygons import Rectangle
+ from data_morph.shapes.lines import Rectangle
_ = Rectangle(DataLoader.load_dataset('panda')).plot()
diff --git a/src/data_morph/shapes/lines/star.py b/src/data_morph/shapes/lines/star.py
index be7ce305..bb23ce35 100644
--- a/src/data_morph/shapes/lines/star.py
+++ b/src/data_morph/shapes/lines/star.py
@@ -15,7 +15,7 @@ class Star(LineCollection):
import matplotlib.pyplot as plt
from data_morph.data.loader import DataLoader
- from data_morph.shapes.polygons import Star
+ from data_morph.shapes.lines import Star
_ = Star(DataLoader.load_dataset('panda')).plot()
diff --git a/tests/shapes/test_polygons.py b/tests/shapes/test_polygons.py
index 99a6c538..c6b2aca3 100644
--- a/tests/shapes/test_polygons.py
+++ b/tests/shapes/test_polygons.py
@@ -1,4 +1,4 @@
-"""Test polygons module."""
+"""Test polygons in the lines module."""
from numbers import Number
@@ -8,7 +8,7 @@
pytestmark = [pytest.mark.shapes, pytest.mark.lines, pytest.mark.polygons]
-class PolygonsModuleTestBase:
+class PolygonsLineModuleTestBase:
"""Base for testing polygon shapes."""
shape_name: str
@@ -47,7 +47,7 @@ def test_lines_form_polygon(self, shape):
assert np.unique(endpoints, axis=0).shape[0] == self.expected_line_count
-class TestDiamond(PolygonsModuleTestBase):
+class TestDiamond(PolygonsLineModuleTestBase):
"""Test the Diamond class."""
shape_name = 'diamond'
@@ -59,7 +59,7 @@ def test_slopes(self, slopes):
np.testing.assert_array_equal(np.sort(slopes).flatten(), [-1.5, -1.5, 1.5, 1.5])
-class TestRectangle(PolygonsModuleTestBase):
+class TestRectangle(PolygonsLineModuleTestBase):
"""Test the Rectangle class."""
shape_name = 'rectangle'
@@ -71,7 +71,7 @@ def test_slopes(self, slopes):
np.testing.assert_array_equal(np.sort(slopes).flatten(), [0, 0, np.inf, np.inf])
-class TestStar(PolygonsModuleTestBase):
+class TestStar(PolygonsLineModuleTestBase):
"""Test the Star class."""
shape_name = 'star'