修訂 | 9a26d5e27da004230d63e908404f3333827546e2 (tree) |
---|---|
時間 | 2010-10-28 21:15:35 |
作者 | lorenzo |
Commiter | lorenzo |
I updated the code and it now produces what should be the final version of
the two plots.
@@ -25,7 +25,17 @@ | ||
25 | 25 | return abs(cos(y)) |
26 | 26 | |
27 | 27 | |
28 | -theta=0.8*pi/2. | |
28 | +theta=0.5*pi/2. | |
29 | + | |
30 | +theta_1=0. | |
31 | + | |
32 | +theta_2=-theta | |
33 | + | |
34 | + | |
35 | +theta_4=-pi/2 | |
36 | + | |
37 | +theta_5=pi/2 | |
38 | + | |
29 | 39 | |
30 | 40 | # make these smaller to increase the resolution |
31 | 41 | dx, dy = 0.0025, 0.0025 |
@@ -42,6 +52,31 @@ | ||
42 | 52 | xy_end=(pi/1.5*cos(theta), pi/1.5*sin(theta)) |
43 | 53 | |
44 | 54 | |
55 | +xy_surf_1=(pi/2.*cos(theta_1), pi/2.*sin(theta_1)) | |
56 | + | |
57 | +xy_end_1=(pi/1.5*cos(theta_1), pi/1.5*sin(theta_1)) | |
58 | + | |
59 | + | |
60 | +xy_surf_2=(pi/2.*cos(theta_2), pi/2.*sin(theta_2)) | |
61 | + | |
62 | +xy_end_2=(pi/1.5*cos(theta_2), pi/1.5*sin(theta_2)) | |
63 | + | |
64 | + | |
65 | +xy_end_3=(0.,0.) | |
66 | + | |
67 | +xy_surf_3=((pi/1.5-pi/2.),0.) | |
68 | + | |
69 | + | |
70 | +xy_surf_4=(pi/2.*cos(theta_4), pi/2.*sin(theta_4)) | |
71 | + | |
72 | +xy_end_4=(pi/1.5*cos(theta_4), pi/1.5*sin(theta_4)) | |
73 | + | |
74 | +xy_surf_5=(pi/2.*cos(theta_5), pi/2.*sin(theta_5)) | |
75 | + | |
76 | +xy_end_5=(pi/1.5*cos(theta_4), pi/1.5*sin(theta_5)) | |
77 | + | |
78 | + | |
79 | + | |
45 | 80 | print("x is, " ) |
46 | 81 | |
47 | 82 | print (x) |
@@ -59,8 +94,6 @@ | ||
59 | 94 | |
60 | 95 | ax = fig.add_subplot(111) |
61 | 96 | |
62 | -figtext(.63, .65,r'$-{\bfJ}_1^\perp$', fontdict=None,fontsize=20 | |
63 | - ) | |
64 | 97 | |
65 | 98 | |
66 | 99 |
@@ -69,13 +102,14 @@ | ||
69 | 102 | |
70 | 103 | im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData)) |
71 | 104 | |
72 | -annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black")) | |
105 | +annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black", | |
106 | + arrowstyle="-")) | |
73 | 107 | |
74 | -for y in np.arange(-1.4, 1.5, 0.2): | |
75 | - annotate("", xy=(pi/2., y), xytext=(ini, y), arrowprops=dict(fc="g")) | |
108 | +# for y in np.arange(-1.4, 1.5, 0.2): | |
109 | +# annotate("", xy=(pi/2., y), xytext=(ini, y), arrowprops=dict(fc="g")) | |
76 | 110 | |
77 | -ax.annotate('', xy=(-.3, 2.4), xycoords='data', | |
78 | - xytext=(-.4, 2.2), # textcoords='offset points', | |
111 | +ax.annotate('', xy=(-.3, 2.6), xycoords='data', | |
112 | + xytext=(-.4, 2.4), # textcoords='offset points', | |
79 | 113 | arrowprops=dict(arrowstyle="->", |
80 | 114 | connectionstyle="angle3,angleA=0,angleB=-10"), |
81 | 115 | ) |
@@ -83,8 +117,50 @@ | ||
83 | 117 | annotate("", xy=xy_surf, |
84 | 118 | xytext=xy_end, arrowprops=dict(fc="g")) |
85 | 119 | |
120 | +annotate("", xy=xy_surf_1, | |
121 | + xytext=xy_end_1, arrowprops=dict(fc="g")) | |
86 | 122 | |
87 | -figtext(.5, 0.7,r'$\hat{\bf s}$', fontdict=None,fontsize=20 | |
123 | +annotate("", xy=xy_surf_2, | |
124 | + xytext=xy_end_2, arrowprops=dict(fc="g")) | |
125 | + | |
126 | +annotate("", xy=xy_surf_3, | |
127 | + xytext=xy_end_3, arrowprops=dict(fc="g")) | |
128 | + | |
129 | + | |
130 | +annotate("", xy=xy_surf_4, | |
131 | + xytext=xy_end_4, arrowprops=dict(fc="g")) | |
132 | + | |
133 | +annotate("", xy=xy_surf_5, | |
134 | + xytext=xy_end_5, arrowprops=dict(fc="g")) | |
135 | + | |
136 | + | |
137 | + | |
138 | + | |
139 | +# figtext(.5, 0.7,r'$\hat{\bf J}_1$', fontdict=None,fontsize=20 | |
140 | +# ) | |
141 | + | |
142 | + | |
143 | + | |
144 | +figtext(.73, .66,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
145 | + ) | |
146 | + | |
147 | +figtext(.73, 0.22,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
148 | + ) | |
149 | + | |
150 | +figtext(.79, 0.43,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
151 | + ) | |
152 | + | |
153 | + | |
154 | +figtext(.53, 0.43,r'$\hat{\bf s}_{\perp}$', fontdict=None,fontsize=20 | |
155 | + ) | |
156 | + | |
157 | + | |
158 | + | |
159 | +figtext(.53, .1,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
160 | + ) | |
161 | + | |
162 | + | |
163 | +figtext(.53, .7,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
88 | 164 | ) |
89 | 165 | |
90 | 166 |
@@ -96,14 +172,17 @@ | ||
96 | 172 | |
97 | 173 | # colorbar(ticks=[] ) |
98 | 174 | |
99 | -# ax = plt.axes() | |
100 | -cb = plt.colorbar() | |
101 | -cb.ax.set_yticks((0.0, 1)) | |
102 | -cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$", | |
103 | - r"$\max(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$")) | |
175 | + | |
176 | +# cb = plt.colorbar() | |
177 | +# cb.ax.set_yticks((0.0, 1)) | |
178 | +# cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$", | |
179 | +# r"$\max(-{\bf J}_1^{\perp}\cdot \hat{\bf s})$")) | |
104 | 180 | |
105 | 181 | |
106 | 182 | savefig("first-plot.pdf", bbox_inches='tight') |
183 | + | |
184 | + | |
185 | + | |
107 | 186 | |
108 | 187 | clf() |
109 | 188 |
@@ -111,12 +190,13 @@ | ||
111 | 190 | |
112 | 191 | |
113 | 192 | |
114 | -theta=0.4*pi/2. | |
115 | 193 | |
116 | 194 | |
117 | -xy_surf=(pi/2.*cos(theta), pi/2.*sin(theta)) | |
118 | 195 | |
119 | -xy_end=(pi/1.5*cos(theta), pi/1.5*sin(theta)) | |
196 | + | |
197 | +xy_end_3=(0.,0.) | |
198 | + | |
199 | +xy_surf_3=(0.,(pi/1.5-pi/2.)) | |
120 | 200 | |
121 | 201 | |
122 | 202 | Z = func5(X, Y) |
@@ -127,47 +207,98 @@ | ||
127 | 207 | |
128 | 208 | ax = fig.add_subplot(111) |
129 | 209 | |
130 | -figtext(.65, .67,r'$-{\bf J}_1^{\parallel}$', fontdict=None,fontsize=20) | |
210 | + | |
131 | 211 | |
132 | 212 | im = imshow(Z,cmap=cm.jet, extent=(-pi, pi, -pi, pi)) |
133 | 213 | im.set_interpolation('bilinear') |
134 | 214 | |
135 | 215 | im.set_clip_path(Circle((0,0),pi/2., transform=ax.transData)) |
136 | 216 | |
137 | -for x in np.arange(-1.4, 1.5, 0.2): | |
138 | - if (abs(x)>1e-4): | |
139 | - annotate("", xy=(x,-pi/2.), xytext=(x, -ini), arrowprops=dict(fc="g")) | |
217 | +# for x in np.arange(-1.4, 1.5, 0.2): | |
218 | +# if (abs(x)>1e-4): | |
219 | +# annotate("", xy=(x,-pi/2.), xytext=(x, -ini), arrowprops=dict(fc="g")) | |
140 | 220 | |
141 | -for x in np.arange(-1.4, 1.5, 0.2): | |
142 | - if (abs(x)>=1e-4): | |
143 | - annotate("", xy=(x,pi/2.), xytext=(x, ini), arrowprops=dict(fc="g")) | |
221 | +# for x in np.arange(-1.4, 1.5, 0.2): | |
222 | +# if (abs(x)>=1e-4): | |
223 | +# annotate("", xy=(x,pi/2.), xytext=(x, ini), arrowprops=dict(fc="g")) | |
144 | 224 | |
145 | -annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black")) | |
225 | +annotate("", xy=(0., ini+1.), xytext=(0, -ini), arrowprops=dict(fc="black", | |
226 | + arrowstyle="-")) | |
146 | 227 | |
147 | -ax.annotate('', xy=(-.3, 2.4), xycoords='data', | |
148 | - xytext=(-.4, 2.2), # textcoords='offset points', | |
228 | +ax.annotate('', xy=(-.3, 2.6), xycoords='data', | |
229 | + xytext=(-.4, 2.4), # textcoords='offset points', | |
149 | 230 | arrowprops=dict(arrowstyle="->", |
150 | 231 | connectionstyle="angle3,angleA=0,angleB=-10"), |
151 | 232 | ) |
152 | 233 | |
234 | + | |
153 | 235 | annotate("", xy=xy_surf, |
154 | 236 | xytext=xy_end, arrowprops=dict(fc="g")) |
155 | 237 | |
238 | +annotate("", xy=xy_surf_1, | |
239 | + xytext=xy_end_1, arrowprops=dict(fc="g")) | |
156 | 240 | |
157 | -figtext(.65, 0.61,r'$\hat{\bf s}$', fontdict=None,fontsize=20 | |
241 | +annotate("", xy=xy_surf_2, | |
242 | + xytext=xy_end_2, arrowprops=dict(fc="g")) | |
243 | + | |
244 | +annotate("", xy=xy_surf_3, | |
245 | + xytext=xy_end_3, arrowprops=dict(fc="g")) | |
246 | + | |
247 | + | |
248 | +annotate("", xy=xy_surf_4, | |
249 | + xytext=xy_end_4, arrowprops=dict(fc="g")) | |
250 | + | |
251 | + | |
252 | +annotate("", xy=xy_surf_5, | |
253 | + xytext=xy_end_5, arrowprops=dict(fc="g")) | |
254 | + | |
255 | + | |
256 | +figtext(.73, .66,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
158 | 257 | ) |
159 | 258 | |
259 | +figtext(.73, 0.22,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
260 | + ) | |
261 | + | |
262 | +figtext(.77, 0.43,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
263 | + ) | |
264 | + | |
265 | + | |
266 | + | |
267 | + | |
268 | + | |
269 | +figtext(.53, .1,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
270 | + ) | |
271 | + | |
272 | + | |
273 | +figtext(.53, .7,r'${\bf J}_1$', fontdict=None,fontsize=20 | |
274 | + ) | |
275 | + | |
276 | + | |
277 | + | |
278 | + | |
279 | + | |
160 | 280 | |
161 | 281 | ax.set_xlim(-ini, ini) |
162 | 282 | ax.set_ylim(-ini, ini+1) |
163 | 283 | ax.set_xticks([]) # this is needed for bbox_inches |
164 | 284 | ax.set_yticks([]) |
165 | 285 | |
166 | -cb = plt.colorbar() | |
167 | -cb.ax.set_yticks((0.0, 1)) | |
168 | -cb.ax.set_yticklabels(( "min","max")) | |
169 | -cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$", | |
170 | - r"$\max(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$")) | |
286 | +# cb = plt.colorbar() | |
287 | +# cb.ax.set_yticks((0.0, 1)) | |
288 | +# cb.ax.set_yticklabels(( "min","max")) | |
289 | +# cb.ax.set_yticklabels(( r"$\min(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$", | |
290 | +# r"$\max(-{\bf J}_1^{\parallel}\cdot \hat{\bf s})$")) | |
291 | + | |
292 | + | |
293 | + | |
294 | + | |
295 | + | |
296 | + | |
297 | + | |
298 | +figtext(.52, 0.43,r'$\hat{\bf s}_{\parallel}$', fontdict=None,fontsize=20 | |
299 | + ) | |
300 | + | |
301 | + | |
171 | 302 | |
172 | 303 | |
173 | 304 | savefig("second-plot.pdf", bbox_inches='tight') |