Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/users/dflt_style_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ a cleaner separation between subplots.
with mpl.rc_context(rc=rcparams):

ax = fig.add_subplot(2, 2, j)
ax.hist(np.random.beta(0.5, 0.5, 10000), 25, normed=True)
ax.hist(np.random.beta(0.5, 0.5, 10000), 25, density=True)
ax.set_xlim([0, 1])
ax.set_title(title)

Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,8 @@ def _warn_external(message, category=None):
frame = sys._getframe()
for stacklevel in itertools.count(1): # lgtm[py/unused-loop-variable]
if not re.match(r"\A(matplotlib|mpl_toolkits)(\Z|\.)",
frame.f_globals["__name__"]):
# Work around sphinx-gallery not setting __name__.
frame.f_globals.get("__name__", "")):
break
frame = frame.f_back
warnings.warn(message, category, stacklevel)
Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/cbook/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def warn_deprecated(
removal=removal)
category = (PendingDeprecationWarning if pending
else MatplotlibDeprecationWarning)
warnings.warn(message, category, stacklevel=2)
from . import _warn_external
_warn_external(message, category)


def deprecated(since, message='', name='', alternative='', pending=False,
Expand Down Expand Up @@ -216,7 +217,8 @@ def finalize(wrapper, new_doc):
else MatplotlibDeprecationWarning)

def wrapper(*args, **kwargs):
warnings.warn(message, category, stacklevel=2)
from . import _warn_external
_warn_external(message, category)
return func(*args, **kwargs)

old_doc = textwrap.dedent(old_doc or '').strip('\n')
Expand Down