Initial import

This commit is contained in:
2007-07-20 09:36:26 +00:00
parent dd04e28a62
commit 7ee7aa968a
5 changed files with 742 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import pylab
import matplotlib
def plot_corrloads(R, pc1=0,pc2=1,s=20, c='b', zorder=5,expvar=None,ax=None,drawback=True, labels=None):
""" Correlation loading plot."""
# backgorund
if ax==None or drawback==True:
radius = 1
center = (0,0)
c100 = matplotlib.patches.Circle(center,radius=radius,
facecolor='gray',
alpha=.1,
zorder=1)
c50 = matplotlib.patches.Circle(center, radius=radius/2.0,
facecolor='gray',
alpha=.1,
zorder=2)
ax = pylab.gca()
ax.add_patch(c100)
ax.add_patch(c50)
ax.axhline(lw=1.5,color='k')
ax.axvline(lw=1.5,color='k')
# corrloads
ax.scatter(R[:,pc1], R[:,pc2], s=s, c=c,zorder=zorder)
ax.set_xlim([-1,1])
ax.set_ylim([-1,1])
if expvar!=None:
xstring = "Comp: %d expl.var: %.1f " %(pc1+1, expvar[pc1])
pylab.xlabel(xstring)
ystring = "Comp: %d expl.var.: %.1f " %(pc2+1, expvar[pc2])
pylab.ylabel(ystring)
if labels:
assert(len(labels)==R.shape[0])
for name, r in zip(labels, R):
ax.text(r[pc1], r[pc2], " " + name)
#pylab.show()