99from matplotlib .image import AxesImage as _AxesImage
1010from matplotlib .patches import StepPatch as _StepPatch
1111from matplotlib .text import Text as _Text
12- from matplotlib .collections import LineCollection as _LineCollection
12+ from matplotlib .collections import LineCollection as _LineCollection , PathCollection as _PathCollection
1313from matplotlib .artist import Artist as _Artist
1414
1515from data_prototype .containers import DataContainer , _Transform
@@ -176,7 +176,7 @@ class LineWrapper(ProxyWrapper):
176176
177177 def __init__ (self , data : DataContainer , nus = None , / , ** kwargs ):
178178 super ().__init__ (data , nus )
179- self ._wrapped_instance = self ._wrapped_class ([], [] , ** kwargs )
179+ self ._wrapped_instance = self ._wrapped_class (np . array ([]), np . array ([]) , ** kwargs )
180180
181181 @_stale_wrapper
182182 def draw (self , renderer ):
@@ -188,6 +188,33 @@ def draw(self, renderer):
188188 def _update_wrapped (self , data ):
189189 self ._wrapped_instance .set_data (data ["x" ], data ["y" ])
190190
191+ class PathCollectionWrapper (ProxyWrapper ):
192+ _wrapped_class = _PathCollection
193+ _privtized_methods = (
194+ "set_facecolors" , "set_edgecolors" , "set_offsets" , "set_sizes" , "set_paths" ,
195+ "get_facecolors" , "get_edgecolors" , "get_offsets" , "get_sizes" , "get_paths" ,
196+ )
197+
198+ def __init__ (self , data : DataContainer , nus = None , / , ** kwargs ):
199+ super ().__init__ (data , nus )
200+ self ._wrapped_instance = self ._wrapped_class ([], ** kwargs )
201+
202+ @_stale_wrapper
203+ def draw (self , renderer ):
204+ self ._update_wrapped (
205+ self ._query_and_transform (renderer , xunits = ["x" ], yunits = ["y" ]),
206+ )
207+ return self ._wrapped_instance .draw (renderer )
208+
209+ def _update_wrapped (self , data ):
210+ print (data )
211+ self ._wrapped_instance .set_offsets (np .array ([data ["x" ], data ["y" ]]).T )
212+ self ._wrapped_instance .set_paths (data ["paths" ])
213+ self ._wrapped_instance .set_facecolors (data ["facecolors" ])
214+ self ._wrapped_instance .set_edgecolors (data ["edgecolors" ])
215+ self ._wrapped_instance .set_sizes (data ["sizes" ])
216+
217+
191218
192219class ImageWrapper (ProxyWrapper ):
193220 _wrapped_class = _AxesImage
0 commit comments