Plotting simple sin function

A simple example of the plot of a sin function in order to test the autonomy of the gallery.

To illustrate how to insert maths in example descriptions, it corresponds mathematically to the function:

\[x \rightarrow \sin(x)\]

Here the function \(\sin\) is evaluated at each point the variable \(x\) is defined.

Note that sphinx-gallery automatically creates labels for each example from its filename. You can thus refer to it from any part of the documentation, including from other examples, as here

../../_images/sphx_glr_plot_sin_001.png
# Code source: Óscar Nájera
# License: BSD 3 clause

import numpy as np
import matplotlib.pyplot as plt

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

plt.plot(x, y)
plt.xlabel('$x$')
plt.ylabel('$\sin(x)$')
plt.show()

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

Gallery generated by Sphinx-Gallery