Mar-03-2022, 03:21 PM
(Mar-03-2022, 01:06 AM)Mark17 Wrote: I just wanted to bump this... does anyone have any thoughts? Thanks!
This is closer:
import datetime as dt import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator df = pd.DataFrame({'date':[dt.datetime(2018,8,25), dt.datetime(2018,8,26), dt.datetime(2018,8,27), dt.datetime(2018,8,28), dt.datetime(2018,8,29), dt.datetime(2018,8,30), dt.datetime(2018,8,31), dt.datetime(2018,9,1), dt.datetime(2018,9,2), dt.datetime(2018,9,3), dt.datetime(2018,9,4)], 'n':[10, 6, 7, 2, -3, -5, 1, 3, 7, 10, 16]}) markerlist = [] trade_date = [dt.datetime(2018,8,25), dt.datetime(2018,8,30), dt.datetime(2018,9,3)] fig, ax = plt.subplots() for i in df['date']: if i in trade_date: markerlist.append('d') else: markerlist.append('.') for xp, yp, m in zip(df['date'], df['n'], markerlist): ax.plot(xp, yp, m, color='green', linestyle='solid', markersize=12) #ax.plot(df['date'], df['n'], marker=markerlist, linestyle='solid', markersize=12) plt.xticks(rotation = 45) ax.get_xaxis().set_major_locator(LinearLocator(numticks=7)) #this works nicely to evenly space x-tick labels plt.show()Now I get the differential markers... and the color argument fixes everything as green (still not sure why it was multi-colored without this). I just need a line connecting the points, now, and everything would be good.