Legend that changes value of number in R -


let's have variable mm = 5 change , have number change automatically update in legend of graph. says "no change" , "change in m" m = 3 , m = 5. can done?

m <- 3   <-  .5  b <-  1 c <-  .5 g <-  seq(.02,.2,by=.02) n <-  7 r <-  .25 alpha <-  2 dt <-  1 x <-  .1 #changed parameters mm <- 5  a.2 = function(m = m,a,b,c,g,n,r,alpha,dt,x) {    1 - exp(-dt*(1/(alpha*dt)*log(1+(alpha*b*dt*m*a^2*c*x*exp(-g*n))/(a*c*x+g)))) }  all.data.g <- expand.grid(m = m,g = g,x = x)  all.data.g$a.4 <- a.2(m,a,b,c,all.data.g$g,n,r,alpha,dt,x) all.data.g$a.5 <- a.2(mm,a,b,c,all.data.g$g,n,r,alpha,dt,x)  plot(all.data.g$g, all.data.g$a.4, xlab = 'g', ylab = 'attack rate', ylim = c(0,1), type = 'l') lines(all.data.g$g, all.data.g$a.5, lty=2) legend('topright', c("no change","change in m"),lty=c(1,2))  


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -