
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/02-production/2.3-plot_chronology.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.3-plot_chronology.py>`
        to download the full example code.

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

.. _sphx_glr_auto_examples_02-production_2.3-plot_chronology.py:


Plot the NPF Chronology function for the Moon and Mars
=======================================================

.. rubric:: By Austin Blevins and David Minton

Here we plot the chronology component of the Neukum production function for the Moon and Mars. The chronology function is the number of craters per unit area per unit time, which is a function of crater diameter and age. The plot shows the number of craters per square kilometer per million years as a function of time for a 1 km crater.

.. GENERATED FROM PYTHON SOURCE LINES 9-52



.. image-sg:: /auto_examples/02-production/images/sphx_glr_2.3-plot_chronology_001.png
   :alt: 2.3 plot chronology
   :srcset: /auto_examples/02-production/images/sphx_glr_2.3-plot_chronology_001.png
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt
    import numpy as np

    from cratermaker import Production

    moon = Production.maker("neukum", version="Moon")
    mars = Production.maker("neukum", version="Mars")
    age_vals = np.linspace(4.5e3, 0.0, num=1000)

    N1_moon = moon.chronology(age=age_vals)
    N1_mars = mars.chronology(age=age_vals)

    fig, ax = plt.subplots(figsize=(8, 4))
    ax.set_yscale("log")
    ax.set_ylabel("$\\mathregular{N(1) (km^{-2})}$")
    ax.set_xlabel("Time (Gy ago)")
    ax.set_xlim(4.5, 0)

    # Convert age from My to Gy and N1 from m² to km² for plotting
    ax.plot(
        age_vals * 1e-3,
        N1_moon * 1e6,
        "-",
        color="dimgrey",
        linewidth=2.0,
        zorder=50,
        label="Moon",
    )
    ax.plot(
        age_vals * 1e-3,
        N1_mars * 1e6,
        "-",
        color="orange",
        linewidth=2.0,
        zorder=50,
        label="Mars",
    )

    ax.legend()

    plt.tight_layout()
    plt.show()


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

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


.. _sphx_glr_download_auto_examples_02-production_2.3-plot_chronology.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: 2.3-plot_chronology.ipynb <2.3-plot_chronology.ipynb>`

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

      :download:`Download Python source code: 2.3-plot_chronology.py <2.3-plot_chronology.py>`

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

      :download:`Download zipped: 2.3-plot_chronology.zip <2.3-plot_chronology.zip>`


.. only:: html

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

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