I have a sample data frame presented as ;
df=pd.DataFrame({'day': [1, 1, 2, 2, 3, 3, 4, 4],
'type': ['car', 'bike', 'car', 'bike', 'car', 'bike', 'car', 'bike'],
'percent': [21, 23, 56, 3, 15, 6, 7, 19]}
I need to make a line plot (Y=percent)
vs. (X=day)
, we need two lines in the same plot colored by the variable type
. Can we do it using Matplotlib? I tried the following code;
fig, ax =plt.subplots(figsize=(12,4))
plt.plot("day", "percent", color='type',data=df)
ax.set_title("Percentage of Deliveries")
ax.set_ylabel("Delivery Percent")
plt.show()
But I am getting an error;
Invalid RGBA argument: 'type'
Kindly help.