[R] plotting

Jim Lemon jim at bitwrit.com.au
Tue Dec 22 12:01:20 CET 2009


On 12/22/2009 06:04 AM, teo wrote:
> Hi:
> Could you please guide me how to plot "weekly.t2". Below are my values and I
> am only able to plot "weekly t1" but failing to add a second line
> representng "weekly t2".
> Thanks.
>
>
>
> weekly.t1
>   [1] 228.5204 326.1224 387.2449 415.4082 443.6735 454.6939 451.5306 475.1020
> 483.2653 483.0612 488.9362 488.3673 493.4694 515.3061 509.7959
> [16] 501.0204 513.5714 516.5306 509.4898 516.4286 509.7959 498.6735 492.9592
> 473.6735 487.7551 482.9293
>    
>> weekly.t2
>>      
>   [1]  71.57143  95.41667 110.11905 120.65476 124.33333 130.11905 132.44048
> 137.38095 141.60714 135.35714 131.89873 126.66667 125.47619
> [14] 133.57143 134.34524 137.38095 134.04762 144.40476 148.27381 147.08333
> 146.42857 137.50000 127.14286 127.20238 130.41667 127.67857
>
>
> plot(c(1:26), weekly.t1, type="l", xlab="Week since treatment start", ylab="
> Daily Treatment Dose", main="RIOTT doses", col="blue", axes = FALSE)
> points(c(1:26), weekly.t2, type="l", col="red")
> axis(side=1, at= c(1:26), as.character(c(1:26)))
> axis(side=2, at = seq(from=70, to=700, by=10))
>    
Hi Teo,
Just add ylim=range(c(weekly.t1,weekly.t2)) to your plot command.

Jim




More information about the R-help mailing list