pyvista
pyvista copied to clipboard
pythreejs Plotter support for point labels
Describe the feature you would like to be added.
The pythreejs plotter currently does not support point labels. It'd be nice to have this since the pythreejs/jupyterlab integration is really nice.
I've poked around a bit and found:
- Pyvista's pythreejs adapter works by converting the actors in the VTK plotter to their pythreejs equivalents
-
Plotter.add_point_labels(..., show_points=True)
adds two actors:
- an actor whose
GetMapper().GetInputAsDataSet()
returns a PolyData with the corresponding points, and label values stored inpoint_data['labels']
- an actor whose
GetMapper()
returns avtkLabelPlacementMapper
that does not have aGetInputAsDataSet
method
- with
Plotter.add_point_labels(..., show_points=False)
, only the latter of the two actors above is added
It seems like it'd be pretty easy to pull points and labels out of that first actor, and represent them as pythreejs TextGeometry
objects, but if show_points=False
is used, I don't know how to get the points/labels out of that vtkLabelPlacementMapper
.
cc @akaszynski, I think you did all the original pythreejs work?
Links to VTK Documentation, Examples, or Class Definitions.
No response
Pseudocode or Screenshots
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
It'd be nice to have this since the pythreejs/jupyterlab integration is really nice.
Fully agree. It's a missing feature I've been meaning to add.
cc @akaszynski, I think you did all the original pythreejs work?
Yes, and it's a bit of work, not sure how much I'll be able to maintain it without help.
Yes, and it's a bit of work
I'm sure! I'm happy to submit a PR here, just not sure how to use the vtkLabelPlacementMapper. Or do you think it'd be ok to just require the original add_point_labels
have use show_points=True
?
Yes, and it's a bit of work
I'm sure! I'm happy to submit a PR here, just not sure how to use the vtkLabelPlacementMapper. Or do you think it'd be ok to just require the original
add_point_labels
haveuse show_points=True
?
I think that's acceptable. Just as long as you raise a helpful ValueError
to let the user know what the issue is.
Ah, looks like pythreejs hasn't implemented TextGeometry yet https://github.com/jupyter-widgets/pythreejs/issues/199
Closing as we don't plan on further developing the pythreejs
jupyter backend. This may be possible with the new trame-based backend in the future, but is also currently limited by VTK.js not support text actors