[R] Res: Scatterplot Showing All Points
S Ellison
S.Ellison at lgc.co.uk
Tue Dec 18 11:19:22 CET 2007
?jitter is simpler:
x<-rep(1:10,10)
y<-x
plot(x,y) #100 points, only 10 show
plot(jitter(x),jitter(y)) #overlap removed.
>>> Milton Cezar Ribeiro <milton_ruser at yahoo.com.br> 18/12/2007 04:36
>>>
Hi Wayne,
I have two suggestion to you.
1. You add some random noise on both x and y data or
2. You graph bubble points, where the size is proportional to the
frequence of the xy combination.
x<-sample(1:10,10000,replace=T)
y<-sample(1:10,10000,replace=T)
xy<-cbind(x,y)
x11(1400,800)
par(mfrow=c(1,3))
plot(xy)
xy.random<-xy+rnorm(20000,0.1,0.1)
plot(xy.random,cex=0.1)
xy.tab<-data.frame(table(x,y))
xy.tab$x<-as.numeric(as.character(xy.tab$x))
xy.tab$y<-as.numeric(as.character(xy.tab$y))
min.freq<-min(xy.tab$Freq)
max.freq<-max(xy.tab$Freq)
plot(xy.tab$x,xy.tab$y,cex=(xy.tab$Freq-min.freq)/(max.freq-min.freq)*5)
Kind regards,
Miltinho
Brazil
----- Mensagem original ----
De: Wayne Aldo Gavioli <wgavioli at fas.harvard.edu>
Para: r-help at r-project.org
Enviadas: Segunda-feira, 17 de Dezembro de 2007 22:14:23
Assunto: [R] Scatterplot Showing All Points
Hello all,
I'm trying to graph a scatterplot of a large (5,000 x,y coordinates) of
data
with the caveat that many of the data points overlap with each other
(share the
same x AND y coordinates). In using the usual "plot" command,
> plot(education, xlab="etc", ylab="etc")
it seems that the overlap of points is not shown in the graph. Namely,
there
are 5,000 points that should be plotted, as I mentioned above, but
because so
many of the points overlap with each other exactly, only about 50-60
points are
actually plotted on the graph. Thus, there's no indication that Point
A shares
its coordinates with 200 other pieces of data and thus is very common
while
Point B doesn't share its coordinates with any other pieces of data and
thus
isn't common at all. Is there anyway to indicate the frequency of such
points
on such a graph? Should I be using a different command than "plot"?
Thanks,
Wayne
______________________________________________
R-help at 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.
para armazenamento!
[[alternative HTML version deleted]]
______________________________________________
R-help at 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.
More information about the R-help
mailing list