Skip to content

Instantly share code, notes, and snippets.

@amarvutha
Created November 4, 2013 00:08
Show Gist options
  • Save amarvutha/7296275 to your computer and use it in GitHub Desktop.
Save amarvutha/7296275 to your computer and use it in GitHub Desktop.
import numpy as np
import pylab as plt
from numpy import random as random
import matplotlib.gridspec as gridspec
N = 10000
x,y = random.normal(0,1,N),random.normal(0,3,N)
plt.figure()
aspectRatio = 6
gs = gridspec.GridSpec(aspectRatio,aspectRatio)
ax1 = plt.subplot(gs[0,:-1])
ax2 = plt.subplot(gs[1:,:-1])
ax3 = plt.subplot(gs[1:,-1])
plt.subplots_adjust(wspace=0.02, hspace=0.02)
ax1.xaxis.set_visible(False)
ax1.yaxis.set_visible(False)
ax3.xaxis.set_visible(False)
ax3.yaxis.set_visible(False)
binSize = 50
a,b = np.histogram(y,len(y)/binSize)
c,d = np.histogram(x,len(x)/binSize)
ax1.plot(d[:-1],c,'b',linewidth=2)
ax1.fill_between(d[:-1],c,color='blue',alpha='0.2')
ax2.plot(x,y,'b.',markersize=4)
ax3.plot(a,b[:-1],'b',linewidth=2)
ax3.fill_between(a,b[:-1],color='blue',alpha='0.2')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment