[R] plotting functions with line width (lwd) as vectors

Wolfram Fischer - Z/I/M wolfram at fischer-zim.ch
Tue May 21 15:49:39 CEST 2002

If I want to plot different widths of line segments or arrows
I have to program loops to plot each line apartly. Is that
	n    <- 6
	x    <- 1:n
	y    <- rnorm(1:n)
	q    <- ( x %% 3 + 1 ) * 2
	plot( x, y, cex=q )
	for( i in 1:(n-1) ) lines( x[i:(i+1)], y[i:(i+1)], lwd=q[i], col=q[i] )

Would it not be possible to make plotting functions accept
vectors of line widths (as they accept vectors of colors
and vectors for cex)?

So you could say e.g.:
	plot( x, y, cex=q )
	lines( x, y, lwd=q, col=q )

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list