@@ -62,31 +62,11 @@ class ExternalAxesContainer(CartesianAxes):
6262 """
6363
6464 _EXTERNAL_DELEGATE_BLOCKLIST = {
65- # Keep container overrides that mark external axes stale.
66- "plot" ,
67- "scatter" ,
68- "fill" ,
69- "contour" ,
70- "contourf" ,
71- "pcolormesh" ,
72- "tripcolor" ,
73- "tricontour" ,
74- "tricontourf" ,
75- "triplot" ,
76- "imshow" ,
77- "hexbin" ,
7865 # Keep UltraPlot formatting/guide behaviors on the container.
7966 "format" ,
8067 "colorbar" ,
8168 "legend" ,
8269 "set_title" ,
83- "set_suptitle" ,
84- "set_xlabel" ,
85- "set_ylabel" ,
86- "set_zlabel" ,
87- "set_xticks" ,
88- "set_yticks" ,
89- "set_zticks" ,
9070 }
9171
9272 def __init__ (
@@ -827,32 +807,18 @@ def get_tightbbox(self, renderer, *args, **kwargs):
827807
828808 def __getattr__ (self , name ):
829809 """
830- Delegate attribute access to the external axes when not found on container.
831-
832- This allows the container to act as a transparent wrapper, forwarding
833- plotting methods and other attributes to the external axes.
810+ Delegate missing attributes to the external axes unless blocked.
834811 """
812+ if name in self ._EXTERNAL_DELEGATE_BLOCKLIST :
813+ raise AttributeError (
814+ f"'{ type (self ).__name__ } ' object has no attribute '{ name } '"
815+ )
816+ if self ._external_axes is not None :
817+ return getattr (self ._external_axes , name )
835818 raise AttributeError (
836819 f"'{ type (self ).__name__ } ' object has no attribute '{ name } '"
837820 )
838821
839- def __getattribute__ (self , name ):
840- """
841- Prefer external axes attributes unless explicitly blocked.
842- """
843- if name .startswith ("_" ):
844- return object .__getattribute__ (self , name )
845- blocklist = object .__getattribute__ (self , "_EXTERNAL_DELEGATE_BLOCKLIST" )
846- if name in blocklist :
847- return object .__getattribute__ (self , name )
848- try :
849- external = object .__getattribute__ (self , "_external_axes" )
850- except AttributeError :
851- external = None
852- if external is not None and hasattr (external , name ):
853- return getattr (external , name )
854- return object .__getattribute__ (self , name )
855-
856822 def __dir__ (self ):
857823 """Include external axes attributes in dir() output."""
858824 attrs = set (super ().__dir__ ())
0 commit comments