Perhaps

 plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)", ylab="Miles per
Gallon", pch=c(3,17,19), col=c("blue", "red", "purple4"))


On 01/10/2007, Letticia Ramlal <[EMAIL PROTECTED]> wrote:
>
> I am trying to plot a graph but the points on the graph should be
> different symbols and colors. It should represent what is in the legend.
> I tried using the points command but this does not work. Is there
> another command in R that would allow me to use different symbols and
> colors for the points?
>
> Thank you kindly.
>
>
>
>
>
> data(mtcars)
>
> plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)", ylab="Miles per
> Gallon")
>
> mtcars$wt.cyl<-mtcars$wt[mtcars$cyl]
>
> mtcars$mpg.cyl<-mtcars$mpg[mtcars$cyl]
>
> points(mtcars$wt.cyl, mtcars$mpg.cyl, pch = 17, col = "red")
>
> title("Motor Trend Data")
>
> text(2,10,"LTR",cex=1.2,adj=0,col=3)
>
> legend(4,30,c("4 cylinder","6 cylinder","8 cylinder"),pch=c(3,17,19),
> cex=1.2, col=c("blue", "red", "purple4"))
>
>
>
>
>
> LTR
>
>
>
>
>
>
>         [[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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[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