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