|
10 | 10 | import numpy as np |
11 | 11 | from guidata.qthelpers import qt_app_context |
12 | 12 |
|
13 | | -from plotpy.items import AnnotatedRectangle, EllipseShape, PolygonShape |
| 13 | +from plotpy.builder import make |
| 14 | +from plotpy.items import PolygonShape |
14 | 15 | from plotpy.plot import PlotDialog |
15 | | -from plotpy.styles import AnnotationParam, ShapeParam |
| 16 | +from plotpy.styles import ShapeParam |
16 | 17 | from plotpy.tools import ( |
17 | 18 | AnnotatedCircleTool, |
18 | 19 | AnnotatedEllipseTool, |
@@ -64,30 +65,22 @@ def test_autoscale_shapes(): |
64 | 65 | win.manager.get_itemlist_panel().show() |
65 | 66 |
|
66 | 67 | # Add a polygon |
67 | | - delta = 0.025 |
68 | | - x = np.arange(-3.0, 3.0, delta) |
69 | | - param = ShapeParam() |
70 | | - param.label = "Polygon" |
71 | | - crv = PolygonShape(closed=False, shapeparam=param) |
72 | | - crv.set_points(np.column_stack((x, np.sin(x)))) |
| 68 | + x = np.arange(-3.0, 3.0, 0.2) |
| 69 | + crv = make.polygon(x, np.sin(x), False, "Polygon") |
73 | 70 | plot.add_item(crv) |
74 | 71 |
|
75 | 72 | # Add a circle |
76 | | - param = ShapeParam() |
77 | | - param.label = "Circle" |
78 | | - circle = EllipseShape(-1, 2, shapeparam=param) |
| 73 | + circle = make.circle(-1, 2, 0, 0, "Circle") |
79 | 74 | plot.add_item(circle) |
80 | 75 |
|
81 | 76 | # Add an annotated rectangle |
82 | | - param = AnnotationParam() |
83 | | - param.title = "Annotated rectangle" |
84 | | - rect = AnnotatedRectangle(2.5, 1, 4, 1.2, annotationparam=param) |
| 77 | + rect = make.annotated_rectangle(2.5, 1, 4, 1.2, "Annotated rectangle") |
85 | 78 | plot.add_item(rect) |
86 | 79 |
|
87 | 80 | # Add an annotated rectangle excluded |
88 | | - param = AnnotationParam() |
89 | | - param.title = "Annotated rectangle excluded from autoscale" |
90 | | - rect = AnnotatedRectangle(1.0, 2.0, 5, 10, annotationparam=param) |
| 81 | + rect = make.annotated_rectangle( |
| 82 | + 1.0, 2.0, 5, 10, "Annotated rectangle excluded from autoscale" |
| 83 | + ) |
91 | 84 | plot.add_item(rect) |
92 | 85 |
|
93 | 86 | plot.add_autoscale_excludes([rect]) |
|
0 commit comments