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

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

.. _sphx_glr_gallery_style_sheets_dark_background.py:


===========================
Dark background style sheet
===========================

This example demonstrates the "dark_background" style, which uses white for
elements that are typically black (text, borders, etc). Note that not all plot
elements default to colors defined by an rc parameter.





.. image:: /gallery/style_sheets/images/sphx_glr_dark_background_001.png
    :class: sphx-glr-single-img





.. code-block:: python

    import numpy as np
    import matplotlib.pyplot as plt


    plt.style.use('dark_background')

    fig, ax = plt.subplots()

    L = 6
    x = np.linspace(0, L)
    ncolors = len(plt.rcParams['axes.prop_cycle'])
    shift = np.linspace(0, L, ncolors, endpoint=False)
    for s in shift:
        ax.plot(x, np.sin(x + s), 'o-')
    ax.set_xlabel('x-axis')
    ax.set_ylabel('y-axis')
    ax.set_title("'dark_background' style sheet")

    plt.show()


.. _sphx_glr_download_gallery_style_sheets_dark_background.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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