@@ -48,11 +48,20 @@ def scatter(ax):
48
48
ax .scatter (X , Y , S / 2 , clip_path = clip2 ,
49
49
linewidth = 0.00 , facecolor = "red" , edgecolor = "None" , alpha = 0.5 )
50
50
51
- ax .set_xlabel ("Scatter plot" )
52
-
51
+ ax .text (0.0 , - 0.08 , 'Scatter plot' ,
52
+ color = 'k' ,
53
+ ha = 'left' ,
54
+ size = 8 ,
55
+ transform = ax .transAxes )
56
+ ax .text (1.0 , - 0.08 , 'ax.scatter()' ,
57
+ color = 'blue' ,
58
+ ha = 'right' ,
59
+ size = 8 ,
60
+ transform = ax .transAxes ,
61
+ family = "monospace" )
62
+
53
63
54
64
def lineplot (ax ):
55
- ax .set_xlabel ("Line plot" )
56
65
57
66
clip1 , clip2 = clip_path (ax )
58
67
@@ -67,7 +76,19 @@ def lineplot(ax):
67
76
ax .plot (X , Y , color = "red" , linewidth = 2 , clip_path = clip2 )
68
77
ax .fill_between (X , Y + 0.25 , Y - 0.25 , clip_path = clip2 ,
69
78
facecolor = "red" , edgecolor = "None" , alpha = 0.15 )
70
-
79
+
80
+ ax .text (0.0 , - 0.08 , 'Line plot' ,
81
+ color = 'k' ,
82
+ ha = 'left' ,
83
+ size = 8 ,
84
+ transform = ax .transAxes )
85
+ ax .text (1.0 , - 0.08 , 'ax.plot()' ,
86
+ color = 'blue' ,
87
+ ha = 'right' ,
88
+ size = 8 ,
89
+ transform = ax .transAxes ,
90
+ family = "monospace" )
91
+
71
92
72
93
def quiverplot (ax ):
73
94
clip1 , clip2 = clip_path (ax )
@@ -83,7 +104,18 @@ def quiverplot(ax):
83
104
ax .quiver (X , Y , 0.1 * U , 0.1 * V , T - 1 , scale = 1 , width = 0.015 , clip_path = clip2 ,
84
105
edgecolor = 'black' , linewidth = .5 , cmap = "hot" )
85
106
86
- ax .set_xlabel ("Quiver plot" )
107
+ ax .text (0.0 , - 0.08 , 'Quiver plot' ,
108
+ color = 'k' ,
109
+ ha = 'left' ,
110
+ size = 8 ,
111
+ transform = ax .transAxes )
112
+ ax .text (1.0 , - 0.08 , 'ax.quiver()' ,
113
+ color = 'blue' ,
114
+ ha = 'right' ,
115
+ size = 8 ,
116
+ transform = ax .transAxes ,
117
+ family = "monospace" )
118
+
87
119
88
120
def contourplot (ax ):
89
121
@@ -116,7 +148,18 @@ def f(x,y): return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
116
148
for collection in CS .collections :
117
149
collection .set_clip_path (clip2 )
118
150
119
- ax .set_xlabel ("Contour plot" )
151
+ ax .text (0.0 , - 0.08 , 'Contour plot' ,
152
+ color = 'k' ,
153
+ ha = 'left' ,
154
+ size = 8 ,
155
+ transform = ax .transAxes )
156
+ ax .text (1.0 , - 0.08 , 'ax.contour()' ,
157
+ color = 'blue' ,
158
+ ha = 'right' ,
159
+ size = 8 ,
160
+ transform = ax .transAxes ,
161
+ family = "monospace" )
162
+
120
163
121
164
def imageplot (ax ):
122
165
def f (x ,y ): return (1 - x / 2 + x ** 5 + y ** 3 )* np .exp (- x ** 2 - y ** 2 )
@@ -132,8 +175,18 @@ def f(x,y): return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
132
175
ax .imshow (Z , extent = [- 1 ,+ 1 ,- 1 ,+ 1 ], origin = "upper" ,
133
176
cmap = "hot" , interpolation = "bicubic" , clip_path = clip2 )
134
177
178
+ ax .text (0.0 , - 0.08 , 'Image plot' ,
179
+ color = 'k' ,
180
+ ha = 'left' ,
181
+ size = 8 ,
182
+ transform = ax .transAxes )
183
+ ax .text (1.0 , - 0.08 , 'ax.imshow()' ,
184
+ color = 'blue' ,
185
+ ha = 'right' ,
186
+ size = 8 ,
187
+ transform = ax .transAxes ,
188
+ family = "monospace" )
135
189
136
- ax .set_xlabel ("Image plot" )
137
190
138
191
def pieplot (ax ):
139
192
clip1 , clip2 = clip_path (ax )
@@ -174,7 +227,18 @@ def pieplot(ax):
174
227
edgecolor = "black" , facecolor = "None" , clip_on = False )
175
228
ax .add_artist (rect )
176
229
177
- ax .set_xlabel ("Pie plot" )
230
+ ax .text (0.0 , - 0.08 , 'Pie plot' ,
231
+ color = 'k' ,
232
+ ha = 'left' ,
233
+ size = 8 ,
234
+ transform = ax .transAxes )
235
+ ax .text (1.0 , - 0.08 , 'ax.pie()' ,
236
+ color = 'blue' ,
237
+ ha = 'right' ,
238
+ size = 8 ,
239
+ transform = ax .transAxes ,
240
+ family = "monospace" )
241
+
178
242
179
243
def threedplot (ax ):
180
244
@@ -203,11 +267,24 @@ def threedplot(ax):
203
267
rect = Rectangle ((0 ,0 ), 1 , 1 , transform = ax .transAxes , linewidth = 0.75 ,
204
268
edgecolor = "black" , facecolor = "None" , clip_on = False )
205
269
ax .add_artist (rect )
206
- text = Text (0.5 , - 0.025 , "3D plot" , clip_on = False ,
207
- ha = "center" , va = "top" , transform = ax .transAxes )
270
+
271
+ text = Text (0.0 , - 0.08 , "3D plot" ,
272
+ clip_on = False ,
273
+ size = 8 ,
274
+ ha = "left" ,
275
+ transform = ax .transAxes )
208
276
ax .add_artist (text )
209
-
210
-
277
+
278
+ text = Text (1.0 , - 0.08 , 'ax.plot_surface()' ,
279
+ color = 'blue' ,
280
+ clip_on = False ,
281
+ size = 8 ,
282
+ ha = "right" ,
283
+ transform = ax .transAxes ,
284
+ family = "monospace" )
285
+ ax .add_artist (text )
286
+
287
+
211
288
def barplot (ax ):
212
289
clip1 , clip2 = clip_path (ax )
213
290
@@ -220,7 +297,19 @@ def barplot(ax):
220
297
ax .bar (X , + Y1 , 1 , facecolor = '#ffaaaa' , edgecolor = 'white' , clip_path = clip2 )
221
298
ax .bar (X , - Y2 , 1 , facecolor = '#ff7777' , edgecolor = 'white' , clip_path = clip2 )
222
299
ax .set_xlim (- 1 ,n )
223
- ax .set_xlabel ("Bar plot" )
300
+
301
+ ax .text (0.0 , - 0.08 , 'Bar plot' ,
302
+ color = 'k' ,
303
+ ha = 'left' ,
304
+ size = 8 ,
305
+ transform = ax .transAxes )
306
+ ax .text (1.0 , - 0.08 , 'ax.bar()' ,
307
+ color = 'blue' ,
308
+ ha = 'right' ,
309
+ size = 8 ,
310
+ transform = ax .transAxes ,
311
+ family = "monospace" )
312
+
224
313
225
314
def boxplot (ax ):
226
315
clip1 , clip2 = clip_path (ax )
@@ -253,9 +342,19 @@ def boxplot(ax):
253
342
pass
254
343
item .set_clip_path (clip2 )
255
344
256
-
257
345
ax .set_xlim (0 ,n + 1 ), ax .set_xticks ([])
258
- ax .set_xlabel ("Box plot" )
346
+
347
+ ax .text (0.0 , - 0.08 , 'Box plot' ,
348
+ color = 'k' ,
349
+ ha = 'left' ,
350
+ size = 8 ,
351
+ transform = ax .transAxes )
352
+ ax .text (1.0 , - 0.08 , 'ax.boxplot()' ,
353
+ color = 'blue' ,
354
+ ha = 'right' ,
355
+ size = 8 ,
356
+ transform = ax .transAxes ,
357
+ family = "monospace" )
259
358
260
359
261
360
fig , axes = plt .subplots (3 , 3 , figsize = (8 , 8 ))
0 commit comments