import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.close('all')
ts = pd.Series(np.random.randn(1000),
index=pd.date_range('1/2/2000',
periods=1000))
ts = ts.cumsum()
ts.plot()
df = pd.DataFrame(np.random.randn(1000, 4),
index=ts.index, columns=list('ABCD'))
df = df.cumsum()
plt.figure()
df.plot()
df3 = pd.DataFrame(np.random.randn(1000, 2),
columns=list('BC')).cumsum()
df3['A'] = pd.Series(list(range(len(df))))
df3.plot(x='A', y='B')
plt.figure()
df.iloc[5].plot(kind='bar')
plt.figure()
df.iloc[5].plot.bar()
df.iloc[5].plot.area()
df.iloc[5].plot.barh()
df.iloc[5].plot.box()
df.iloc[5].plot.density()
df.iloc[5].plot.hist()
df.iloc[5].plot.kde()
df.iloc[5].plot.line()
df.iloc[5].plot.scatter()
df.iloc[5].plot.bar()
plt.axhline(0, color&#
可视化代码练习:matplotlib
最新推荐文章于 2024-05-06 15:14:25 发布