Hi, Try: lab<- as.character(x[,3]) library(lattice) xyplot(y~time(y),type="b",xlab="Date",ylab="Price",scales=list(x=list(at=time(y),labels=format(time(y),"%b-%d"))), panel=function(x, y, ...) { panel.xyplot(x, y, ...); ltext(x=x, y=y, labels= lab, pos=1, offset=1, cex=0.8)})
A.K. ----- Original Message ----- From: Ankur Seth <ankurset...@gmail.com> To: jim holtman <jholt...@gmail.com> Cc: r-help <r-h...@stat.math.ethz.ch> Sent: Sunday, September 15, 2013 12:43 PM Subject: Re: [R] Data labels in R I want to put labels a,b,c,d on the data points x<-data.frame(c(1,2,3,4),c(1,4,9,16),c("a","b","c","d"), as.Date(c("01-10-2013", "02-10-2013","03-10-2013","04-10-2013"), "%d-%m-%Y")) colnames(x)<-c("x", "sq", "lables","dates") y<-subset(x, select=c(dates,x,sq)) y<-read.zoo(y) plot(y, plot.type="single", xlab="Date", ylab="Price") On Sun, Sep 15, 2013 at 9:16 PM, jim holtman <jholt...@gmail.com> wrote: > Read the help file on 'plot' and look at some of the examples to see > how to place labels in various places on a plot. This is not > difficult if you have read any of the documentation. > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > > On Sun, Sep 15, 2013 at 11:37 AM, Ankur Seth <ankurset...@gmail.com> > wrote: > > I need to put labels in plot in R. Can someone please help? The labels > are > > in the excel file and loaded into "lables" > > > > library(xlsx) > > library(zoo) > > > > fPTAnalysis<-"Input.xls" > > data<-read.xlsx(fPTAnalysis,9) > > > > lables<-subset(data, select=c(Labels)) > > data<-subset(data, select=c(Date,col1, col2 )) > > data<-read.zoo(data) > > > > > > > > plot(data) > > > > -- > > Regards, > > Ankur Seth > > > > [[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. > -- Regards, Ankur Seth [[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. ______________________________________________ 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.