I have a pandas dataframe including the following columns:
label = ('A' , 'D' , 'K', 'L', 'P')
x = (1 , 4 , 9, 6, 4)
y = (2 , 6 , 5, 8, 9)
plot_id = (1 , 1 , 2, 2, 3)
I want to creat 3 seperate scatter plots - one for each individual plot_id
. So the first scatter plot should consists all entries where plot_id == 1
and hence the points (1,2) and (4,6). Each data point should be labelled by label
. Hence the first plot should have the labels A
and B
.
I understand I can use annotate
to label, and I am familiar with for
loops. But I have no idea how to combine the two.
I wish I could post better code snippet of what I have done so far - but it's just terrible. Here it is:
for i in range(len(df.plot_id)):
plt.scatter(df.x[i],df.y[i])
plt.show()
That's all I got - unfortunately. Any ideas on how to procede?
plot_id
andlabel
? – Expectorationplot_id
. – Aqueouslabel
column is useless ... – Expectorationlabel
. – Aqueousplot_ids
do you have ? If it's a small number you can do some subplots. – Expectoration