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

Skip to content

Add note that users do not instantiate Axes directly #24715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2022
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
6 changes: 6 additions & 0 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
6 changes: 6 additions & 0 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
4 changes: 0 additions & 4 deletions tutorials/toolkits/mplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)``.
Comment on lines -27 to -29
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so ancient that there is little value in keeping, and the stated way of creation is not recommended anymore. So it's simplest to remove completely.


.. 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
Expand Down