
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/color/color_cycle_default.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_color_color_cycle_default.py>`
        to download the full example code

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

.. _sphx_glr_gallery_color_color_cycle_default.py:


====================================
Colors in the default property cycle
====================================

Display the colors from the default prop_cycle, which is obtained from the
:doc:`rc parameters</tutorials/introductory/customizing>`.

.. GENERATED FROM PYTHON SOURCE LINES 9-43

.. code-block:: default

    import numpy as np
    import matplotlib.pyplot as plt


    prop_cycle = plt.rcParams['axes.prop_cycle']
    colors = prop_cycle.by_key()['color']

    lwbase = plt.rcParams['lines.linewidth']
    thin = lwbase / 2
    thick = lwbase * 3

    fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True)
    for icol in range(2):
        if icol == 0:
            lwx, lwy = thin, lwbase
        else:
            lwx, lwy = lwbase, thick
        for irow in range(2):
            for i, color in enumerate(colors):
                axs[irow, icol].axhline(i, color=color, lw=lwx)
                axs[irow, icol].axvline(i, color=color, lw=lwy)

        axs[1, icol].set_facecolor('k')
        axs[1, icol].xaxis.set_ticks(np.arange(0, 10, 2))
        axs[0, icol].set_title('line widths (pts): %g, %g' % (lwx, lwy),
                               fontsize='medium')

    for irow in range(2):
        axs[irow, 0].yaxis.set_ticks(np.arange(0, 10, 2))

    fig.suptitle('Colors in the default prop_cycle', fontsize='large')

    plt.show()




.. image:: /gallery/color/images/sphx_glr_color_cycle_default_001.png
    :alt: Colors in the default prop_cycle, line widths (pts): 0.75, 1.5, line widths (pts): 1.5, 4.5
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 44-51

------------

References
""""""""""

The use of the following functions, methods, classes and modules is shown
in this example:

.. GENERATED FROM PYTHON SOURCE LINES 52-60

.. code-block:: default


    import matplotlib
    matplotlib.axes.Axes.axhline
    matplotlib.axes.Axes.axvline
    matplotlib.pyplot.axhline
    matplotlib.pyplot.axvline
    matplotlib.axes.Axes.set_facecolor
    matplotlib.figure.Figure.suptitle




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

 Out:

 .. code-block:: none


    <function Figure.suptitle at 0x7f73be894a60>




.. _sphx_glr_download_gallery_color_color_cycle_default.py:


.. only :: html

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



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

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



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

     :download:`Download Jupyter notebook: color_cycle_default.ipynb <color_cycle_default.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>`_
