[R] scatterplot (car) legend modification

sam stein sam at mega.net
Tue Jun 9 05:48:32 CEST 2009


hi,

new to R and using the car package to do some scatterplots with ellipses
hoping to add the area and center points of each ellipse to the legend?

looking for some direction / ideas.... here is the script, the data is  
where
golf shots end up by club.

	x (dispersion), y (distance), group (Club)

thanks, sam

## usage: Rscript shotScatter.R infile outfile level1 level2 minX maxX  
minY maxY
## load the library
    library(car)

## get the args
    args = commandArgs(TRUE);

## get the data format is: x, y, group
    Shot_Data <- read.table(args[1],
                          sep = ",",
                          header=T)

## setup the pdf file name
    pdf(file = args[2])

## do the plot
    scatterplot(y ~ x | Club, data=Shot_Data,
          ellipse = TRUE,
                levels = c(as.numeric(args[3]), as.numeric(args[4])),
                robust = TRUE,
                boxplots = "",
          xlab = "Dispersion",
          ylab = "Distance",
          xlim = c(as.numeric(args[5]), as.numeric(args[6])),
          ylim = c(as.numeric(args[7]), as.numeric(args[8])),
          smooth = FALSE,
          reg.line = FALSE)




More information about the R-help mailing list