
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/02-production/2.2-plot_projectilecsfd.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_auto_examples_02-production_2.2-plot_projectilecsfd.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_02-production_2.2-plot_projectilecsfd.py:


Plot the Neukum projectile CSFD
========================================

.. rubric:: By Austin Blevins and David Minton

In this example, we will plot the cumulative size-frequency distribution of projectiles for a 1 Gy age, which is derived from Ivanov, Neukum, and Wagner (2001) [#]_.

References
----------

.. [#] Ivanov, B.A., Neukum, G., Wagner, R., 2001. Size-Frequency Distributions of Planetary Impact Craters and Asteroids. In *Collisional Processes in the Solar System*, Springer Netherlands, Dordrecht, pp. 1-34.  `doi:10.1007/978-94-010-0712-2_1 <https://doi.org/10.1007/978-94-010-0712-2_1>`_

.. GENERATED FROM PYTHON SOURCE LINES 14-52



.. image-sg:: /auto_examples/02-production/images/sphx_glr_2.2-plot_projectilecsfd_001.png
   :alt: 2.2 plot projectilecsfd
   :srcset: /auto_examples/02-production/images/sphx_glr_2.2-plot_projectilecsfd_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt
    import numpy as np
    from matplotlib import ticker

    from cratermaker import Production

    production = Production.maker("neukum", version="Projectile")
    Dvals = np.logspace(-2, 7, num=1000)
    Nvals = production.function(diameter=Dvals, age=1000.0)

    fig, ax = plt.subplots(figsize=(4, 7))
    Dvals *= 1e-3  # Convert from m to km
    Nvals *= 1e6  # Convert from m² to km²
    x_min = Dvals[0]
    x_max = Dvals[-1]
    ax.set_xscale("log")
    ax.set_yscale("log")
    ax.set_ylabel("$\\mathregular{N_{>D}}$")
    ax.set_xlabel("Projectile Diameter (km)")
    ax.set_xlim(x_min, x_max)
    ax.yaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=20))
    ax.yaxis.set_minor_locator(ticker.LogLocator(base=10.0, subs=np.arange(2, 10), numticks=100))
    ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=20))
    ax.xaxis.set_minor_locator(ticker.LogLocator(base=10.0, subs=np.arange(2, 10), numticks=100))
    ax.grid(True, which="minor", ls="-", lw=0.5, zorder=5)
    ax.grid(True, which="major", ls="-", lw=1, zorder=10)
    Dlo = production.sfd_range[0] * 1e-3
    Dhi = production.sfd_range[1] * 1e-3
    lo = Dvals < Dlo
    hi = Dvals > Dhi
    inrange = (Dvals >= Dlo) & (Dvals <= Dhi)
    ax.plot(Dvals[inrange], Nvals[inrange], "-", color="black", linewidth=1.0, zorder=50)
    ax.plot(Dvals[lo], Nvals[lo], "-.", color="orange", linewidth=2.0, zorder=50)
    ax.plot(Dvals[hi], Nvals[hi], "-.", color="orange", linewidth=2.0, zorder=50)

    plt.tight_layout()
    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 1.471 seconds)


.. _sphx_glr_download_auto_examples_02-production_2.2-plot_projectilecsfd.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: 2.2-plot_projectilecsfd.ipynb <2.2-plot_projectilecsfd.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: 2.2-plot_projectilecsfd.py <2.2-plot_projectilecsfd.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: 2.2-plot_projectilecsfd.zip <2.2-plot_projectilecsfd.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
