From de8d2653889de841a319e0430a61ec439b71a422 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 13 Dec 2022 17:45:21 +0100 Subject: [PATCH] Add note that users do not instantiate Axes directly Closes #24639. --- lib/matplotlib/axes/_axes.py | 6 ++++++ lib/mpl_toolkits/mplot3d/axes3d.py | 6 ++++++ tutorials/toolkits/mplot3d.py | 4 ---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index cb1d4c989c23..e1384b8612ab 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -55,6 +55,12 @@ class Axes(_AxesBase): are 'xlim_changed' and 'ylim_changed' and the callback will be called with func(*ax*) where *ax* is the `Axes` instance. + .. note:: + + As a user, you do not instantiate Axes directly, but use Axes creation + methods instead; e.g. from `.pyplot` or `.Figure`: + `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` or `.Figure.add_axes`. + Attributes ---------- dataLim : `.Bbox` diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index c50601246376..1395a990b2c2 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -45,6 +45,12 @@ class Axes3D(Axes): """ 3D Axes object. + + .. note:: + + As a user, you do not instantiate Axes directly, but use Axes creation + methods instead; e.g. from `.pyplot` or `.Figure`: + `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` or `.Figure.add_axes`. """ name = '3d' diff --git a/tutorials/toolkits/mplot3d.py b/tutorials/toolkits/mplot3d.py index 49188e9f392f..fe3ee3a6267e 100644 --- a/tutorials/toolkits/mplot3d.py +++ b/tutorials/toolkits/mplot3d.py @@ -24,10 +24,6 @@ :target: ../../gallery/mplot3d/subplot3d.html :align: center -.. versionchanged:: 1.0.0 - Prior to Matplotlib 1.0.0, only a single `.Axes3D` could be created per - figure; it needed to be directly instantiated as ``ax = Axes3D(fig)``. - .. versionchanged:: 3.2.0 Prior to Matplotlib 3.2.0, it was necessary to explicitly import the :mod:`mpl_toolkits.mplot3d` module to make the '3d' projection to
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: