[R] Howto? plot legend with no line behind the points

Jan Verbesselt Jan.Verbesselt at biw.kuleuven.be
Mon Nov 21 12:28:35 CET 2005


Hi R-help,

We are using R 2.2 on Win XP and have a detail question on how the
legend can be optimised.

We use the following;
-> plot(,type="b",...)
The lines in the plot do not cross the points. How can we obtain the
same effect in the legend? (points without a line through them..)

We tried setting the pt.bg to white but this did not help.
See script below.

thanks,
Jan


 par(mar=c(5,5,2,4) +.1) # dit om extra text in Y-as te plaatsen
   plot(ts.X, type="b", col=1, pch=19,ylim=c(-0.4,0.2),ylab=c("X"))
   legend.txt <- c("X","Y")
   # Define how the legend looks like, place it on the right location
   legend("topright", legend.txt,col=1,lty=1, pch=c(19,1),bty="n", pt.bg=1)
   par(new=T)
   plot(ts.Y, type="b", lty=1, col=1, pch=1, ylab="",
xlab="",yaxt="n",ylim=c(0.1,0.7))
   axis(4)
   mtext(side=4, line=3, "Y", cex=1)

-- 
Ir. Jan Verbesselt
Research Associate
Lab of Geomatics, K.U.Leuven
Vital Decosterstraat 102, 3000 Leuven, Belgium
Tel:+32-16-329750   Fax:+32-16-329760
http://gloveg.kuleuven.ac.be/

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list