@@ -124,55 +124,10 @@ def set_text_pos(self, xy):
124
124
_text_pos = property (get_text_pos , set_text_pos )
125
125
126
126
127
- fig , ax = plt .subplots ()
128
-
129
- ax .plot ([2 , .5 , - 1 ], [1 , .2 , 1 ])
130
- am = AngleMarker ((.5 , .2 ), (2 , 1 ), (- 1 , 1 ), size = 50 , units = "pixels" , ax = ax ,
131
- text = r"$\theta$" )
132
- plt .show ()
133
-
134
-
135
- def testing (size = 0.25 , units = "axes fraction" , dpi = 100 , fs = (6.4 , 5 ),
136
- show = False ):
137
-
138
- fig , axes = plt .subplots (2 , 2 , sharex = "col" , sharey = "row" , dpi = dpi ,
139
- figsize = fs ,
140
- gridspec_kw = dict (width_ratios = [1 , 3 ],
141
- height_ratios = [3 , 1 ]))
142
-
143
- def plot_angle (ax , pos , vec1 , vec2 , acol = "C0" , ** kwargs ):
144
- ax .plot ([vec1 [0 ], pos [0 ], vec2 [0 ]], [vec1 [1 ], pos [1 ], vec2 [1 ]],
145
- color = acol )
146
- am = AngleMarker (pos , vec1 , vec2 , ax = ax , text = r"$\theta$" , ** kwargs )
147
-
148
- tx = "figsize={}, dpi={}, arcsize={} {}" .format (fs , dpi , size , units )
149
- axes [0 , 1 ].set_title (tx , loc = "right" , size = 9 )
150
- kw = dict (size = size , units = units )
151
- p = (.5 , .2 ), (2 , 0 ), (1 , 1 )
152
- plot_angle (axes [0 , 0 ], * p , ** kw )
153
- plot_angle (axes [0 , 1 ], * p , ** kw )
154
- plot_angle (axes [1 , 1 ], * p , ** kw )
155
- kw .update (acol = "limegreen" )
156
- plot_angle (axes [0 , 0 ], (1.2 , 0 ), (1 , - 1 ), (1.3 , - .8 ), ** kw )
157
- plot_angle (axes [1 , 1 ], (0.2 , 1 ), (0 , 0 ), (.3 , .2 ), ** kw )
158
- plot_angle (axes [0 , 1 ], (0.2 , 0 ), (0 , - 1 ), (.3 , - .8 ), ** kw )
159
- kw .update (acol = "crimson" )
160
- plot_angle (axes [1 , 0 ], (1 , .5 ), (1 , 1 ), (2 , .5 ), ** kw )
161
-
162
- fig .tight_layout ()
163
- fig .savefig (tx .replace ("=" , "_" ) + ".png" )
164
- fig .savefig (tx .replace ("=" , "_" ) + ".pdf" )
165
- if show :
166
- plt .show ()
167
-
168
-
169
- s = [(0.25 , "axes min" ), (0.25 , "axes max" ),
170
- (0.25 , "axes width" ), (0.25 , "axes height" ),
171
- (100 , "pixels" ), (72 , "points" )]
172
- d = [72 , 144 ]
173
- f = [(6.4 , 5 ), (12.8 , 10 )]
174
-
175
- import itertools
176
-
177
- for (size , unit ), dpi , fs in itertools .product (s , d , f ):
178
- testing (size = size , units = unit , dpi = dpi , fs = fs )
127
+ if __name__ == "__main__" :
128
+ fig , ax = plt .subplots ()
129
+
130
+ ax .plot ([2 , .5 , - 1 ], [1 , .2 , 1 ])
131
+ am = AngleMarker ((.5 , .2 ), (2 , 1 ), (- 1 , 1 ), size = 50 , units = "pixels" , ax = ax ,
132
+ text = r"$\theta$" )
133
+ plt .show ()
0 commit comments