.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/inverse_pole_figures/inverse_pole_density_function.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_inverse_pole_figures_inverse_pole_density_function.py: ============================= Inverse pole density function ============================= This example shows how to plot an inverse pole density function (IPDF) :cite:`rohrer2004distribution` to inspect the distribution of crystal directions :math:`t` pointing in some direction in the sample reference frame :math:`(x, y, z)`. .. GENERATED FROM PYTHON SOURCE LINES 10-53 .. image-sg:: /examples/inverse_pole_figures/images/sphx_glr_inverse_pole_density_function_001.png :alt: Ferrite, Z, Austenite, Z, Ferrite, Z, Austenite, Z :srcset: /examples/inverse_pole_figures/images/sphx_glr_inverse_pole_density_function_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Phase Orientations Name Space group Point group Proper point group Color 1 5657 (48.4%) austenite None 432 432 tab:blue 2 6043 (51.6%) ferrite None 432 432 tab:orange Properties: iq, dp Scan unit: um | .. code-block:: Python import matplotlib.pyplot as plt from orix import data, plot from orix.vector import Vector3d xmap = data.sdss_ferrite_austenite(allow_download=True) print(xmap) # Extract orientations, O pg_m3m = xmap.phases[1].point_group.laue O_fe = xmap["ferrite"].orientations O_au = xmap["austenite"].orientations # Some sample direction, v v = Vector3d([0, 0, 1]) v_title = "Z" # Rotate sample direction v into every crystal orientation O t_fe = O_fe * v t_au = O_au * v # Set IPDF range vmin, vmax = (0, 3) subplot_kw = {"projection": "ipf", "symmetry": pg_m3m, "direction": v} fig = plt.figure(figsize=(9, 8)) ax0 = fig.add_subplot(221, **subplot_kw) ax0.scatter(O_fe, alpha=0.05) _ = ax0.set_title(f"Ferrite, {v_title}") ax1 = fig.add_subplot(222, **subplot_kw) ax1.scatter(O_au, alpha=0.05) _ = ax1.set_title(f"Austenite, {v_title}") ax2 = fig.add_subplot(223, **subplot_kw) ax2.pole_density_function(t_fe, vmin=vmin, vmax=vmax) _ = ax2.set_title(f"Ferrite, {v_title}") ax3 = fig.add_subplot(224, **subplot_kw) ax3.pole_density_function(t_au, vmin=vmin, vmax=vmax) _ = ax3.set_title(f"Austenite, {v_title}") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.826 seconds) **Estimated memory usage:** 1752 MB .. _sphx_glr_download_examples_inverse_pole_figures_inverse_pole_density_function.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: inverse_pole_density_function.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: inverse_pole_density_function.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_