44
44
normalized figure coordinates. It can happen that your axis labels or
45
45
titles (or sometimes even ticklabels) go outside the figure area, and are thus
46
46
clipped.
47
-
48
47
"""
49
48
50
49
# sphinx_gallery_thumbnail_number = 18
58
57
59
58
plt .rcParams ['savefig.facecolor' ] = "0.8"
60
59
plt .rcParams ['figure.figsize' ] = 4.5 , 4.
60
+ plt .rcParams ['figure.max_open_warning' ] = 50
61
61
62
62
63
- def example_plot (ax , fontsize = 12 , nodec = False ):
63
+ def example_plot (ax , fontsize = 12 , hide_labels = False ):
64
64
ax .plot ([1 , 2 ])
65
65
66
66
ax .locator_params (nbins = 3 )
67
- if not nodec :
67
+ if hide_labels :
68
+ ax .set_xticklabels ([])
69
+ ax .set_yticklabels ([])
70
+ else :
68
71
ax .set_xlabel ('x-label' , fontsize = fontsize )
69
72
ax .set_ylabel ('y-label' , fontsize = fontsize )
70
73
ax .set_title ('Title' , fontsize = fontsize )
71
- else :
72
- ax .set_xticklabels ('' )
73
- ax .set_yticklabels ('' )
74
74
75
75
76
76
fig , ax = plt .subplots (constrained_layout = False )
@@ -266,17 +266,13 @@ def example_plot(ax, fontsize=12, nodec=False):
266
266
267
267
fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
268
268
for ax in axs .flat :
269
- example_plot (ax , nodec = True )
270
- ax .set_xticklabels ('' )
271
- ax .set_yticklabels ('' )
269
+ example_plot (ax , hide_labels = True )
272
270
fig .set_constrained_layout_pads (w_pad = 4. / 72. , h_pad = 4. / 72. ,
273
271
hspace = 0. , wspace = 0. )
274
272
275
273
fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
276
274
for ax in axs .flat :
277
- example_plot (ax , nodec = True )
278
- ax .set_xticklabels ('' )
279
- ax .set_yticklabels ('' )
275
+ example_plot (ax , hide_labels = True )
280
276
fig .set_constrained_layout_pads (w_pad = 2. / 72. , h_pad = 2. / 72. ,
281
277
hspace = 0. , wspace = 0. )
282
278
@@ -289,9 +285,7 @@ def example_plot(ax, fontsize=12, nodec=False):
289
285
290
286
fig , axs = plt .subplots (2 , 2 , constrained_layout = True )
291
287
for ax in axs .flat :
292
- example_plot (ax , nodec = True )
293
- ax .set_xticklabels ('' )
294
- ax .set_yticklabels ('' )
288
+ example_plot (ax , hide_labels = True )
295
289
fig .set_constrained_layout_pads (w_pad = 2. / 72. , h_pad = 2. / 72. ,
296
290
hspace = 0.2 , wspace = 0.2 )
297
291
0 commit comments