Valueerror: X And Y Must Be The Same Size In Matplotlib
If I want to make a scatter plot with matplotlib like this: import matplotlib as plt x = [float(1) for x in xrange(2)] y = [float(2) for x in xrange(2)] plt.scatter(x,y) plt.show()
Solution 1:
You are overwriting x
when assigning y
x = [float(1) for x in xrange(2)] # x = [1, 1]
y = [float(2) for x in xrange(2)] # x = 1; y = [2, 2]
^
Instead of using x
use _
(the "don't care variable in python" as suggested by @kroolik)
x = [float(1) for _ in xrange(2)]
y = [float(2) for _ in xrange(2)]
Post a Comment for "Valueerror: X And Y Must Be The Same Size In Matplotlib"