Your plot command was wrong; you need to specify x
and y
for each point you want to plot , so 4 values for both x
and y
.
See the docs for more info (specifically about the shape of x and y)
import matplotlib.pyplot as plt
x = [1, 2,1,2]
y = [1, 1,2,2]
x_label = ["a", "b"]
y_label = ["x", "y"]
size = [100, 200, 300, 400] # I tried wild combinations here
plt.xticks([1,2], x_label)
plt.yticks([1,2], y_label)
plt.scatter(x, y, s=size, alpha=0.5)
plt.show()
creates