.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\python_packages\matplotlib\demo_scientific.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_python_packages_matplotlib_demo_scientific.py: Science Plots ============= This `matplotlib `_ style `Science Plots `_ is focused to generate figures using common scientific journal styles such as IEEE. The figures are suitable to print in colored are back and white. In addition to `matplotlib `_, the style must be installed. .. code-block:: bat pip install SciencePlots .. GENERATED FROM PYTHON SOURCE LINES 13-14 Import namespaces. .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt import scienceplots .. GENERATED FROM PYTHON SOURCE LINES 19-20 Generate demo x and y values. .. GENERATED FROM PYTHON SOURCE LINES 20-25 .. code-block:: Python x = np.linspace(0, 10, 20) y = np.sin(x) y2 = np.cos(x) .. GENERATED FROM PYTHON SOURCE LINES 26-27 Change matplotlib.pyplot style and plot data. .. GENERATED FROM PYTHON SOURCE LINES 27-37 .. code-block:: Python with plt.style.context(["science", "no-latex"]): plt.figure(figsize=(6, 6)) plt.plot(x, y, marker="o", label="Line 1") plt.plot(x, y2, marker="x", label="Line 2") plt.xlabel("X") plt.ylabel("Y") plt.legend() plt.grid() plt.show() .. image-sg:: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_scientific_001.png :alt: demo scientific :srcset: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_scientific_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.204 seconds) .. _sphx_glr_download_11_demos_python_packages_matplotlib_demo_scientific.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_scientific.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_scientific.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_scientific.zip `