0
import matplotlib.pyplot as plt
x = [1,2,3,4,4,5]
y= [1,2,3]
plt.scatter(x,y)
plt.show()

ValueError: x and y must be the same size

How to obtain a plot between x & y ?

Shubham S. Naik
  • 341
  • 1
  • 4
  • 14

1 Answers1

0

This is an idea I got from using R. In R it usually happens where the elements are recycled. With that in mind, if such a solution is ok with you,

import itertools

x = [1,2,3,4,4,5]
y= [1,2,3]

g = itertools.cycle(y)

w = [next(g) for i in range(len(x))]

plt.scatter(x,w)
plt.show()

Otherwise, I don't know how to plot uneven numbers.