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

    Click :ref:`here <sphx_glr_download_gallery_misc_load_converter.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_misc_load_converter.py:


==============
Load Converter
==============





.. image:: /gallery/misc/images/sphx_glr_load_converter_001.png
    :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    loading /build/matplotlib2-2.2.3/lib/matplotlib/mpl-data/sample_data/msft.csv




|


.. code-block:: python

    from __future__ import print_function
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.cbook as cbook
    import matplotlib.dates as mdates
    from matplotlib.dates import bytespdate2num

    datafile = cbook.get_sample_data('msft.csv', asfileobj=False)
    print('loading', datafile)

    dates, closes = np.loadtxt(datafile, delimiter=',',
                               converters={0: bytespdate2num('%d-%b-%y')},
                               skiprows=1, usecols=(0, 2), unpack=True)

    fig, ax = plt.subplots()
    ax.plot_date(dates, closes, '-')
    fig.autofmt_xdate()
    plt.show()


.. _sphx_glr_download_gallery_misc_load_converter.py:


.. only :: html

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



  .. container:: sphx-glr-download

     :download:`Download Python source code: load_converter.py <load_converter.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: load_converter.ipynb <load_converter.ipynb>`


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
