项目作者: subhamsarangi

项目描述 :
Data Visualizations using Python
高级语言: Jupyter Notebook
项目地址: git://github.com/subhamsarangi/Visualize.git
创建时间: 2017-09-28T18:51:22Z
项目社区:https://github.com/subhamsarangi/Visualize

开源协议:

下载


Visualize


Here are some plots:

2D Plots (Scatter-plot, Step-plot, Bar-plot, Fill Between-Plot)

  1. fig, axes = plt.subplots( 1, 4, figsize=(12,3))
  2. axes[0].scatter( x, x + 0.25*np.random.randn( len(x)))
  3. axes[0].set_title("scatter")
  4. axes[1].step( n, n**2, lw=2 )
  5. axes[1].set_title("step")
  6. axes[2].bar( n, n**2, align="center", width=0.5, alpha=0.5)
  7. axes[2].set_title("bar")
  8. axes[3].fill_between( x, x**2, x**3, color="green", alpha=0.5 )
  9. axes[3].set_title("fill_between")

2D Plots

A 3D Plot (Contour plots with projection)

  1. fig = plt.figure( figsize=( 12,10 ) )
  2. ax = fig.add_subplot( 1,1,1, projection='3d' )
  3. ax.plot_surface( X, Y, Z, rstride=4, cstride=4, alpha=0.25,cmap='plasma' )
  4. cset = ax.contour( X, Y, Z, zdir='z', offset=-np.pi, cmap='gist_earth' )
  5. cset = ax.contour( X, Y, Z, zdir='x', offset=-np.pi, cmap='gist_earth' )
  6. cset = ax.contour( X, Y, Z, zdir='y', offset=3*np.pi, cmap='gist_earth' )
  7. ax.set_xlim3d( -np.pi, 2*np.pi)
  8. ax.set_ylim3d( 0, 3*np.pi )
  9. ax.set_zlim3d( -np.pi, 2*np.pi )

3D plot

Heatmap

  1. flights = sns.load_dataset( 'flights' )
  2. fpt=flights.pivot_table( index='month',columns='year',values='passengers' )
  3. sns.heatmap( fpt, cmap='coolwarm' )

Heatmaps

Linear Model Plot

  1. tips = sns.load_dataset('tips')
  2. sns.lmplot(x='total_bill',y='tip',data=tips,hue='sex',markers=['o','v'],scatter_kws={'s':100})

LM Plot

Joint Plot

  1. tips = sns.load_dataset('tips')
  2. sns.jointplot(x='total_bill',y='tip',data=tips,kind='hex')

Joint Plot