Volumetric plot?

Hi,

I am considering putting some simple volumetric plots in my package. A previous MATLAB version of this project had simple volumetric plots based on Gouraud-shaded 3d triangular meshes with transparency. However, I don’t think that matplotlib (which is what I currently use) supports those.

Is there a no-nonsense package for volumetric plots?

This is all happening in jupyter lab on a Mac, if that matters. I think I may have asked the same question here years ago, but the packages I tried then ended up not working.

Thanks!

S

1 Like

Something like this is in GridVisualize.jl (I am the author).

using ExtendableGrids,GridVisualize,GLMakie
X=-1:0.05:1
g=simplexgrid(X,X,X)
f=map((x,y,z)->exp(-2(x^2+y^2+z^2)),g)
scalarplot(g,f,Plotter=GLMakie)

2 Likes

I’ll give it a shot. I have “unstructured meshes” of tetrahedra (not a 3d tensor on a regular grid), is that supported?

Yes, this is supported. In fact this is all what is supported, the simplexgrid call creates a tetmesh.

Look for an appropriate constructor in

I may add some more if there is some need.

Thanks for this.

I was reading the documentation you linked. I’m not sure I understand all the parameters of your constructor. I can probably come up with some sort of coord and cellnodes but what’s the other three parameters?

S

These are the connectivity for a boundary (codim1) subgrid,
and material markers for cells and boundaries. This comes
from the context of boundary value problems for PDEs.

What should work immediately is the following:

  • cellregions=ones(Int, size(cellnodes,2))
  • bfacenodes: just one triangle of your first cell
  • bfaceregions=ones(Int, size(bfacenodes,2))

Also, if your coordinates are stored as points, you probably can convert them to the matrix using reinterpret, as to avoid to copy the data.

That said, I have plans to streamline this to an API which works just with coords, tets and values, and possibly also with meshes from GeometryBase etc. but never took the time to get through with this.

I may have another look at this in the next couple of days.

Just registering the new version 1.8. This will allow to do e.g.

scalarplot(coord, cellnodes, funcvalues; Plotter=GLMakie