We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Under "Adding texture to mesh", the texture is rotated in the wrong direction.
Additional context This code should deliver a solution:
from matplotlib.pyplot import get_cmap
zz = grid['values'].reshape(1201,662)
cmap = cmap_seismic #get_cmap("nipy_spectral") norm = lambda x: (x - np.nanmin(x)) / (np.nanmax(x) - np.nanmin(x)) hue = norm(zz.ravel()) colors = (cmap(hue)[:, 0:3] * 255.0).astype(np.uint64) image = colors.reshape((1201, 662, 3), order="F")
tex = pv.numpy_to_texture(image)
grid.plot(texture=tex)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Under "Adding texture to mesh", the texture is rotated in the wrong direction.
Additional context
This code should deliver a solution:
from matplotlib.pyplot import get_cmap
create an image using numpy,
zz = grid['values'].reshape(1201,662)
Creating a custom RGB image
cmap = cmap_seismic #get_cmap("nipy_spectral")
norm = lambda x: (x - np.nanmin(x)) / (np.nanmax(x) - np.nanmin(x))
hue = norm(zz.ravel())
colors = (cmap(hue)[:, 0:3] * 255.0).astype(np.uint64)
image = colors.reshape((1201, 662, 3), order="F")
Convert 3D numpy array to texture
tex = pv.numpy_to_texture(image)
Render it
grid.plot(texture=tex)
The text was updated successfully, but these errors were encountered: