Imagine this piece of code where X
is the independent variable, and Y
is the dependent variable and is equal to X ** 2
:
X = [1, 2, 3]
Y = [1, 4, 9]
plt.plot(X, Y)
plt.show()
What if both of my variables were in the same list:
li = [[1, 1], [2, 4], [3, 9]]
The first element of every nested list is X
, and the second one is Y
; how should I plot this?
I'm pretty sure someone already asked this question, but I didn't know what to search and didn't found an answer.