Brian Phillip Weaver
2006-Jun-19 16:52 UTC
[R] Display Conditional Probabilities on y-label
Hello, I am trying to display a conditional probability for the y-label on a beta distribution plot. Here is the code I have been using: z = expression("f(x|") g = paste(z,expression(alpha),",",expression(beta),")") plot(x,y,ylim=c(0,3),xlab="x",ylab=g,lwd=3,type="l",cex.lab=1.3) The output on the plot is as follows: f(x|alpha,beta) This is what I want except have the greek letters for alpha and beta instead of the words. I have consulted plotmath and other options with no luck. I appreciate any help and thank you ahead of time. best, Brian
Charles Annis, P.E.
2006-Jun-19 17:17 UTC
[R] Display Conditional Probabilities on y-label
The trick is not to paste expressions but to make an expression of the pastes: composite.expression <- expression(paste("f(x | ", alpha, ", ", beta, " )")) dev.off() par(mar=c(5,5,1,1)+0.1) plot(NA,xlim=c(0,1), ylim=c(0,3),xlab="x",ylab=composite.expression,lwd=3,type="l",cex.lab=1.3) Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Brian Phillip Weaver Sent: Monday, June 19, 2006 12:53 PM To: r-help at stat.math.ethz.ch Subject: [R] Display Conditional Probabilities on y-label Hello, I am trying to display a conditional probability for the y-label on a beta distribution plot. Here is the code I have been using: z = expression("f(x|") g = paste(z,expression(alpha),",",expression(beta),")") plot(x,y,ylim=c(0,3),xlab="x",ylab=g,lwd=3,type="l",cex.lab=1.3) The output on the plot is as follows: f(x|alpha,beta) This is what I want except have the greek letters for alpha and beta instead of the words. I have consulted plotmath and other options with no luck. I appreciate any help and thank you ahead of time. best, Brian ______________________________________________ R-help at 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