import pandas as pdimport numpy as np# 折线图s=pd.Series(np.random.randn(10),index=np.arange(0,100,10))s.plot()
<AxesSubplot:>

df=pd.DataFrame(np.random.randn(10,4),index=np.arange(0,100,10),columns=list('ABCD'))print(df)df.plot()
           A         B         C         D0  -0.358499  1.242513 -1.200230  0.21805110 -1.540113 -0.344976 -1.509415  1.16226020  0.680961  0.398406 -0.429856  1.02773230  0.545883 -0.101128  1.747935  0.42318740  0.763575 -0.682698  0.885915  0.79683550 -2.419253 -0.794231 -1.100932 -0.30959160  1.212027  0.684612 -0.035615  0.99992770  0.362055 -1.851297  0.860120  1.27199680 -1.199978 -1.158961  0.644087 -0.84050390  2.033464  0.301777 -0.629141 -0.702707<AxesSubplot:>

import matplotlib.pyplot as plts=pd.Series(np.random.randn(16),index=list('abcdefghijklmnop'))fig,aexs=plt.subplots(2,1)# 垂直柱状图s.plot(ax=aexs[0],kind='bar')# 程度柱状图s.plot(ax=aexs[1],kind='barh')
<AxesSubplot:>

# 重叠柱状图df=pd.DataFrame(np.random.randn(10,4),index=np.arange(0,100,10),columns=list('ABCD'))df.plot(kind='bar',stacked=True)plt.show()

# hist直方图df=pd.DataFrame({'A':np.random.randn(1000),'B':np.random.randn(1000)})df.plot(kind='hist',bins=500)plt.show()

df2=pd.DataFrame({'C':np.random.randn(1000)})
df3=pd.concat([df,df2],axis=1)
print(df3)
            A         B         C0   -0.857916  1.603299 -0.5848071   -0.192799 -0.824972  1.1386442   -1.780869 -0.501384  1.3181043    0.916919 -0.564578  0.8328444   -0.153033 -0.381179 -0.122554..        ...       ...       ...995  0.188451 -0.763563  0.230478996  0.371608 -0.946306  0.318904997  0.299794 -0.420749  0.276406998 -0.193156 -0.091357 -0.926047999  0.871653  1.204641 -1.030529[1000 rows x 3 columns]
# 散点图data=df3[['A','B','C']]data.plot.scatter('A','B')
<AxesSubplot:xlabel='A', ylabel='B'>

pd.plotting.scatter_matrix(data,color='g',alpha=0.3)
array([[<AxesSubplot:xlabel='A', ylabel='A'>,        <AxesSubplot:xlabel='B', ylabel='A'>,        <AxesSubplot:xlabel='C', ylabel='A'>],       [<AxesSubplot:xlabel='A', ylabel='B'>,        <AxesSubplot:xlabel='B', ylabel='B'>,        <AxesSubplot:xlabel='C', ylabel='B'>],       [<AxesSubplot:xlabel='A', ylabel='C'>,        <AxesSubplot:xlabel='B', ylabel='C'>,        <AxesSubplot:xlabel='C', ylabel='C'>]], dtype=object)