1
 X=[[0,3,4,0,1,1], [0,0,0,5,1,1], [6,7,0,8,1,1], [3,6,1,5,6,1]] Y=[12,15,11,10] 

I have the lists how to do the scatter plot to visualize the X , Y to check that relationship??

2
  • What do you want on your x and y axis? Do you want all 6 lines on the same plot? Commented Dec 14, 2016 at 1:39
  • I am considering do the least square such as the equation A *[0,3,4,0,1,1]+k= 12, A *[0,0,0,5,1,1]+k=15.....But , I am not sure what is the relationship between X and Y , whether it is linear or not. I would like to show the dots in the same plot. Commented Dec 14, 2016 at 1:46

1 Answer 1

1

Your X being in the wrong orientation, I'm using a numpy array to easily transpose it. Then it's just a matter of plotting it on the same axis, changing the colors so you can see what's what.

import numpy as np import matplotlib.pyplot as plt x_arr = np.array(X) y = np.array(Y) fig, ax = plt.subplots() colors=list('bgrcmykw') for i, x in enumerate(x_arr.T): ax.scatter(x,y, c=colors[i]) plt.show() 

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.