Chris Fonnesbeck wrote:
> I'm trying to track down a function/recipe for generating a multivariate
> scatter plot. I'm thinking of something similar to what you get in R if
> you call plot on a multivariate data frame:
> http://mt11.quickshareit.com/share/rplotb1a70.pdf
Yes, that would be really useful. I started something
in PyX awhile back (below, MIT license). Not beautiful, but
functions. Please post if you develop something nice.
Alan
import numpy as np
from pyx import canvas, graph
data = np.random.random((3,10))
def scatter_plot_matrix(group,figwidth=18,hsep=1,vsep=1):
g_len = len(group)
subplot_size = (figwidth - (g_len-1)*hsep)/g_len
c = canvas.canvas()
g_id = range(g_len)
xlinks = []
for yi in g_id[::-1]:
for xi in g_id:
xseries = group[xi]
yseries = group[yi]
if xi == 0:
ylinkaxis = None
else:
ylinkaxis = graph.axis.linkedaxis(ylink.axes["y"])
if yi == g_len-1:
xlinkaxis = None
else:
xlinkaxis = graph.axis.linkedaxis(xlinks[xi].axes["x"])
newgraph = c.insert(graph.graphxy(width=subplot_size,
height=subplot_size,
xpos=(subplot_size+hsep)*xi,
ypos=(subplot_size+vsep)*(g_len-1-yi),
x = (xlinkaxis or graph.axis.linear()),
y = (ylinkaxis or graph.axis.linear()),
)
)
newgraph.plot(graph.data.list(zip(xseries,yseries), x=1, y=2))
if xi == 0:
ylink = newgraph
if yi == g_len -1:
xlinks.append( newgraph )
return c
test1 = scatter_plot_matrix(data)
test1.writeEPSfile("c:/temp/temp.eps")
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users