I'm trying to create a plot of x1 against y and make the points coloured based on another variable x2.
x1 = times
y = wait
x2 = triage (from 1-5)
Every variable have the same contains data and have all the same length. The special about x2(triage), is that is numbered from 1-5 and want to colour based on those, so 1 is red, 2 is orange, 3 is yellow, 4 is green and 5 is blue.
Code UPDATED
X = dataset.iloc[:, 0:3].values
y = dataset.iloc[:, 3].values
triage = X[:, 0]
week = X[:, 1]
times = X[:, 2]
wait = y
df = pd.DataFrame(dict(times=times, wait=wait, triage=triage))
fig, ax = plt.subplots()
colors = {'1':'red', '2':'orange', '3':'yellow', '4':'green', '5':'blue'}
grouped = df.groupby('triage')
for key, group in grouped:
group.plot(ax=ax, kind='scatter', x='times', y='wait', label=key,
triage=colors[key])
plt.show()
Managed to try something, but still does not work quite, anyone can see what could be wrong here?