Skip to content
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

vedo, formerly known as vtkplotter #361

Closed
gdmcbain opened this issue Apr 7, 2020 · 6 comments · Fixed by #748
Closed

vedo, formerly known as vtkplotter #361

gdmcbain opened this issue Apr 7, 2020 · 6 comments · Fixed by #748

Comments

@gdmcbain
Copy link
Contributor

gdmcbain commented Apr 7, 2020

As noted in #44, matplotlib distorts three-dimensional views uncontrollably. Some very nice plots were added to #357 using vtkplotter. It might be a worthwhile addition to skfem.visuals #286. (I haven't looked at the licence or portability.)

@kinnala
Copy link
Owner

kinnala commented Apr 7, 2020

License seems to be MIT. I don't oppose this, the plots look great. I'll try to get it working on my Python setup and try it out.

@gdmcbain
Copy link
Contributor Author

A quick experiment went well.

On a laptop running Microsoft Windows 10

pip install vtkplotter

Then after having run ex32.py from #342, run

from vtkplotter import Plotter

vp = Plotter()
vp.load('ex32.vtk')
vp.show()

This pops up a 'Visualization Toolkit Win32OpenGL' showing a green triangulated ellipsoid which can be rotated, translated, and zoomed with the mouse.

  • Hit 'h' in this window to display help back in the terminal.
  • Hit '4' to cycle through scalars to colour by; here twice for pressure.
  • Hit 's' to save screenshot.png.

screenshot

This does nicely show the p ~xy pattern expected from creeping convection in a horizontally heated ellipsoid.

I assume this could be scripted, once I read the docs.

@gdmcbain
Copy link
Contributor Author

To generate a PNG rather than a window,

from vtkplotter import Plotter, screenshot

vp = Plotter(offscreen=True)
...
screenshot('ex32.png')

See marcomusy/vedo#55.

That saves the PNG without throwing up a window; however, it doesn't colour by pressure. The answer to that might be in marcomusy/vedo#131.

@gdmcbain
Copy link
Contributor Author

Here we go:

from vtkplotter import Plotter, screenshot

Plotter(offscreen=True).load("ex32.vtk").pointColors("pressure").show()
screenshot("ex32.png")

@gdmcbain
Copy link
Contributor Author

gdmcbain commented May 8, 2020

I'd deferred this as it wasn't working on my Ubuntu 19.10 desktop (something about nvidia nouveau); as mentioned the previous work had been done under Microsoft Windows 10.

Yesterday I updated the desktop to Ubuntu 20.04 LTS and it's working fine. Here's a recipe.

  • conda 4.8.3 # from Miniconda3-latest-Linux-x86_64.sh
  • python=3.7 in a conda create # gives Python 3.7.7
  • conda install vtk
  • pip install vtkplotter

@kinnala
Copy link
Owner

kinnala commented May 26, 2020

I've been encountering issues trying to run this in a docker container, I'm only developing inside containers nowadays.

I think I have to next try it out in a Ubuntu 20.04 virtual machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants