substitute in graphics

View: New views
2 Messages — Rating Filter:   Alert me  

substitute in graphics

by Gustave Lefou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have to do a few graphics of the same function and this function is
parametrized by two arguments.

What I would like is to be able to change the value of these two arguments
without changing the plot command. So as to copy paste.

I tried the following :

x=1:100
eta=10
beta=5
plot(x,h(x),xlab="x",ylab="h(x)",main=substitute( expression( paste("Failure
rate from",W(eta==myeta,beta==mybeta) ) ) ,list(myeta=eta,mybeta=beta) )
)

But it doesn't work. It's written "expression ( Failure rate from W(eta=10,)
..." on the plot with eta as a greek letter.

Thank you very much !

        [[alternative HTML version deleted]]

______________________________________________
R-help@... 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: substitute in graphics

by Henrique Dallazuanna :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Try this:

plot(x, log(x),
     xlab = "x", ylab = "h(x)",
     main = bquote(Failure~rate~from~W(eta == .(eta), beta == .(beta)))


On Fri, May 9, 2008 at 11:31 AM, Gustave Lefou <gustave5000@...>
wrote:

> Hello,
>
> I have to do a few graphics of the same function and this function is
> parametrized by two arguments.
>
> What I would like is to be able to change the value of these two arguments
> without changing the plot command. So as to copy paste.
>
> I tried the following :
>
> x=1:100
> eta=10
> beta=5
> plot(x,h(x),xlab="x",ylab="h(x)",main=substitute( expression(
> paste("Failure
> rate from",W(eta==myeta,beta==mybeta) ) ) ,list(myeta=eta,mybeta=beta) )
> )
>
> But it doesn't work. It's written "expression ( Failure rate from
> W(eta=10,)
> ..." on the plot with eta as a greek letter.
>
> Thank you very much !
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@... 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.
>


--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]


______________________________________________
R-help@... 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.