I am trying to make a scatter plot with this dictionary
d = {1: [1, 2, 3, 4, 5], 3: [3, 6, 9, 12, 15], 5: [5, 10, 15, 20, 25]}
I want the keys to be in X-axis and the values to be on Y-axis, and also to show a legend with different key values. I have tried this code-
import matplotlib.pyplot as plt
d = {1: [1, 2, 3, 4, 5], 3: [3, 6, 9, 12, 15], 5: [5, 10, 15, 20, 25]}
colors = list("rgbk")
x, y =[], []
for i in d.keys():
for j in d[i]:
x.append(i)
y.append(j)
plt.scatter(x, y, color = colors.pop())
plt.legend(d.keys())
plt.show()
But this is giving me a plot with points with only one colour but the legends are alright.

