Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f3bfd10

Browse files
committed
DOCS: remove last warning from docs
1 parent 896ff6c commit f3bfd10

File tree

3 files changed

+9
-87
lines changed

3 files changed

+9
-87
lines changed

doc/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
# docs build to fail. This is especially useful for getting rid of deprecated
3535
# usage in the gallery.
3636
warnings.filterwarnings('error', append=True)
37-
#TODO remove when GridSpec allows rect again
38-
warnings.filterwarnings('ignore', message='(\n|.)*This figure includes Axes '
39-
'that are not compatible with tight_layout.*')
4037

4138
# Strip backslahes in function's signature
4239
# To be removed when numpydoc > 0.9.x
@@ -119,6 +116,7 @@ def _check_dependencies():
119116
# we should ignore warnings coming from importing deprecated modules for
120117
# autodoc purposes, as this will disappear automatically when they are removed
121118
warnings.filterwarnings('ignore', category=MatplotlibDeprecationWarning,
119+
module='importlib', # used by sphinx.autodoc.importer
122120
message=r'(\n|.)*module was deprecated.*')
123121

124122
autodoc_docstring_signature = True

examples/ticks_and_spines/date_precision_and_epochs.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
1919
"""
2020
import datetime
21-
import warnings
2221
import numpy as np
2322

2423
import matplotlib
@@ -133,10 +132,8 @@ def _reset_epoch_for_tutorial():
133132
fig, ax = plt.subplots(constrained_layout=True)
134133
ax.plot(xold, y)
135134
ax.set_title('Epoch: ' + mdates.get_epoch())
136-
with warnings.catch_warnings():
137-
warnings.filterwarnings("ignore", message=".*dates far from the epoch.*")
138-
plt.setp(ax.xaxis.get_majorticklabels(), rotation=40)
139-
plt.show()
135+
plt.setp(ax.xaxis.get_majorticklabels(), rotation=40)
136+
plt.show()
140137

141138
#############################################################################
142139
# For dates plotted using the more recent epoch, the plot is smooth:

tutorials/intermediate/tight_layout_guide.py

Lines changed: 6 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -198,88 +198,15 @@ def example_plot(ax, fontsize=12):
198198
example_plot(ax1)
199199
example_plot(ax2)
200200

201-
gs1.tight_layout(fig, rect=[0, 0, 0.5, 1])
201+
gs1.tight_layout(fig, rect=[0, 0, 0.5, 1.0])
202202

203203
###############################################################################
204-
# For example, this can be used for a figure with multiple gridspecs.
204+
# However, we do not recommend that this be used to manually construct more
205+
# complicated layouts, like having one GridSpec in the left and one in the
206+
# right side of the figure. For these use cases, one should instead take
207+
# advantage of :doc:`/gallery/subplots_axes_and_figures/gridspec_nested`, or
208+
# the :doc:`/users/next_whats_new/subfigures`.
205209

206-
fig = plt.figure()
207-
208-
gs1 = gridspec.GridSpec(2, 1)
209-
ax1 = fig.add_subplot(gs1[0])
210-
ax2 = fig.add_subplot(gs1[1])
211-
212-
example_plot(ax1)
213-
example_plot(ax2)
214-
215-
gs1.tight_layout(fig, rect=[0, 0, 0.5, 1])
216-
217-
gs2 = gridspec.GridSpec(3, 1)
218-
219-
for ss in gs2:
220-
ax = fig.add_subplot(ss)
221-
example_plot(ax)
222-
ax.set_title("")
223-
ax.set_xlabel("")
224-
225-
ax.set_xlabel("x-label", fontsize=12)
226-
227-
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
228-
229-
# We may try to match the top and bottom of two grids ::
230-
top = min(gs1.top, gs2.top)
231-
bottom = max(gs1.bottom, gs2.bottom)
232-
233-
gs1.update(top=top, bottom=bottom)
234-
gs2.update(top=top, bottom=bottom)
235-
plt.show()
236-
237-
###############################################################################
238-
# While this should be mostly good enough, adjusting top and bottom may
239-
# require adjustment of hspace also. To update hspace & vspace, we call
240-
# `.GridSpec.tight_layout` again with updated rect argument. Note that the
241-
# rect argument specifies the area including the ticklabels, etc. Thus, we
242-
# will increase the bottom (which is 0 for the normal case) by the difference
243-
# between the *bottom* from above and the bottom of each gridspec. Same thing
244-
# for the top.
245-
246-
fig = plt.gcf()
247-
248-
gs1 = gridspec.GridSpec(2, 1)
249-
ax1 = fig.add_subplot(gs1[0])
250-
ax2 = fig.add_subplot(gs1[1])
251-
252-
example_plot(ax1)
253-
example_plot(ax2)
254-
255-
gs1.tight_layout(fig, rect=[0, 0, 0.5, 1])
256-
257-
gs2 = gridspec.GridSpec(3, 1)
258-
259-
for ss in gs2:
260-
ax = fig.add_subplot(ss)
261-
example_plot(ax)
262-
ax.set_title("")
263-
ax.set_xlabel("")
264-
265-
ax.set_xlabel("x-label", fontsize=12)
266-
267-
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
268-
269-
top = min(gs1.top, gs2.top)
270-
bottom = max(gs1.bottom, gs2.bottom)
271-
272-
gs1.update(top=top, bottom=bottom)
273-
gs2.update(top=top, bottom=bottom)
274-
275-
top = min(gs1.top, gs2.top)
276-
bottom = max(gs1.bottom, gs2.bottom)
277-
278-
gs1.tight_layout(fig, rect=[None, 0 + (bottom-gs1.bottom),
279-
0.5, 1 - (gs1.top-top)])
280-
gs2.tight_layout(fig, rect=[0.5, 0 + (bottom-gs2.bottom),
281-
None, 1 - (gs2.top-top)],
282-
h_pad=0.5)
283210

284211
###############################################################################
285212
# Legends and Annotations

0 commit comments

Comments
 (0)