Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/3-scatter-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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()

]
}
],
Expand Down