Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd96fa55

Browse files
committed
MNT: Restore auto-adding Axes3D to their parent figure on init
Only do this when directly created by the user, not via our machinery.
1 parent56d9e7c commitd96fa55

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎lib/matplotlib/figure.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,9 @@ def _process_projection_requirements(
15171517
raiseTypeError(
15181518
f"projection must be a string, None or implement a "
15191519
f"_as_mpl_axes method, not{projection!r}")
1520-
1520+
ifprojection_class.__name__=='Axes3D':
1521+
print(f'{projection_class=}')
1522+
kwargs['__internal']=True
15211523
returnprojection_class,kwargs
15221524

15231525
defget_default_bbox_extra_artists(self):

‎lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ def __init__(
9696
ifsharezisnotNone:
9797
self._shared_z_axes.join(self,sharez)
9898
self._adjustable='datalim'
99-
99+
internal_call=kwargs.pop('__internal',False)
100100
super().__init__(
101101
fig,rect,frameon=True,box_aspect=box_aspect,*args,**kwargs
102102
)
103+
103104
# Disable drawing of axes by base class
104105
super().set_axis_off()
105106
# Enable drawing of axes by Axes3D class
@@ -128,6 +129,8 @@ def __init__(
128129
# mplot3d currently manages its own spines and needs these turned off
129130
# for bounding box calculations
130131
self.spines[:].set_visible(False)
132+
ifnotinternal_call:
133+
fig.add_axes(self)
131134

132135
defset_axis_off(self):
133136
self._axis3don=False

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp