Dear Sir I want to write the numbers 1,2,3,----on a scatter plot instead of points, like 1 corresponding to first point on plot, 2 corresponding second point etc. Help in this regard. Regards -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. [[alternative HTML version deleted]]
Hi, Try this, plot(1:5,1:5, t='p', pch=paste(1:5)) baptiste 2009/7/30 amna khan <amnakhan493 at gmail.com>:> Dear Sir > > I want to write the numbers 1,2,3,----on a scatter plot instead of points, > like 1 corresponding to first point on plot, 2 corresponding second point > etc. > Help in this regard. > > Regards > > -- > AMINA SHAHZADI > Department of Statistics > GC University Lahore, Pakistan. > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Tri this for both, points and text.. library(ggplot2) qplot(x=1:5,y=1:5) + geom_text(label=1:5) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Thu, 7/30/09, amna khan <amnakhan493 at gmail.com> wrote:> From: amna khan <amnakhan493 at gmail.com> > Subject: [R] Scatter Plot > To: r-help at r-project.org > Date: Thursday, July 30, 2009, 9:14 AM > Dear Sir > > I want to write the numbers 1,2,3,----on a scatter plot > instead of points, > like 1 corresponding to first point on plot, 2 > corresponding second point > etc. > Help in this regard. > > Regards > > -- > AMINA SHAHZADI > Department of Statistics > GC University Lahore, Pakistan. > > ??? [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org > mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. >
x <- 1:10 y <- 1:10 plot("", xlim=c(1,10),ylim=c(0,10) text(x,y, labels=x) --- On Thu, 7/30/09, amna khan <amnakhan493 at gmail.com> wrote:> From: amna khan <amnakhan493 at gmail.com> > Subject: [R] Scatter Plot > To: r-help at r-project.org > Received: Thursday, July 30, 2009, 12:14 PM > Dear Sir > > I want to write the numbers 1,2,3,----on a scatter plot > instead of points, > like 1 corresponding to first point on plot, 2 > corresponding second point > etc. > Help in this regard. > > Regards > > -- > AMINA SHAHZADI > Department of Statistics > GC University Lahore, Pakistan. > > ??? [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org > mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. >__________________________________________________________________ Be smarter than spam. See how smart Sp ck on Options in Mail and switch to New Mail today or register for free at
please Cc. the list next time Two suggestions, 1) read the help page, e.g. ?points would have told you why pch="10" produces "1". 2) Try the following and see which you prefer, x = y = labels = 1:20 ?text plot(x, y, type='n') # empty plot text(x, y, paste(labels)) library(ggplot2) ?qplot qplot(x, y, geom="text", label=labels) library(lattice) ?xyplot xyplot(y~x, t="n", panel = function(...) { panel.text(..., label= labels) } ) HTH, baptiste 2009/7/31 amna khan <amnakhan493 at gmail.com>:> Hi Sir > Your suggested code worked only for numbers 1 to 9 remaining points were > marked by 1. I want to have numbers 1 to 22 instead of points on scatter > plot. > Suggest more. > Kind Regards> On Thu, Jul 30, 2009 at 11:57 PM, baptiste auguie > <baptiste.auguie at googlemail.com> wrote: >> >> Hi, >> >> Try this, >> >> plot(1:5,1:5, t='p', pch=paste(1:5)) >> >> baptiste >> >> >> 2009/7/30 amna khan <amnakhan493 at gmail.com>: >> > Dear Sir >> > >> > I want to write the numbers 1,2,3,----on a scatter plot instead of >> > points, >> > like 1 corresponding to first point on plot, 2 corresponding second >> > point >> > etc. >> > Help in this regard. >> > >> > Regards >> > >> > -- >> > AMINA SHAHZADI >> > Department of Statistics >> > GC University Lahore, Pakistan. >> > >> > ? ? ? ?[[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help at r-project.org mailing list >> > stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> > R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> > > > > > -- > AMINA SHAHZADI > Department of Statistics > GC University Lahore, Pakistan. >-- _____________________________ Baptiste Augui? School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK newton.ex.ac.uk/research/emag