.. 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_tex.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_tex.py: Tex ====== .. GENERATED FROM PYTHON SOURCE LINES 5-13 .. code-block:: Python # imports import matplotlib.pyplot as plt import numpy as np # http://matplotlib.org/users/customizing.html plt.rcParams["font.family"] = "serif" .. GENERATED FROM PYTHON SOURCE LINES 14-15 Generate without latex.usetext .. GENERATED FROM PYTHON SOURCE LINES 15-31 .. code-block:: Python title = r"TeX is Number $\sum_{n=1}^\infty \frac{-e^{i\pi}}{2^n}$!" xLabel = r"time (s)" yLabel = "velocity [°/sec]" fig, ax = plt.subplots(1) # create a new figure window t = np.arange(0.0, 1.0 + 0.01, 0.01) s = np.cos(2 * 2 * np.pi * t) + 2 ax.plot(t, s) # plot line ax.set_xlabel(xLabel) # x axis label ax.set_ylabel(yLabel) # y axis label ax.set_title(title, fontsize=16, color="r") # title ax.grid(True) # create grid plt.show() .. image-sg:: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_tex_001.png :alt: TeX is Number $\sum_{n=1}^\infty \frac{-e^{i\pi}}{2^n}$! :srcset: /11_demos/python_packages/matplotlib/images/sphx_glr_demo_tex_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.132 seconds) .. _sphx_glr_download_11_demos_python_packages_matplotlib_demo_tex.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_tex.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_tex.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_tex.zip `