Skip to content

Commit fe9d0ea

Browse files
committed
added plot function names
1 parent 222dd44 commit fe9d0ea

File tree

1 file changed

+114
-15
lines changed

1 file changed

+114
-15
lines changed

catalogue.py

+114-15
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,20 @@ def scatter(ax):
4848
ax.scatter(X, Y, S/2, clip_path=clip2,
4949
linewidth=0.00, facecolor="red", edgecolor="None", alpha=0.5)
5050

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+
5363

5464
def lineplot(ax):
55-
ax.set_xlabel("Line plot")
5665

5766
clip1, clip2 = clip_path(ax)
5867

@@ -67,7 +76,19 @@ def lineplot(ax):
6776
ax.plot(X, Y, color="red", linewidth=2, clip_path=clip2)
6877
ax.fill_between(X, Y+0.25, Y-0.25, clip_path=clip2,
6978
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+
7192

7293
def quiverplot(ax):
7394
clip1, clip2 = clip_path(ax)
@@ -83,7 +104,18 @@ def quiverplot(ax):
83104
ax.quiver(X, Y, 0.1*U, 0.1*V, T-1, scale=1, width=0.015, clip_path=clip2,
84105
edgecolor='black', linewidth=.5, cmap="hot")
85106

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+
87119

88120
def contourplot(ax):
89121

@@ -116,7 +148,18 @@ def f(x,y): return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
116148
for collection in CS.collections:
117149
collection.set_clip_path(clip2)
118150

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+
120163

121164
def imageplot(ax):
122165
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)
132175
ax.imshow(Z, extent=[-1,+1,-1,+1], origin="upper",
133176
cmap="hot", interpolation="bicubic", clip_path=clip2)
134177

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")
135189

136-
ax.set_xlabel("Image plot")
137190

138191
def pieplot(ax):
139192
clip1, clip2 = clip_path(ax)
@@ -174,7 +227,18 @@ def pieplot(ax):
174227
edgecolor="black", facecolor="None", clip_on=False)
175228
ax.add_artist(rect)
176229

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+
178242

179243
def threedplot(ax):
180244

@@ -203,11 +267,24 @@ def threedplot(ax):
203267
rect = Rectangle((0,0), 1, 1, transform=ax.transAxes, linewidth=0.75,
204268
edgecolor="black", facecolor="None", clip_on=False)
205269
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)
208276
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+
211288
def barplot(ax):
212289
clip1, clip2 = clip_path(ax)
213290

@@ -220,7 +297,19 @@ def barplot(ax):
220297
ax.bar(X, +Y1, 1, facecolor='#ffaaaa', edgecolor='white', clip_path=clip2)
221298
ax.bar(X, -Y2, 1, facecolor='#ff7777', edgecolor='white', clip_path=clip2)
222299
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+
224313

225314
def boxplot(ax):
226315
clip1, clip2 = clip_path(ax)
@@ -253,9 +342,19 @@ def boxplot(ax):
253342
pass
254343
item.set_clip_path(clip2)
255344

256-
257345
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")
259358

260359

261360
fig, axes = plt.subplots(3, 3, figsize=(8, 8))

0 commit comments

Comments
 (0)