I'm trying to create a scatterplot of the data in scores
where the values above a threshold
are colored red. I'm having issues with getting the colors to show accordingly. I would also like to shade the background of the figure for the indices specified in labels
, which is a list of 0s and 1s the length of the dataframe. Below is the code I have so far. Thanks in advance for the help!
import pandas
...
values = pandas.DataFrame({"scores":scores, "labels":labels, "indices":range(len(labels))})
# plot alerts in red, others in black
alertValues = values.iloc[scores[scores >= threshold].index]
ax = alertValues.plot(kind="scatter", x="indices", y="scores", c='r',
marker='.', s=5, alpha=0.5)
values.plot(kind="scatter", x="indices", y="scores", c='r',
marker='.', s=5, alpha=0.5, ax=ax)
# show plot
plt.title(fileName)
plt.show()