import numpy as np
import matplotlib.pyplot as plt
# --- 1. Generate data using NumPy ---
# Generate 100 evenly spaced numbers between 0 and 10
x = np.linspace(0, 10, 100)
# Calculate the sine of these numbers
y = np.sin(x)
# --- 2. Create and display a plot using Matplotlib ---
# Create a figure and a set of subplots
fig, ax = plt.subplots()
# Plot the x and y data as a line
ax.plot(x, y, label='Sine Wave', color='green')
# Add plot customizations
ax.set_title("Sine Wave using NumPy and Matplotlib")
ax.set_xlabel("X values")
ax.set_ylabel("Sine(X) values")
ax.legend()
ax.grid(True)
# Display the plot
plt.show()