I have a data frame like so:
Input:
Restaurant IP_Id IP_Time Hits
McDonalds 101 2021-03-28 03:01:05 2
McDonalds 101 2021-03-28 05:26:51 1
McDonalds 101 2021-03-28 05:45:07 1
McDonalds 101 2021-03-29 16:11:06 1
Wendys 101 2021-03-28 16:48:51 1
Wendys 101 2021-03-28 22:34:02 1
Arbys 101 2021-03-28 22:52:15 1
I want to build a seaborn line plot such that IP_Time is on the x-axis and the Hits is on the y-axis. I want to color the line ( a single line) such that its different colors for Restaurant based on the time. How can I do this? I also want to show more tick values on the x-axis for the date in a readable way.
I have the following code so far:
import matplotlib.dates as mdates
import seaborn as sns
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d\n %H:%M:%S'))
plt.gca().xaxis.set_major_locator(mdates.DayLocator(interval=10))
sns.lineplot(data = df, x = 'IP_Time', y = 'Hits')
plt.gcf().autofmt_xdate()