Place a marker on a plot
I was able to produce the following with a marker for each point, based on some criteria:



I made a dummy Pandas Dataframe, using the sine and cosine to get lines that cross each other nicely; also making the index itself a column (with reset_index) just to make plotting easier later on.

df = pd.DataFrame.from_dict(dict(sin=np.sin(np.linspace(0, 2*np.pi, 50)),
                             cos=np.cos(np.linspace(0, 2*np.pi, 50))))
df.index.name = "index"
df.reset_index(inplace=True)
df.head(5)

  index sin        cos
0   0   0.000000    1.000000
1   1   0.063424    0.997987
2   2   0.126592    0.991955
3   3   0.189251    0.981929
4   4   0.251148    0.967949


I make a new column which contains the criteria you want, so if one line is above or below another line:

df["criteria"] = df.sin &gt; df.cos    # where sin values are higher than cos values


This will allow us to select which points to plot with which style (e.g. which marker).

The final plot itself is made up of two parts (note that we re-use the same ax object, so all plots appear on the same graph)


The underlying data itself can be added to create the simple lines (these are your moving average columns).

ax = df.sin.plot(c="gray", figsize=(10, 6))    # plots the sine curve in gray
df.cos.plot(c="cyan", ax=ax)                   # re-uses the ax object - important!

The markers, based on our criteria column. We filter the points that satisfy our criteria and plot them with a certain marker, then filter the points that do not have the criteria (using the negation selector: ~). Whereas we used the basic line plot above, we now need to use the scatter kind of plot:

df[df.criteria].plot(kind="scatter", x="index", y="sin",
                     c="green", marker="^", ax=ax, label="higher")

df[~df.criteria].plot(kind="scatter", x="index", y="sin",
                     c="red", marker="v", ax=ax, label="lower");


Note that we continue to use the same ax object.


We can also add the legend, which uses either the Pandas column names by default or the label that was passed in each plot method:

plt.legend()="lower");    # adds legend for all plots




You can see in the matplotlib documentation that there is a marker argument, but it seems you cannot simply specify a column of a Pandas dataframe to give the marker for each individual point.