[R] anyone know how to plot histograma and line in the same graph

Henrique Dallazuanna wwwhsd at gmail.com
Fri Feb 15 16:10:51 CET 2008


Try this:

hist(x[,1], ylim=c(0,max(x[,2])))
lines(x[,2], col="blue", lty=2)


On 15/02/2008, Xin <jasonshi510 at hotmail.com> wrote:
> Dear:
>
>    I have two series data, which are:
>       p1-obs p1-exp
>       13 13
>       20 23.296
>       22 18.139
>       19 14.972
>       10 12.576
>       16 10.658
>       8 9.0794
>       4 7.7625
>       3 6.6536
>       5 5.7141
>       7 4.9146
>       4 4.2321
>       0 3.648
>       4 3.1471
>       4 2.7168
>       2 2.3468
>       4 2.0283
>       2 1.7537
>       2 1.517
>       5 1.3127
>       1 1.1362
>
>
>  And I want to plot one of series by historgram and the other by line.
>
>  such as the attachment.
>
>
>  Thanks
>
>
>  Xin
>
> ______________________________________________
>  R-help at r-project.org 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



More information about the R-help mailing list