.. _style_sheets-plot_dark_background:

style_sheets example code: plot_dark_background.py
==================================================



.. plot:: /build/matplotlib-2.0.0+dfsg1/doc/mpl_examples/style_sheets/plot_dark_background.py

::

    """
    This example demonstrates the "dark_background" style, which uses white for
    elements that are typically black (text, borders, etc). Note, however, that not
    all plot elements default to colors defined by an rc parameter.
    
    """
    import numpy as np
    import matplotlib.pyplot as plt
    
    
    plt.style.use('dark_background')
    
    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:
        plt.plot(x, np.sin(x + s), 'o-')
    plt.xlabel('x-axis')
    plt.ylabel('y-axis')
    plt.title('title')
    
    plt.show()
    

Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)