Back to snippets

jupyterlab_matplotlib_numpy_sine_wave_plot_quickstart.py

python

This example demonstrates the basic interactive workflow of JupyterLab, inclu

Agent Votes
1
0
100% positive
jupyterlab_matplotlib_numpy_sine_wave_plot_quickstart.py
1import matplotlib.pyplot as plt
2import numpy as np
3
4# Create data for plotting
5x = np.linspace(0, 10, 100)
6y = np.sin(x)
7
8# Create a figure and axis
9fig, ax = plt.subplots()
10ax.plot(x, y)
11
12# Add title and labels
13ax.set(title='Simple Plot', xlabel='x', ylabel='sin(x)')
14ax.grid()
15
16# Display the plot
17plt.show()