diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 9bed601f..bf166cca 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -15,6 +15,25 @@ "source": [ "# TASK: Create a scatter plot with x = [1, 2, 3, 4, 5] and y = [2, 4, 6, 8, 10].\n", "# Annotate each point with its (x, y) value, and set the title as 'Scatter Plot with Annotations'." +import matplotlib.pyplot as plt + +# Data +x = [1, 2, 3, 4, 5] +y = [2, 4, 6, 8, 10] + +# Plotting +plt.scatter(x, y, color='blue') +plt.title("Scatter Plot with Annotations") +plt.xlabel("X") +plt.ylabel("Y") + +# Annotate each point +for i in range(len(x)): + plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center') + +plt.grid(True) +plt.show() + ] } ],