You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import pyvista as pv
import numpy as np
pv.set_plot_theme("document")
data = np.load('corr.npy')
print(data.shape)
values = data[0, :22, :22, :22, 4]
# Create the spatial reference
grid = pv.UniformGrid()
# Set the grid dimensions: shape + 1 because we want to inject our values on
# the CELL data
grid.dimensions = np.array(values.shape) + 1
# Edit the spatial reference
grid.origin = (100, 33, 55.6) # The bottom left corner of the data set
grid.spacing = (1, 1, 1) # These are the cell sizes along each axis
# Add the data values to the cell data
grid.cell_arrays["values"] = values.flatten(order="F") # Flatten the array!
grid.plot(show_edges=False, cmap='jet', show_axes=False, show_scalar_bar=False, off_screen=True, screenshot='corr1.png')
#grid.plot(show_edges=False, show_axes=False, show_scalar_bar=False)
The text was updated successfully, but these errors were encountered:
Code for plotting the microstructure with a gray scale:
import pyvista as pv
import numpy as np
pv.set_plot_theme("document")
values = np.linspace(0, 10, 1000).reshape((20, 5, 10))
data = np.load('3d.npy')
print(data.shape)
print(values.shape)
values = data[9]
# Create the spatial reference
grid = pv.UniformGrid()
# Set the grid dimensions: shape + 1 because we want to inject our values on
# the CELL data
grid.dimensions = np.array(values.shape) + 1
# Edit the spatial reference
grid.origin = (100, 33, 55.6) # The bottom left corner of the data set
grid.spacing = (1, 1, 1) # These are the cell sizes along each axis
# Add the data values to the cell data
grid.cell_arrays["values"] = values.flatten(order="F") # Flatten the array!
# Now plot the grid!
# import ipdb; ipdb.set_trace()
# pv.remove_scalar_bar()
# plotter = pv.Plotter(off_screen=True)
# plotter.add_mesh(grid)#,
# import ipdb; ipdb.set_trace()
# plotter.show(screenshot='plot1.png', show_edges=False)
grid.plot(show_edges=False, cmap=['black', 'grey', 'white'], show_axes=False, show_scalar_bar=False, off_screen=False, screenshot='plot4.png')
Code for plotting correlations with pyvista
The text was updated successfully, but these errors were encountered: