I am trying to plot 3D scalar data on a non-orthogonal grid (this can be viewed as an affine transformation of a uniform orthogonal coordinate grid). However, plotly seems to not be able to handle this right now. Here is some code that reproduces this:
import numpy as np
from plotly.offline import plot
import plotly.graph_objects as go
grid_vecs = np.array([[-2.5, -2.16506, -3],
[5, 0, 0],
[2.5, 4.33012, 0],
[0, 0, 6]])
grid_x, grid_y, grid_z = np.mgrid[0.:1.:20j, 0.:1.:20j, 0.:1.:20j]
meshX = grid_vecs[1,0]*grid_x + grid_vecs[2,0]*grid_y + grid_vecs[3,0]*grid_z + grid_vecs[0,0]
meshY = grid_vecs[1,1]*grid_x + grid_vecs[2,1]*grid_y + grid_vecs[3,1]*grid_z + grid_vecs[0,1]
meshZ = grid_vecs[1,2]*grid_x + grid_vecs[2,2]*grid_y + grid_vecs[3,2]*grid_z + grid_vecs[0,2]
scalar = meshX**2+meshY**2+meshZ**2
fig= go.Figure(data=go.Volume(
x=meshX.flatten(),
y=meshY.flatten(),
z=meshZ.flatten(),
# x=grid_x.flatten(),
# y=grid_y.flatten(),
# z=grid_z.flatten(),
value=scalar.flatten(),
isomin=0,
isomax=3,
opacity=0.1,
surface_count=12,
))
plot(fig)
When you set the x/y/z variables to be meshX/Y/Z, the plot axes will show, but no data appears. (However, when you switch the x/y/z variables to be grid_X/Y/Z, the data will render in a orthogonal grid.) Is there any current way to support 3D data on a non-orthogonal grid? Note that my full datasets are too large to interpolate onto an orthogonal grid.