[R] how to make lines() meet axis in autoscaled coordinate system?

Rolf Turner rolf at math.unb.ca
Thu Aug 26 23:15:44 CEST 2004


Johannes Graumann wrote:

> I have an auto-scaled coordinate system and would like to add some
> clarifying lines to the graph - which ares supposed to meet the axis.
> 
> >lines(c(0,time1,time1), c(1,1,0),lty=3)
> 
> does what I want, BUT the second leg does not touch the x-axis since the
> auto-scaling of the y-axis does not start at'0' but slightly negative.
> I could now adjust the line length by 'trial and error' to suit my
> needs, but I'd prefer a generalizable solution like
> 
> >lines(c(<some_macro_for_y-axis_position>,time1,time1),
> +	c(1,1,<some_macro_for_x-axis_position>),lty=3)

	lines(c(par()$usr[1],time1,time1), c(1,1,par()$usr[3]),lty=3)

				cheers,

					Rolf Turner
					rolf at math.unb.ca




More information about the R-help mailing list