You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the API of the plotter.add_artist requires the type and and instance of the plot artist to be added:
defadd_artist(self, artist_type: ArtistType, artist_instance: Scatter|Histogram2D, visible: bool=False):
""" Adds a new artist instance to the artists dictionary. Parameters ---------- artist_type : ArtistType The type of the artist, defined by the ArtistType enum. artist_instance : Scatter or Histogram2D An instance of the artist class. """
Wouldn't it be easier for the API to just pass the instance and derive the type inside the function? like, so:
defadd_artist(self, artist_instance: Scatter|Histogram2D, visible: bool=False):
""" Adds a new artist instance to the artists dictionary. Parameters ---------- artist_instance : Scatter or Histogram2D An instance of the artist class. """artist_type=type(artist_instance)
The text was updated successfully, but these errors were encountered:
That indeed would be simpler! Currently, I use ArtistType and SelectorType as keys to dictionaries (self.artists and self.selectors) whose values are the corresponding instances. Those dictionaries are used to check which artists or selectors were added to the CanvasWidget, but indeed the type does not seem necessary in the add_... method. If your implementation works, then it should also be applied to add_selector.
Could you send a PR? I would test and soon merge it.
Hi @zoccoler ,
I noticed that the API of the
plotter.add_artist
requires the type and and instance of the plot artist to be added:Wouldn't it be easier for the API to just pass the instance and derive the type inside the function? like, so:
The text was updated successfully, but these errors were encountered: