.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plotting/plotting_different_units.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_examples_plotting_plotting_different_units.py: Plotting using Different Units ============================== Sometimes you might want to plot using different units, such as pixel coordinates, or mrad or nm^-1. Pyxem makes it easy to plot using different units. This does require certain calibration information to be set, such as the beam energy and the pixel size. .. GENERATED FROM PYTHON SOURCE LINES 10-20 .. code-block:: Python from pyxem.data import fe_multi_phase_grains multi_phase = fe_multi_phase_grains() multi_phase.calibration.beam_energy = 200 # Set the beam energy to 200 keV multi_phase.calibration.physical_pixel_size = 15e-6 # Set the pixel size to 15 um multi_phase.calibration.units = "nm^-1" # Set the units to nm^-1 multi_phase.calibration.scale = 0.1 # Set the scale to 0.1 nm^-1 .. GENERATED FROM PYTHON SOURCE LINES 21-22 Plotting the diffraction pattern using pixel coordinates .. GENERATED FROM PYTHON SOURCE LINES 22-23 .. code-block:: Python multi_phase.plot(units="px") .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_001.png :alt: plotting different units :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_002.png :alt: Signal :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_002.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 24-25 Plotting the diffraction pattern using mrad .. GENERATED FROM PYTHON SOURCE LINES 25-26 .. code-block:: Python multi_phase.plot(units="mrad") .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_003.png :alt: plotting different units :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_004.png :alt: Signal :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_004.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 27-28 Plotting the diffraction pattern using A^-1 .. GENERATED FROM PYTHON SOURCE LINES 28-29 .. code-block:: Python multi_phase.plot(units="A^-1") .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_005.png :alt: plotting different units :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_005.png :class: sphx-glr-multi-img * .. image-sg:: /examples/plotting/images/sphx_glr_plotting_different_units_006.png :alt: Signal :srcset: /examples/plotting/images/sphx_glr_plotting_different_units_006.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.741 seconds) .. _sphx_glr_download_examples_plotting_plotting_different_units.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plotting_different_units.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plotting_different_units.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plotting_different_units.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_