[R] Help with plotmath
Hi R users: How can I have several subscript number with a comma in a plot. I would like to have the LaTeX equivalent of x_{i,j}. I try: plot(1:10,1:10,type=n) text(5,5,expression(x[i,j])) but it doesn´t work. Thank you for your help. __ R-help@stat.math.ethz.ch 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] Help with plotmath
Try: text(5,5,expression(x[i * , * j])) On 9/4/06, Kenneth Cabrera [EMAIL PROTECTED] wrote: Hi R users: How can I have several subscript number with a comma in a plot. I would like to have the LaTeX equivalent of x_{i,j}. I try: plot(1:10,1:10,type=n) text(5,5,expression(x[i,j])) but it doesn´t work. Thank you for your help. __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 with plotmath
There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with plotmath
You *parse* strings to form expressions. plot( c(0,1), c(0,1), main=parse(text=ex) ) On Thu, 10 Jun 2004, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. You might also want to explore substitute. Can someone tell me the magic words? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with plotmath
Hi On 10 Jun 2004 at 12:28, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) Plotmath example led me to ex-expression(x^2) plot( c(0,1), c(0,1), main=(ex) ) hope it is what you want. Cheers Petr gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with plotmath
No that isn't it I'm afraid - my expression is pasted together from various bits and pieces and is at some stage a string variable. I needed parse as Brian pointed out Thanks anyway, Steve. From: Petr Pikal [EMAIL PROTECTED] To: Steve Roberts [EMAIL PROTECTED] Date sent: Thu, 10 Jun 2004 13:44:21 +0200 Subject:Re: [R] Help with plotmath Copies to: [EMAIL PROTECTED] Priority: normal Hi On 10 Jun 2004 at 12:28, Steve Roberts wrote: There must be a simple answer. I want to plot an expression, where the expression is held in a string variable. The obvious solution along the lines of ex-x^2 plot( c(0,1), c(0,1), main=as.expression(ex) ) Plotmath example led me to ex-expression(x^2) plot( c(0,1), c(0,1), main=(ex) ) hope it is what you want. Cheers Petr gives me the a title x^2 - ie doesn't treat it like an expression. I suspect I don't understand expressions properly. For the real problem I do need to have my expression string in a variable as it is data-dependent. Can someone tell me the magic words? Steve Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html