Hi R Users, I have a dataframe like this: id x rho A 1 0.1 B 20 0.5 C 2 0.9 ... I want to do a scatter plot of "x" versus "rho" but for each point on the scatter plot I want the corresponding entry for "id" instead of points. In STATA I can do so by twoway (scatter x rho, mlabel(id)) How can I do the same in R? I am sure there is some simple way to do this. Dipankar [[alternative HTML version deleted]]
Dipankar Basu <basu.15 <at> gmail.com> writes:> > Hi R Users, > > I have a dataframe like this: > > id x rho > A 1 0.1 > B 20 0.5 > C 2 0.9 > ... > > I want to do a scatter plot of "x" versus "rho" but for each point on the > scatter plot I want the corresponding entry for "id" instead of points.test <- data.frame(id=c("A", "B", "C"), x=c(1, 20, 2), rho=c(0.1, 0.5, 0.9)) plot(rho~x, test, pch=as.character(id)) Mark Lyman
plot(x,rho,pch=id) -----Mensaje original----- De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]En nombre de Dipankar Basu Enviado el: 03 March 2009 20:11 Para: r-help at r-project.org Asunto: [R] scatter plot question Hi R Users, I have a dataframe like this: id x rho A 1 0.1 B 20 0.5 C 2 0.9 ... I want to do a scatter plot of "x" versus "rho" but for each point on the scatter plot I want the corresponding entry for "id" instead of points. In STATA I can do so by twoway (scatter x rho, mlabel(id)) How can I do the same in R? I am sure there is some simple way to do this. Dipankar [[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.
plot(x,rho,pch=id) -----Mensaje original----- De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]En nombre de Dipankar Basu Enviado el: 03 March 2009 20:11 Para: r-help at r-project.org Asunto: [R] scatter plot question Hi R Users, I have a dataframe like this: id x rho A 1 0.1 B 20 0.5 C 2 0.9 ... I want to do a scatter plot of "x" versus "rho" but for each point on the scatter plot I want the corresponding entry for "id" instead of points. In STATA I can do so by twoway (scatter x rho, mlabel(id)) How can I do the same in R? I am sure there is some simple way to do this. Dipankar [[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.