Note
Click here to download the full example code or run this example in your browser via Binder
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:
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
See also
Plotting simple sin function on a black background for a fancier plot

# 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.009 seconds)