[R] Label data points in scatterplot matrices

Tom Mulholland tmulholland at bigpond.com
Sat Dec 4 02:20:10 CET 2004


This does job, but it reveals that I don't really understand panels. 
What I would like to know is how do you get the same result but without 
the warnings.

This is essentially taken from the ?pairs help.

data(USJudgeRatings)
# There are 43 observations in this data.frame
z <- 1:43
panel.text <- function(x,y,z, ...)
      {
          text(x,y,z)
      }
  panel.hist <- function(x, ...)
      {
          usr <- par("usr"); on.exit(par(usr))
          par(usr = c(usr[1:2], 0, 1.5) )
          h <- hist(x, plot = FALSE)
          breaks <- h$breaks; nB <- length(breaks)
          y <- h$counts; y <- y/max(y)
          rect(breaks[-nB], 0, breaks[-1], y, col="cyan", ...)
      }

pairs(USJudgeRatings[1:5], panel=panel.text,z=z,,
            cex = 1.5, pch = 24, bg="light blue",
            diag.panel=panel.hist, cex.labels = 2, font.labels=2)


Mauricio Esguerra wrote:
> Hello,
> 
> I am new to R and would like to know how to label data points in the
> matrices of scatterplots made by the pairs() command.
> To be more specific, I want to assign a number to each data point, instead
> of the small circumference that appears as a data point.
> 
> If anyone here knows if its possible to do this with R, I would greatly
> appreciate your help.
> 
> Thank you,
> 
> Mauricio Esguerra
> PhD candidate
> Chemistry and Chemical Biology Department
> Rutgers, the State University of New Jersey
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list