Re: [R] xyplot: problems with column names & legend
Jay, I don't recall the details of your original post so the following may be entirely off the mark; nevertheless, here goes: thetext <- paste('Data', 1:8) # or: thetext <- paste('Data', c('one', 'two', 'three', )) xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a", auto.key = list(text= thetext, space = "right", points = FALSE, lines = TRUE)) -Peter Ehlers Jay wrote: Anybody? Frustrating to be unable to solve this silly little problem... On Jan 3, 12:48 pm, Jay 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 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 : 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...@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...@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...@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-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. -- Peter Ehlers University of Calgary 403.202.3921 __ 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.
Re: [R] xyplot: problems with column names & legend
You have not said what the problem is, i.e. what you have tried and what you expect. Please post a small, reproducible example if you want help. Regards -Felix 2010/1/6 Jay : > Anybody? Frustrating to be unable to solve this silly little > problem... > > On Jan 3, 12:48 pm, Jay 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 >> 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 : >> >> > > 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...@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...@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...@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-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. > -- Felix Andrews / 安福立 Postdoctoral Fellow Integrated Catchment Assessment and Management (iCAM) Centre Fenner School of Environment and Society [Bldg 48a] The Australian National University Canberra ACT 0200 Australia M: +61 410 400 963 T: + 61 2 6125 4670 E: felix.andr...@anu.edu.au CRICOS Provider No. 00120C -- http://www.neurofractal.org/felix/ __ 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.
Re: [R] xyplot: problems with column names & legend
Anybody? Frustrating to be unable to solve this silly little problem... On Jan 3, 12:48 pm, Jay 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 > 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 : > > > > 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...@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...@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...@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-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.
Re: [R] xyplot: problems with column names & legend
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 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 : > > > > > 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...@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...@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-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.
Re: [R] xyplot: problems with column names & legend
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 : > 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-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.
Re: [R] xyplot: problems with column names & legend
On Jan 2, 2010, at 6:51 PM, Jay wrote: 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. You could try bquote() around the troublesome string. (And why would you do such a thing in the first place, anyway???) 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? (It's not exactly clear what you mean by legend, but from the fact that you xyplot call has nothing that would clearly need a legend or key, I'm guessing you actually mean the x and y labels.) libary(lattice) ?xyplot # and pay attention to the xlab and ylab arguments ?update -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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] xyplot: problems with column names & legend
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-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.