Skip to content

[Bug]: Axes3D.set_frame_on not working as documented #24689

@oscargus

Description

@oscargus

Bug summary

Axes3D.set_frame_on is documented as "Set whether the 3D axes panels are drawn.". However, this is really what set_axis_on and set_axis_off does (and set_frame_on doesn't do). (There is also get_frame_on.)

def get_frame_on(self):
"""Get whether the 3D axes panels are drawn."""
return self._frameon
def set_frame_on(self, b):
"""
Set whether the 3D axes panels are drawn.
Parameters
----------
b : bool
"""
self._frameon = bool(b)
self.stale = True

def set_axis_off(self):
self._axis3don = False
self.stale = True
def set_axis_on(self):
self._axis3don = True
self.stale = True

Code for reproduction

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d

X, Y, Z = axes3d.get_test_data(0.05)
ax1 = plt.subplot(1, 2, 1, projection="3d")
ax1.plot_wireframe(X, Y, Z)
ax2 = plt.subplot(1, 2, 2, projection="3d")
ax2.plot_wireframe(X, Y, Z)
ax2.set_frame_on(False)

Actual outcome

Nothing is affected by set_frame_on.

image

Expected outcome

It should do as documented.

image

Additional information

self._frameon is set to False in draw. However removing this line does not change anything anyway.

self._frameon = False

I think that there are a few options:

  1. Remove Axes3D.set_frame_on and get_frame_on. However, these will then be inherited from Axes, so not a good idea (although nothing is changed, documentation just more confusing).
  2. Make Axes3D.set_frame_on call set_axis_on/off, keep both.
  3. Make Axes3D.set_frame_on modify self._axison instead and deprecate set_axis_on/off.

The documentation for *_frame_on should be adapted to set_axis_* if kept and a get_axis_on method should probably be added.

Operating system

No response

Matplotlib Version

main

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

git checkout

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions