On 06/14/2012 07:08 PM, field.cady wrote:
I'm working with a large dataset - large enough that when I do a scatter plot
the points all blur together, so I want to plot their density by color - a
heat map or something like that.  I've used smoothScatter for tasks like
this, but the problem is that my current dataset really only looks good on a
log-log scale.  When I do the following command

smoothScatter(
         data,
         xlim=c(100,100000000),
         ylim=c(100,10000000000),
         log="xy",
         pch="."
)

the output seems to only show a few of the points, and they are in odd
places that don't seem to correlate at all with the colors.  I got a warning
that I should increase the gridsize, but even using comically large values
(nbin=10000) didn't help.  Does anybody know how I can do this?  Thanks!

Hi field.cady,
This is a very rough example (I haven't bothered to do the log transformation or anything and the matrix is upside down), but it might get you where you want to go.

x<-runif(1000)
y<-runif(1000)
xydens<-matrix(0,10,10)
xybreaks<-seq(0,1,length.out=11)
for(row in 1:10) {
 for(column in 1:10)
  xydens[row,column]<-
  sum(x>=xybreaks[row] & x < xybreaks[row+1] &
  y >= xybreaks[column] & y < xybreaks[column+1])
}
library(plotrix)
color2D.matplot(xydens)

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to