.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "user-guide/usage/visualization/plot_2_cell.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_user-guide_usage_visualization_plot_2_cell.py: *************** Plotting a cell *************** This page explains how to use :py:func:`wulfric.PlotlyEngine.plot_cell` on the simple example of the cubic cell We use FCC cell as an example. .. GENERATED FROM PYTHON SOURCE LINES 31-37 .. code-block:: Python import wulfric cell = wulfric.cell.SC_FCC(a=3) .. GENERATED FROM PYTHON SOURCE LINES 38-39 To display the cell with the default settings use .. GENERATED FROM PYTHON SOURCE LINES 39-46 .. code-block:: Python pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True) pe.plot_cell(cell=cell) pe.show() .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 47-49 Legend and style ================ .. GENERATED FROM PYTHON SOURCE LINES 49-56 .. code-block:: Python pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True) pe.plot_cell(cell=cell, legend_label="Direct cubic cell", color="green") pe.show() .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 57-59 Hiding lattice vectors ====================== .. GENERATED FROM PYTHON SOURCE LINES 59-66 .. code-block:: Python pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True) pe.plot_cell(cell=cell, plot_vectors=False) pe.show() .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 67-72 Shifting origin point ===================== By default lattice vectors are plotted from the :math:`(0, 0, 0)` of the global of the global reference frame. One can shift this reference point. .. GENERATED FROM PYTHON SOURCE LINES 72-80 .. code-block:: Python 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() .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 81-85 Two cells ========= One can plot any number of cells on one instance of :py:class:`wulfric.PlotlyEngine`. For example, one can plot direct and reciprocal cell together .. GENERATED FROM PYTHON SOURCE LINES 85-99 .. code-block:: Python 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() .. raw:: html


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.192 seconds) .. _sphx_glr_download_user-guide_usage_visualization_plot_2_cell.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_2_cell.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_2_cell.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_2_cell.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_