-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RGBA color support inside a Jupyter Notebook #15
Comments
Now that I think about it, maybe this could be fixed by #258 ? Well, it's also possible that my code snippet isn't correct. |
It's not your code, it's At the moment, we are using Perhaps pyvista/pyvista#258 would be a better approach and more worth our time. K3D seems far more robust than VTKjs so maybe we should focus on creating a way to display PyVista scenes with K3D rather than fixing the VTKjs script. |
Also, I've found a hack of a fix. If you only have a single array present in the dataset you'd like to send to VTKjs, it'll work: import pyvista as pv
import numpy as np
sphere = pv.Sphere()
scalars = np.ones((sphere.GetNumberOfPoints(), 4)) * 255.0
scalars = scalars.astype('ubyte')
# ONLY have one array present for VTKjs
# del sphere.point_arrays['Normals']
sphere.clear_arrays()
p = pv.Plotter()
p.add_mesh(sphere, rgba=True, scalars=scalars)
p.show() |
This hack is already amazing as a short-term solution, thank you so much! I will try it. So out of curiosity, is it the array of And the choice between K3D and VTKjs looks like a dilemma. Even if I looked their showcase gallery, I still need to try K3D myself to have a better understanding of its capabilities. |
The VTKjs export script has trouble choosing the active array. It always grabs the array at the 0th index so if you remove all other arrays other than what you want to plot it should work fine.
I definitely need to look into it more as well |
When I use RGBA colors inside a Jupyter Notebook, I obtain an unexpected result:
When I run this script natively, I get the right result of course:
The text was updated successfully, but these errors were encountered: