Conversation
| @@ -212,6 +206,10 @@ def color(self) -> np.ndarray: | |||
| def color(self, val: np.ndarray): | |||
| self.geometry.attributes['color'].array = val | |||
There was a problem hiding this comment.
I think it would be useful if we can fix something else here also. Currently, if you make a scatter
f = pp.scatter3d(da, pos='position', color='black', size=2)
artist, = f.view.artists.values()if you try to update the color of the artist with
artist.color = 'red'it fails, because the setter expects a numpy array with the correct size.
Can we support the above by doing more work here depending on input type/shape?
If it's a string or a tuple or a 1d numpy array (of length 3 or 4), then broadcast to the full array using self._make_colors, and just set the array otherwise?
self._color should then probably be updated in the setter also.
We could then maybe add an accessor to the self._color like single_color or html_color which would be None if a colormapper is in use (html_color is probably not great because we store it as a rgb, and rgb_color could be confusing because the current .color also returns rgb colors, just a large array of them).
Below in clip3d.py, we could then just have something like
self._view.artists[node.id].color = self._view.artists[source_id].single_color| self._nodes.clear() | ||
|
|
||
| self.update_state() | ||
| if self._view.colormapper is None: |
There was a problem hiding this comment.
Does it have to be done every time we update the controls or only when a cut is added? Meaning: can we avoid doing this also when a cut is removed?
Edit: looking more at the logic, I think this has to be called here.
Say we had 2 cuts: one in X and another in Y.
When we remove the Y cut, we are basically removing the old additional scatter that contained both X and Y selections, to now only have the selection for X. We are adding this new scatter and the colors need to be synced also.
Fixes #384