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

    Click :ref:`here <sphx_glr_download_auto_examples_sin_func_plot_sin_black_background.py>` to download the full example code or run this example in your browser via Binder
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_sin_func_plot_sin_black_background.py:


Plotting simple sin function on a black background
==================================================

A simple example of the plot of a sin function on a black background



.. image:: /auto_examples/sin_func/images/sphx_glr_plot_sin_black_background_001.png
    :class: sphx-glr-single-img





.. code-block:: python


    # Code source: Loïc Estève
    # License: BSD 3 clause

    import numpy as np
    import matplotlib.pyplot as plt

    bg_color = 'black'
    fg_color = 'white'

    fig = plt.figure(facecolor=bg_color, edgecolor=fg_color)
    axes = fig.add_subplot(111)
    axes.patch.set_facecolor(bg_color)
    axes.xaxis.set_tick_params(color=fg_color, labelcolor=fg_color)
    axes.yaxis.set_tick_params(color=fg_color, labelcolor=fg_color)
    for spine in axes.spines.values():
        spine.set_color(fg_color)

    x = np.linspace(0, 2 * np.pi, 100)
    y = np.sin(x)

    plt.plot(x, y, 'cyan', axes=axes)
    plt.xlabel('$x$', color=fg_color)
    plt.ylabel('$\sin(x)$', color=fg_color)
    plt.show()

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


.. _sphx_glr_download_auto_examples_sin_func_plot_sin_black_background.py:


.. only :: html

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


  .. container:: binder-badge

    .. image:: https://static.mybinder.org/badge.svg
      :target: https://mybinder.org/v2/gh/sphinx-gallery/sphinx-gallery.github.io/master?urlpath=lab/tree/notebooks/auto_examples/sin_func/plot_sin_black_background.ipynb
      :width: 150 px


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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