[R] xyplot: problems with column names & legend
Jay
josip.2000 at gmail.com
Tue Jan 5 23:32:34 CET 2010
Anybody? Frustrating to be unable to solve this silly little
problem...
On Jan 3, 12:48 pm, Jay <josip.2... at gmail.com> wrote:
> Thanks, the backtickes got the code working. However, now I cant get
> it to draw the legend/key.
> For example, look at this figure:http://osiris.sunderland.ac.uk/~cs0her/Statistics/xyplot5.png
> My graph is similar, but instead of 1,2,...,8 as the names of the
> series I want it to say "Data one" (a string with spaces) and so on.
>
> On Jan 3, 10:58 am, baptiste auguie <baptiste.aug... at googlemail.com>
> wrote:
>
>
>
> > Hi,
>
> > Using backticks might work to some extent,
>
> > library(lattice)
> > `my variable` = 1:10
> > y=rnorm(10)
> > xyplot(`my variable` ~ y)
>
> > but if your data is in a data.frame the names should have been converted,
>
> > make.names('my variable')
> > [1] "my.variable"
>
> > HTH,
>
> > baptiste
>
> > 2010/1/3 Jay <josip.2... at gmail.com>:
>
> > > Hello!
>
> > > one more question about xyplot. If I have data which have space in the
> > > column names, say "xyz 123". How do I create a working graph where
> > > this text is displayed in the legend key?
>
> > > Now when I try something like xyplot("xyz 123" ~ variable1, data =
> > > mydata, .......) I get nothing.
> > > Also, is it possible to genrate the graph with xyplot(mydata[,1] ~
> > > variable1, data = mydata, .......) and then later in the code specify
> > > the names that should be displayed in the legend?
>
> > > Thank you!
>
> > > ______________________________________________
> > > R-h... at r-project.org mailing list
> > >https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
>
> > ______________________________________________
> > R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list