0
votes

I have this coding and scatter plot.

https://pastebin.com/ZFWm4wCw

# model
t_min = data.index.min()
t_max = pd.Timestamp('2015-01-01')

plt.figure(figsize=(18,5))
plt.xlim(t_min, t_max)

location_filter = data.location == 'Fitzroy Gardens'
time_filter     = data.index < t_max
data_filtered   = data[location_filter & time_filter]
#boards          = data_filtered.boardid.unique()

plt.plot(data_filtered.index, data_filtered.temp_avg, ',', c='g', alpha=.9)
plt.show()

scatterplot

I want to color the scatterplot using the 'boardid' column which is a categorical variable includes 5 unique board ids. So, I want to have 5 different colors in the scatterplot. How can I do this using matplotlib?

@GuneshShanbhag StackOverflow is meant as a kind of encyclopedia with general questions and answers, to be accessible many years into the future. Having content on 3rd party sites where the content may disappear any moment is very contrary to that idea.JohanC
@JohanC agreed.Gunesh Shanbhag