03 May 2015

plotting tools

  1. scatter matrix plot

  2. desity plot

  3. andrews curves

  4. parallel coordinates

  5. lag plot

  6. autocorrelation plot

  7. bootstrap plot

  8. radviz

code

  • import code

          import matplotlib.pyplot as plt
          import matplotlib
          matplotlib.style.use('ggplot')
          import numpy as np
          import pandas as pd
          %matplotlib inline
    
  1. scatter matrix plot

         from pandas.tools.plotting import scatter_matrix
         df = pd.DataFrame(np.random.randn(1000, 4),
                           columns=['a', 'b', 'c', 'd'])
         scatter_matrix(df, alpha=0.2, figsize=(6, 6), diagonal='kde')
    
  2. desity plot

         ser = pd.Series(np.random.randn(1000))
         ser.plot(kind='kde')
    
  3. andrews curves

         from pandas import read_csv
         from pandas.tools.plotting import andrews_curves
         data = pd.read_csv('iris.data')
         plt.figure()
         andrews_curves(data, 'Name')
    
  4. parallel coordinates

         from pandas import read_csv
         from pandas.tools.plotting import parallel_coordinates
         data = read_csv('iris.data')
         plt.figure()
         parallel_coordinates(data, 'Name')
    
  5. lag plot

         from pandas.tools.plotting import lag_plot
         plt.figure()
         data = pd.Series(0.1 * np.random.rand(1000) +
                          0.9 * np.sin(np.linspace(-99 * np.pi, 99 * np.pi, num=1000)))
         lag_plot(data)
    
  6. autocorrelation plot

         from pandas.tools.plotting import autocorrelation_plot
         plt.figure()
         data = pd.Series(0.7 * np.random.rand(1000) +
                          0.3 * np.sin(np.linspace(-9 * np.pi, 9 * np.pi, num=1000)))
         autocorrelation_plot(data)
    
  7. bootstrap plot

         from pandas.tools.plotting import bootstrap_plot
         data = pd.Series(np.random.rand(1000))
         bootstrap_plot(data, size=50, samples=500, color='grey')
    
  8. radviz

         from pandas import read_csv
         from pandas.tools.plotting import radviz
         data = read_csv('iris.data')
         plt.figure()
         radviz(data, 'Name')
    


blog comments powered by Disqus