0

I have determined a color for each data point pragmatically and I have 11 set of x(time) and y(subjects) and I want to make plots for these values and these colors will be used for the data points on the plots. so I want the colours to be vertically grouped

colors ['violet', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'red', 'red', 'red', 'red', 'red', 'red', 'red', 'moccasin']
X  [0, 4, 6, 18, 33, 54, 64, 79, 93, 109, 109, 113]
Y  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

colors ['violet', 'yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'red', 'red', 'red', 'red', 'moccasin']
X  [0, 8, 10, 10, 11, 13, 23, 40, 44, 65, 80, 81, 89]
Y  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]

colors ['violet', 'yellow', 'yellow', 'yellow', 'red', 'red', 'red', 'red', 'red', 'red', 'moccasin']
X  [0, 5, 21, 36, 38, 51, 67, 82, 96, 97, 99]
Y  [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]

right now I have this plot which is not the one that I want enter image description here while I want to make something like this below plot: thanks for your help enter image description here

user8523104
  • 467
  • 1
  • 3
  • 14
  • At the moment it is not clear what you are asking. It would help if you created a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – DavidG Jan 14 '18 at 23:33
  • but I have clearly said I want this plot(second one) and I have said I determined specific color for a group of data points, if you look at the first plot the one that I have created you can see that each subject has a color for all its data points but it should has different color for its data points based on the color that has determined above each set of points – user8523104 Jan 15 '18 at 06:46
  • @DavidG, thank you I solved my problem now I have the graph that I want – user8523104 Jan 15 '18 at 11:48
  • 1
    If you found a solution that works for you, you can always post an answer yourself so that it can help others if they are having the same problem. – DavidG Jan 15 '18 at 11:50
  • Thank you but I am worrying to do that because I did the same in my previous question so it might affect my account – user8523104 Jan 15 '18 at 11:53

2 Answers2

1

I just used the below code and I found my answer, but I got the idea in this link

X = [1, 2, 3]
Y = [2, 5, 8]

colors=["violet", "green", "yellow"]

fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(X, Y, color=colors)
plt.show()

This is a sample of my plot enter image description here

user8523104
  • 467
  • 1
  • 3
  • 14
-1

I assume you want the colours to be vertically grouped. To get that just change the X & Y axis. If this is not what you mean you'd perhaps need to show a larger part of the desired solution.