plotting time series data:
import matplotlib.pyplot as plt
import pandas as pd
df=df.set_index('date_column')
df.plot()
plt.show()
Adding style to your plots:
plt.style.use('fivethirtyeight')
df.plot()
plt.show()
查看可用的绘画样式:
print(plt.style.available)
describing your graphs with labels:
ax=df.plot(color='blue')
ax.set_xlabel('Date')
ax.set_ylabel('the values of my Y axis')
ax.set_title('The title of my plot')
plt.show()
Figure size,linewidth,linestyle and fontsize:
ax=df.plot(figsize=(12,5),fontsize=12,linewidth=3,linestyle='--')
ax.set_xlabel('Date',fontsize=16)
ax.set_ylabel('the values of my Y axis',fontsize=16)
ax.set_title('The title of my plot