Hi,

I was trying to replicate one of the graphs given on the ggplot2 website. I
have given a sample code below. I would like to combine the legends, since
each color is uniquely mapped to a shape.

###
    library(ggplot2)

    leaves <- letters[1:8]
    mat <- matrix(sample(1:1000,32),nrow=16,ncol=2)
    colnames(mat) <- paste('t',1:2,sep='')
    df <- as.data.frame(cbind(mat,leaves))

    vals <- 1:length(leaves)
    names(vals) <- leaves

    p <- ggplot(df,aes(t1,t2))
    p + aes(shape = factor(leaves)) + geom_point(aes(colour =
factor(leaves))) + scale_shape_manual("",values=vals)

####

Which parameter do I need to change?

thanks!

        [[alternative HTML version deleted]]

______________________________________________
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