I have the dataset df4:
Cumulexr Cumulcoun SignB
1 43.035714 24.603175 Yes
3 71.785714 50.513539 No
0 89.107143 75.241208 No
2 100.000000 100.000000 No
And I am plotting them as:
plt.plot(df4["Cumulcoun"], df4["Cumulexr"], label="4 Cl.").
But I want additionally to mark the point(with a dot) that has SignB=Yes. Any idea?
CodePudding user response:
IIUC, you can create another dataframe with rows from df4
which have SignB = Yes
.
import matplotlib.pyplot as plt
import pandas as pd
X = [43.035, 71.785, 89.107, 100.000]
Y = [24.603, 50.513, 75.241, 100.000]
Sign = ["Yes", 'No', 'No', 'No']
df4 = pd.DataFrame({"Cumulexr": X, "Cumulcoun": Y, "SignB": Sign})
df1 = df4.loc[df4["SignB"] == 'Yes']
plt.plot(df4["Cumulcoun"], df4["Cumulexr"])
plt.plot(df1["Cumulcoun"], df1["Cumulexr"], marker='*')
plt.show()
You can set marker='o'
to get SignB = Yes
data points as circles/points.