Note
Go to the end to download the full example code.
Plotting a cell#
This page explains how to use wulfric.PlotlyEngine.plot_cell() on the simple
example of the cubic cell
We use FCC cell as an example.
import wulfric
cell = wulfric.cell.SC_FCC(a=3)
To display the cell with the default settings use
pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
pe.plot_cell(cell=cell)
pe.show()
Legend and style#
pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
pe.plot_cell(cell=cell, legend_label="Direct cubic cell", color="green")
pe.show()
Hiding lattice vectors#
pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
pe.plot_cell(cell=cell, plot_vectors=False)
pe.show()
Shifting origin point#
By default lattice vectors are plotted from the \((0, 0, 0)\) of the global of the global reference frame. One can shift this reference point.
pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
# shift is given in the absolute units of the global reference frame
pe.plot_cell(cell=cell, shift=(1, -1, 0.5))
pe.show()
Two cells#
One can plot any number of cells on one instance of wulfric.PlotlyEngine.
For example, one can plot direct and reciprocal cell together
pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True)
# Plot direct cell
pe.plot_cell(cell=cell, legend_label="Direct cell", color="blue")
# Get reciprocal cell
rcell = wulfric.cell.get_reciprocal(cell=cell)
# Plot reciprocal cell
pe.plot_cell(cell=rcell, legend_label="Reciprocal cell", color="red")
pe.show()
Total running time of the script: (0 minutes 0.192 seconds)