I want to plot my code as a sequential plot using matplotlib with the summer colormap. In my current code, I've plotted it as a scatterplot, but I want to do this using a line plot.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
from matplotlib.colors import LinearSegmentedColormap
cs2_35_1_10_11 = pd.read_excel('CS2_35_1_10_11.xlsx', sheet_name='Channel_1-008')
cs2_35_1_10_11 = cs2_35_1_10_11.drop(['Data_Point','Date_Time','Charge_Energy(Wh)','Charge_Energy(Wh)','dV/dt(V/s)','AC_Impedance(Ohm)','Is_FC_Data','ACI_Phase_Angle(Deg)','Unnamed: 17'],axis=1)
charge_cc = cs2_35_1_10_11[(cs2_35_1_10_11['Step_Index']==2)]
charge_cc['Cycle_Index'].unique()
for i, cycle in enumerate(charge_cc['Cycle_Index'].unique()):
cycle = charge_cc['Cycle_Index']
x = charge_cc[charge_cc['Cycle_Index']==cycle]['Step_Time(s)']
y = charge_cc[charge_cc['Cycle_Index']==cycle]['Voltage(V)']
plt.scatter(x, y, c=cycle, cmap='summer')
plt.xlabel('Time(s)')
plt.ylabel('Voltage(v)')
plt.colorbar(label="Cycle Index")
plt.grid()
plt.show()
Data, similar to that used to create this plot, can be found here.
By changing plt.scatter(x, y, c=cycle, cmap='summer')
to plt.plot(x, y, c='summer')
I have this error:
'summer' is not a valid value for color " even when I add "summer = LinearSegmentedColormap.from_list('summer', ['#ccff33','#004b23'], N=50)