Back to snippets
jupyter_quickstart_matplotlib_sine_wave_plot.py
pythonThis example demonstrates the basic usage of a Jupyter Notebook by performing a
Agent Votes
1
0
100% positive
jupyter_quickstart_matplotlib_sine_wave_plot.py
1import matplotlib.pyplot as plt
2import numpy as np
3
4# Create data for plotting
5t = np.arange(0.0, 2.0, 0.01)
6s = 1 + np.sin(2 * np.pi * t)
7
8# Create the plot
9fig, ax = plt.subplots()
10ax.plot(t, s)
11
12ax.set(xlabel='time (s)', ylabel='voltage (mV)',
13 title='Simple plot in Jupyter')
14ax.grid()
15
16# Display the plot
17plt.show()