Skip to content

Axes3d attaches itself to a figure, where as Axes does not #18364

@jklymak

Description

@jklymak
import matplotlib.pyplot as plt
import matplotlib.axes as maxes

fig = plt.figure()
ax = maxes.Axes(fig, [0.1, 0.1, 0.9, 0.9])
print(fig.get_children())

returns a list with no axes....

[<matplotlib.patches.Rectangle object at 0x7f8d75707dc0>]

For 3-d

import matplotlib.pyplot as plt
import matplotlib.axes as maxes
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = Axes3D(fig)
print(fig.get_children())

has the axes attached:

[<matplotlib.patches.Rectangle object at 0x7fbc2968d160>, <mpl_toolkits.mplot3d.axes3d.Axes3D object at 0x7fbc2968df40>]

Axes3D.__init__ explicitly adds itself to its parent:

self.figure.add_axes(self)

whereas no such thing happens for the base Axes class.

Discovered as part of #18356, but discussing here because its orthogonal. But I think the behaviour here should be the same .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      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:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy