[R] how to get a line plot before/after treatment

Thomas W Blackwell tblackw at umich.edu
Wed May 28 20:47:04 CEST 2003


Frank  -

Roughly speaking:

matplot(c(0,10), rbind(before, after), type="l", axes=F, xlab="time",
         ylab="measurement")
axis(2)
axis(1, c(0,10), c("before","after"))

Should do the job, if I interpret correctly the plot you have in mind.
See help("matplot") : Details, and many pages of help("par") for ways
to modify and decorate the basic plot.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Wed, 28 May 2003, Frank Mattes wrote:

> Dear R help-list reader,
>
> I would like to generate a plot which compares to states in a patient
> treatment, before and after. for this reason I have generated a vector
> before<-c(1,30,23,40)
> and
> after<-c(20,10,20,60)
> the first element in "before" corresponds to the first element in "after".
> I would like and generate a dotplot with
> before and after as x-scale, the elements of "before" and "after" on
> the y-scale and the corresponding elements connected with a line.
>
> However, so far I couldn't figure out how to do this in R. If anyone
> as a suggestion, please let me know
>
> Many thanks
>
> Frank
> --
> Frank Mattes, MD			e-mail:	f.mattes at ucl.ac.uk
> Department of Virology			fax	0044(0)207 8302854
> Royal Free Hospital and 			tel	0044(0)207 8302997
> University College Medical School
> London
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list