GithubHelp home page GithubHelp logo

Comments (5)

GuillaumeFavelier avatar GuillaumeFavelier commented on June 20, 2024

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.

from pyvista-support.

banesullivan avatar banesullivan commented on June 20, 2024

It's not your code, it's panel's converter to VTKjs (see holoviz/panel#408).

At the moment, we are using panel's export script rather than ours to convert the scene to VTKjs when making the embeddable rendering scenes; there are a number of bugs (and most of those bugs exist in our script too). We need to move forward with bug fixing the export script in PyVista to work with panel to avoid this issue.

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.

from pyvista-support.

banesullivan avatar banesullivan commented on June 20, 2024

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()

Screen Shot 2019-06-17 at 8 30 12 AM

from pyvista-support.

GuillaumeFavelier avatar GuillaumeFavelier commented on June 20, 2024

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 Normals which is displayed by default then?

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.

from pyvista-support.

banesullivan avatar banesullivan commented on June 20, 2024

So out of curiosity, is it the array of Normals which is displayed by default then?

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 still need to try K3D myself to have a better understanding of its capabilities.

I definitely need to look into it more as well

from pyvista-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.