This commit is contained in:
2008-02-08 14:58:46 +00:00
parent 6b78629946
commit cb6d6b87cc
3 changed files with 560 additions and 178 deletions

View File

@@ -11,24 +11,30 @@ def plot_corrloads(R, pc1=0,pc2=1,s=20, c='b', zorder=5,expvar=None,ax=None,draw
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)
c100 = matplotlib.patches.Circle(center,
radius=radius,
facecolor=(0.97, .97, .97),
zorder=1,
linewidth=1,
edgecolor=(0,0,0))
c50 = matplotlib.patches.Circle(center,
radius=radius/2.0,
facecolor=(.85,.85,.85),
zorder=1,
linewidth=1,
edgecolor=(0,0,0))
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')
ax.axhline(lw=1.5,color='k', zorder=4)
ax.axvline(lw=1.5,color='k', zorder=4)
# corrloads
ax.scatter(R[:,pc1], R[:,pc2], s=s, c=c,zorder=zorder, **kwds)
ax.set_xlim([-1,1])
ax.set_ylim([-1,1])
ax.set_xlim([-1.1,1.1])
ax.set_ylim([-1.1,1.1])
if expvar!=None:
xstring = "Comp: %d expl.var: %.1f " %(pc1+1, expvar[pc1])
pylab.xlabel(xstring)
@@ -51,7 +57,7 @@ def dag(terms, ontology):
#setattr(dag, "_ontology", ontology)
return dag
def plot_dag(dag, node_color='b', node_size=30,with_labels=False,nodelist=None,pos=None):
def plot_dag(dag, node_color='b', node_size=30,with_labels=False,nodelist=None,pos=None,**kwd):
rpy.r.library("GOstats")
@@ -76,7 +82,7 @@ def plot_dag(dag, node_color='b', node_size=30,with_labels=False,nodelist=None,p
if len(node_color)>1:
assert(len(node_color)==len(nodelist))
nx.draw_networkx(G,pos, with_labels=with_labels, node_size=node_size, node_color=node_color, nodelist=nodelist)
nx.draw_networkx(G,pos, with_labels=with_labels, node_size=node_size, node_color=node_color, nodelist=nodelist, **kwd)
return pos