.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "user-guide/usage/visualization/plot_7_subplots.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_7_subplots.py: ******** Subplots ******** This page explains how to make subplots. .. GENERATED FROM PYTHON SOURCE LINES 29-57 .. code-block:: Python import wulfric import numpy as np cell = np.array( [ [5.64, 0.00, 0.00], [0.00, 5.64, 0.00], [0.00, 0.00, 5.64], ] ) atoms = { "names": ["Cl1", "Cl2", "Cl3", "Cl4", "Na1", "Na2", "Na3", "Na4"], "positions": np.array( [ (0, 0, 0), (1 / 2, 1 / 2, 0), (1 / 2, 0, 1 / 2), (0, 1 / 2, 1 / 2), (1 / 2, 1 / 2, 1 / 2), (1 / 2, 0, 0), (0, 1 / 2, 0), (0, 0, 1 / 2), ] ), } spglib_data = wulfric.get_spglib_data(cell, atoms) .. GENERATED FROM PYTHON SOURCE LINES 58-62 one and brillouin zone and k-path on another. First difference from usual plot is at the moment of engine creation. One needs to specify the grid of the subplots .. GENERATED FROM PYTHON SOURCE LINES 62-65 .. code-block:: Python pe = wulfric.PlotlyEngine(_sphinx_gallery_fix=True, rows=1, cols=2) .. GENERATED FROM PYTHON SOURCE LINES 66-71 Second change is at the moment of plotting. Every ``plot_...`` function can take two optional arguments ``row`` and ``col``. They specify on which subplot to plot the data. Both start from ``1``. ``row=1, col=1`` is top left subplot. Plot original cell and atoms on the first row an first column .. GENERATED FROM PYTHON SOURCE LINES 71-75 .. code-block:: Python pe.plot_atoms(cell=cell, atoms=atoms, row=1, col=1, legend_label="original atoms") pe.plot_cell(cell=cell, row=1, col=1, legend_label="original cell") .. GENERATED FROM PYTHON SOURCE LINES 76-77 Then plot brillouin zone, k-path and k-points on the first row and second column .. GENERATED FROM PYTHON SOURCE LINES 77-95 .. code-block:: Python kp = wulfric.Kpoints.from_crystal( cell, atoms, spglib_data=spglib_data, convention="HPKOT" ) prim_cell, _ = wulfric.crystal.get_primitive(cell, atoms, spglib_data=spglib_data) pe.plot_brillouin_zone( cell=prim_cell, color="red", legend_label="Brillouin zone of the primitive cell", row=1, col=2, ) pe.plot_kpath(kp=kp, legend_label="K-path", row=1, col=2) pe.plot_kpoints(kp=kp, legend_label="K-points", row=1, col=2) pe.show() .. raw:: html


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