Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Ian StokesRees <ijstokes@hk...>  20100607 15:16:48

I'm generating a plot of NxN squares, where the size of the square corresponds to the correlation between the (i,j) point. Every (i,i) point equals 1.0. I'm using "scatter" to do this, but the sizing appears to be in "points" from the graphic, rather than "units" of the two axes. Is there some way to account for this, or is there some better way to generate this image? # result = n x n matrix of correlations between points (i,j) a = arange(n).repeat(n).reshape(n,n) b = a.transpose() scatter(a.flatten(), b.flatten(), s=result, marker='s') You can see an example here, where N=300: (note, this is a 2.5 MB image): http://abitibi.sbgrid.org/se/data/shared/biodb/scopclass/a/39/1/5/.meta/tmscore2.png Thanks, Ian  Ian StokesRees, PhD W: http://hkl.hms.harvard.edu ijstokes@... T: +1 617 4325608 x75 NEBioGrid, Harvard Medical School C: +1 617 3315993 
From: Michael Droettboom <mdroe@st...>  20100607 16:05:02

Since this data is essentially a 2 dimensional image, you may want to experiment with imshow. Mike On 06/07/2010 11:16 AM, Ian StokesRees wrote: > I'm generating a plot of NxN squares, where the size of the square > corresponds to the correlation between the (i,j) point. Every (i,i) > point equals 1.0. I'm using "scatter" to do this, but the sizing > appears to be in "points" from the graphic, rather than "units" of the > two axes. Is there some way to account for this, or is there some > better way to generate this image? > > # result = n x n matrix of correlations between points (i,j) > a = arange(n).repeat(n).reshape(n,n) > b = a.transpose() > scatter(a.flatten(), b.flatten(), s=result, marker='s') > > You can see an example here, where N=300: (note, this is a 2.5 MB image): > > http://abitibi.sbgrid.org/se/data/shared/biodb/scopclass/a/39/1/5/.meta/tmscore2.png > > Thanks, > > Ian > >  Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA 
From: Tony S Yu <tsyu80@gm...>  20100607 16:17:44
Attachments:
text/plain

On Jun 7, 2010, at 11:16 AM, Ian StokesRees wrote: > I'm generating a plot of NxN squares, where the size of the square > corresponds to the correlation between the (i,j) point. Every (i,i) > point equals 1.0. I'm using "scatter" to do this, but the sizing > appears to be in "points" from the graphic, rather than "units" of the > two axes. Is there some way to account for this, or is there some > better way to generate this image? > > # result = n x n matrix of correlations between points (i,j) > a = arange(n).repeat(n).reshape(n,n) > b = a.transpose() > scatter(a.flatten(), b.flatten(), s=result, marker='s') > > You can see an example here, where N=300: (note, this is a 2.5 MB image): > > http://abitibi.sbgrid.org/se/data/shared/biodb/scopclass/a/39/1/5/.meta/tmscore2.png > > Thanks, > > Ian What you're doing sounds very similar to a Hinton diagrom (or at least the resulting image looks similar). There's an example of plotting such a diagram in the scipy cookbook: http://www.scipy.org/Cookbook/Matplotlib/HintonDiagrams The implementation is pretty slow because it loops through the data and draws each square one by one. I wrote a faster alternative a while back (see attached). It uses a custom PolyCollection, which uses data units for the areas instead of figure units. Also, I just noticed there's another implementation of Hinton diagrams in the matplotlib examples folder (examples/api/hinton_demo.py). For some reason, this example doesn't appear on the website, otherwise I'd link to it. I believe the difference between your plot and a hinton diagram is that you have a different metric for calculating the size of the squares. Tony 
Sign up for the SourceForge newsletter:
No, thanks