python - Plotting line(color, attribue defined) graph using pandas -
i try plot multi-line different attribute(color, line-type, etc) pandas grouby data set. code plots blue line of multiple source. how apply line attribute @ each group?
my code bleow.
from pandas import series, dataframe import pandas pd import matplotlib.pyplot plt xls_file = pd.excelfile(r'e:\sat_data.xlsx') glider_data = xls_file.parse('yosup (4)', parse_dates=[0]) each_glider = glider_data.groupby('vehicle') fig, ax = plt.subplots(1,1); glider_data.groupby("vehicle").plot(x="timestamp", y="temperature(degc)", ax=ax) plt.legend(glider_data['vehicle'], loc='best') plt.xlabel("time") plt.ylabel("temp") plt.show()
i think need loop on groups groupby. like:
for i,group in glider_data.groupby('vehicle'): group.plot(x='timestamp', y='temperature(degc)', ax=ax, label=i)
Comments
Post a Comment