-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsimple_patch.py
More file actions
103 lines (91 loc) · 2.57 KB
/
Copy pathsimple_patch.py
File metadata and controls
103 lines (91 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
====================
Simple patch artists
====================
Draw two fully specified rectangle patches.
Demonstrates :class:`.patches.RectangleWrapper` using
:class:`.containers.ArrayContainer`.
"""
import numpy as np
import matplotlib.pyplot as plt
from data_prototype.containers import ArrayContainer
from data_prototype.patches import RectangleWrapper, CircleWrapper, AnnulusWrapper, EllipseWrapper
cont1 = ArrayContainer(
x=np.array([-3]),
y=np.array([0]),
width=np.array([2]),
height=np.array([3]),
angle=np.array([0]),
rotation_point=np.array(["center"]),
edgecolor=np.array([0, 0, 0]),
facecolor=np.array([0.0, 0.7, 0, 0.5]),
linewidth=np.array([3]),
linestyle=np.array(["-"]),
antialiased=np.array([True]),
hatch=np.array(["*"]),
fill=np.array([True]),
capstyle=np.array(["round"]),
joinstyle=np.array(["miter"]),
)
cont2 = ArrayContainer(
center=np.array([0, 1]),
radius=np.array([0.8]),
edgecolor=np.array([0, 0, 0]),
facecolor=np.array([0.7, 0, 0]),
linewidth=np.array([3]),
linestyle=np.array(["-"]),
antialiased=np.array([True]),
hatch=np.array([""]),
fill=np.array([True]),
capstyle=np.array(["butt"]),
joinstyle=np.array(["round"]),
)
cont3 = ArrayContainer(
center=np.array([0, 4]),
width=np.array([2]),
height=np.array([1]),
angle=np.array([0.3]),
edgecolor=np.array([0, 0, 0.7]),
facecolor=np.array([0, 0.7, 0]),
linewidth=np.array([3]),
linestyle=np.array([":"]),
antialiased=np.array([True]),
hatch=np.array(["/"]),
fill=np.array([True]),
capstyle=np.array(["butt"]),
joinstyle=np.array(["round"]),
)
cont4 = ArrayContainer(
center=np.array([1, 4]),
radii=np.array([3, 1]),
width=np.array([0.4]),
height=np.array([1]),
angle=np.array([0.3]),
theta1=np.array([0]),
theta2=np.array([2]),
edgecolor=np.array([0, 0.7, 0]),
facecolor=np.array([0.7, 0, 0.7]),
linewidth=np.array([3]),
linestyle=np.array(["-"]),
antialiased=np.array([True]),
hatch=np.array(["+"]),
fill=np.array([True]),
capstyle=np.array(["butt"]),
joinstyle=np.array(["round"]),
)
fig, ax = plt.subplots()
ax.set_xlim(-5, 5)
ax.set_ylim(0, 5)
rect = RectangleWrapper(cont1, {})
circ = CircleWrapper(cont2, {})
ellipse = EllipseWrapper(cont3, {})
# ArcWrapper is still broken due to no setters of theta1/2
# arc = ArcWrapper(cont4, {})
annulus = AnnulusWrapper(cont4, {})
ax.add_artist(rect)
ax.add_artist(circ)
ax.add_artist(ellipse)
# ax.add_artist(arc)
ax.add_artist(annulus)
ax.set_aspect(1)
plt.show()